Loading apex/apex.go +1 −1 Original line number Diff line number Diff line Loading @@ -1666,7 +1666,7 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) { // system libraries. if !am.DirectlyInAnyApex() { // we need a module name for Make name := cc.ImplementationModuleName(ctx) name := cc.ImplementationModuleNameForMake(ctx) if !proptools.Bool(a.properties.Use_vendor) { // we don't use subName(.vendor) for a "use_vendor: true" apex Loading apex/apex_test.go +51 −0 Original line number Diff line number Diff line Loading @@ -6186,6 +6186,57 @@ func TestNonPreferredPrebuiltDependency(t *testing.T) { `) } func TestPreferredPrebuiltSharedLibDep(t *testing.T) { ctx, config := testApex(t, ` apex { name: "myapex", key: "myapex.key", native_shared_libs: ["mylib"], } apex_key { name: "myapex.key", public_key: "testkey.avbpubkey", private_key: "testkey.pem", } cc_library { name: "mylib", srcs: ["mylib.cpp"], apex_available: ["myapex"], shared_libs: ["otherlib"], system_shared_libs: [], } cc_library { name: "otherlib", srcs: ["mylib.cpp"], stubs: { versions: ["current"], }, } cc_prebuilt_library_shared { name: "otherlib", prefer: true, srcs: ["prebuilt.so"], stubs: { versions: ["current"], }, } `) ab := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle) data := android.AndroidMkDataForTest(t, config, "", ab) var builder strings.Builder data.Custom(&builder, ab.BaseModuleName(), "TARGET_", "", data) androidMk := builder.String() // The make level dependency needs to be on otherlib - prebuilt_otherlib isn't // a thing there. ensureContains(t, androidMk, "LOCAL_REQUIRED_MODULES += otherlib\n") } func TestMain(m *testing.M) { run := func() int { setUp() Loading cc/cc.go +13 −0 Original line number Diff line number Diff line Loading @@ -1099,6 +1099,19 @@ func (c *Module) ImplementationModuleName(ctx android.BaseModuleContext) string return name } // Similar to ImplementationModuleName, but uses the Make variant of the module // name as base name, for use in AndroidMk output. E.g. for a prebuilt module // where the Soong name is prebuilt_foo, this returns foo (which works in Make // under the premise that the prebuilt module overrides its source counterpart // if it is exposed to Make). func (c *Module) ImplementationModuleNameForMake(ctx android.BaseModuleContext) string { name := c.BaseModuleName() if versioned, ok := c.linker.(versionedInterface); ok { name = versioned.implementationModuleName(name) } return name } func (c *Module) bootstrap() bool { return Bool(c.Properties.Bootstrap) } Loading Loading
apex/apex.go +1 −1 Original line number Diff line number Diff line Loading @@ -1666,7 +1666,7 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) { // system libraries. if !am.DirectlyInAnyApex() { // we need a module name for Make name := cc.ImplementationModuleName(ctx) name := cc.ImplementationModuleNameForMake(ctx) if !proptools.Bool(a.properties.Use_vendor) { // we don't use subName(.vendor) for a "use_vendor: true" apex Loading
apex/apex_test.go +51 −0 Original line number Diff line number Diff line Loading @@ -6186,6 +6186,57 @@ func TestNonPreferredPrebuiltDependency(t *testing.T) { `) } func TestPreferredPrebuiltSharedLibDep(t *testing.T) { ctx, config := testApex(t, ` apex { name: "myapex", key: "myapex.key", native_shared_libs: ["mylib"], } apex_key { name: "myapex.key", public_key: "testkey.avbpubkey", private_key: "testkey.pem", } cc_library { name: "mylib", srcs: ["mylib.cpp"], apex_available: ["myapex"], shared_libs: ["otherlib"], system_shared_libs: [], } cc_library { name: "otherlib", srcs: ["mylib.cpp"], stubs: { versions: ["current"], }, } cc_prebuilt_library_shared { name: "otherlib", prefer: true, srcs: ["prebuilt.so"], stubs: { versions: ["current"], }, } `) ab := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle) data := android.AndroidMkDataForTest(t, config, "", ab) var builder strings.Builder data.Custom(&builder, ab.BaseModuleName(), "TARGET_", "", data) androidMk := builder.String() // The make level dependency needs to be on otherlib - prebuilt_otherlib isn't // a thing there. ensureContains(t, androidMk, "LOCAL_REQUIRED_MODULES += otherlib\n") } func TestMain(m *testing.M) { run := func() int { setUp() Loading
cc/cc.go +13 −0 Original line number Diff line number Diff line Loading @@ -1099,6 +1099,19 @@ func (c *Module) ImplementationModuleName(ctx android.BaseModuleContext) string return name } // Similar to ImplementationModuleName, but uses the Make variant of the module // name as base name, for use in AndroidMk output. E.g. for a prebuilt module // where the Soong name is prebuilt_foo, this returns foo (which works in Make // under the premise that the prebuilt module overrides its source counterpart // if it is exposed to Make). func (c *Module) ImplementationModuleNameForMake(ctx android.BaseModuleContext) string { name := c.BaseModuleName() if versioned, ok := c.linker.(versionedInterface); ok { name = versioned.implementationModuleName(name) } return name } func (c *Module) bootstrap() bool { return Bool(c.Properties.Bootstrap) } Loading