Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2d096a5f authored by Nishith  Khanna's avatar Nishith Khanna
Browse files

Merge remote-tracking branch 'origin/lineage-23.0' into a16

parents 202f32c5 cff28f53
Loading
Loading
Loading
Loading
Loading
+0 −12
Original line number Diff line number Diff line
@@ -45,14 +45,6 @@ type Module interface {
	// For more information, see Module.GenerateBuildActions within Blueprint's module_ctx.go
	GenerateAndroidBuildActions(ModuleContext)

	// CleanupAfterBuildActions is called after ModuleBase.GenerateBuildActions is finished.
	// If all interactions with this module are handled via providers instead of direct access
	// to the module then it can free memory attached to the module.
	// This is a temporary measure to reduce memory usage, eventually blueprint's reference
	// to the Module should be dropped after GenerateAndroidBuildActions once all accesses
	// can be done through providers.
	CleanupAfterBuildActions()

	// Add dependencies to the components of a module, i.e. modules that are created
	// by the module and which are considered to be part of the creating module.
	//
@@ -2401,12 +2393,8 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext)
			})
		}
	}

	m.module.CleanupAfterBuildActions()
}

func (m *ModuleBase) CleanupAfterBuildActions() {}

func SetJarJarPrefixHandler(handler func(ModuleContext)) {
	if jarJarPrefixHandler != nil {
		panic("jarJarPrefixHandler already set")
+0 −4
Original line number Diff line number Diff line
@@ -27,10 +27,6 @@ func (m ModuleProxy) GenerateAndroidBuildActions(context ModuleContext) {
	panic("method is not implemented on ModuleProxy")
}

func (m ModuleProxy) CleanupAfterBuildActions() {
	panic("method is not implemented on ModuleProxy")
}

func (m ModuleProxy) ComponentDepsMutator(ctx BottomUpMutatorContext) {
	panic("method is not implemented on ModuleProxy")
}
+0 −21
Original line number Diff line number Diff line
@@ -2438,27 +2438,6 @@ func (c *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
	}
}

func (c *Module) CleanupAfterBuildActions() {
	// Clear as much of Module as possible to reduce memory usage.
	c.generators = nil
	c.compiler = nil
	c.installer = nil
	c.features = nil
	c.coverage = nil
	c.fuzzer = nil
	c.sabi = nil
	c.lto = nil
	c.afdo = nil
	c.orderfile = nil

	// TODO: these can be cleared after nativeBinaryInfoProperties and nativeLibInfoProperties are switched to
	//  using providers.
	// c.linker = nil
	// c.stl = nil
	// c.sanitize = nil
	// c.library = nil
}

func CreateCommonLinkableInfo(ctx android.ModuleContext, mod VersionedLinkableInterface) *LinkableInfo {
	info := &LinkableInfo{
		StaticExecutable:     mod.StaticExecutable(),
+9 −16
Original line number Diff line number Diff line
@@ -134,24 +134,17 @@ func TestCCFuzzDepBundling(t *testing.T) {
			}
	`)

	fuzz_shared_libtest := ctx.ModuleForTests(t, "fuzz_shared_libtest", "android_arm64_armv8-a_fuzzer").Module()
	fuzz_static_libtest := ctx.ModuleForTests(t, "fuzz_static_libtest", "android_arm64_armv8-a_fuzzer").Module()
	fuzz_staticffi_libtest := ctx.ModuleForTests(t, "fuzz_staticffi_libtest", "android_arm64_armv8-a_fuzzer").Module()
	fuzz_shared_libtest := ctx.ModuleForTests(t, "fuzz_shared_libtest", "android_arm64_armv8-a_fuzzer").Module().(cc.LinkableInterface)
	fuzz_static_libtest := ctx.ModuleForTests(t, "fuzz_static_libtest", "android_arm64_armv8-a_fuzzer").Module().(cc.LinkableInterface)
	fuzz_staticffi_libtest := ctx.ModuleForTests(t, "fuzz_staticffi_libtest", "android_arm64_armv8-a_fuzzer").Module().(cc.LinkableInterface)

	fuzzSharedLibraries := func(module android.Module) string {
		if info, ok := android.OtherModuleProvider(ctx, module, cc.LinkableInfoProvider); ok {
			return info.FuzzSharedLibraries.String()
	if !strings.Contains(fuzz_shared_libtest.FuzzSharedLibraries().String(), ":libcc_transitive_dep.so") {
		t.Errorf("cc_fuzz does not contain the expected bundled transitive shared libs from rust_ffi_shared ('libcc_transitive_dep'): %#v", fuzz_shared_libtest.FuzzSharedLibraries().String())
	}
		return ""
	if !strings.Contains(fuzz_static_libtest.FuzzSharedLibraries().String(), ":libcc_transitive_dep.so") {
		t.Errorf("cc_fuzz does not contain the expected bundled transitive shared libs from rust_ffi_static ('libcc_transitive_dep'): %#v", fuzz_static_libtest.FuzzSharedLibraries().String())
	}

	if libs := fuzzSharedLibraries(fuzz_shared_libtest); !strings.Contains(libs, ":libcc_transitive_dep.so") {
		t.Errorf("cc_fuzz does not contain the expected bundled transitive shared libs from rust_ffi_shared ('libcc_transitive_dep'): %#v", libs)
	}
	if libs := fuzzSharedLibraries(fuzz_static_libtest); !strings.Contains(libs, ":libcc_transitive_dep.so") {
		t.Errorf("cc_fuzz does not contain the expected bundled transitive shared libs from rust_ffi_static ('libcc_transitive_dep'): %#v", libs)
	}
	if libs := fuzzSharedLibraries(fuzz_staticffi_libtest); !strings.Contains(libs, ":libcc_transitive_dep.so") {
		t.Errorf("cc_fuzz does not contain the expected bundled transitive shared libs from rust_ffi_static ('libcc_transitive_dep'): %#v", libs)
	if !strings.Contains(fuzz_staticffi_libtest.FuzzSharedLibraries().String(), ":libcc_transitive_dep.so") {
		t.Errorf("cc_fuzz does not contain the expected bundled transitive shared libs from rust_ffi_static ('libcc_transitive_dep'): %#v", fuzz_staticffi_libtest.FuzzSharedLibraries().String())
	}
}