Runtime deps to a stubs lib crosses APEX boundary am: 323a4c3ab3

Change-Id: Iec26a8e8e29c66464d5d72b8d5ce84e23d8d892a
This commit is contained in:
Automerger Merge Worker
2020-03-02 00:25:50 +00:00
2 changed files with 19 additions and 4 deletions

View File

@@ -810,7 +810,6 @@ func TestApexWithRuntimeLibsDependency(t *testing.T) {
stubs: { stubs: {
versions: ["10", "20", "30"], versions: ["10", "20", "30"],
}, },
apex_available: [ "myapex" ],
} }
cc_library { cc_library {
@@ -3175,6 +3174,7 @@ func TestApexAvailable(t *testing.T) {
name: "libfoo", name: "libfoo",
stl: "none", stl: "none",
system_shared_libs: [], system_shared_libs: [],
runtime_libs: ["libbaz"],
apex_available: ["myapex"], apex_available: ["myapex"],
} }
@@ -3183,6 +3183,15 @@ func TestApexAvailable(t *testing.T) {
stl: "none", stl: "none",
system_shared_libs: [], system_shared_libs: [],
apex_available: ["//apex_available:anyapex"], apex_available: ["//apex_available:anyapex"],
}
cc_library {
name: "libbaz",
stl: "none",
system_shared_libs: [],
stubs: {
versions: ["10", "20", "30"],
},
}`) }`)
// check that libfoo and libbar are created only for myapex, but not for the platform // check that libfoo and libbar are created only for myapex, but not for the platform

View File

@@ -2631,9 +2631,15 @@ func (c *Module) AndroidMkWriteAdditionalDependenciesForSourceAbiDiff(w io.Write
func (c *Module) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool { func (c *Module) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool {
if depTag, ok := ctx.OtherModuleDependencyTag(dep).(DependencyTag); ok { if depTag, ok := ctx.OtherModuleDependencyTag(dep).(DependencyTag); ok {
if cc, ok := dep.(*Module); ok { if cc, ok := dep.(*Module); ok {
if cc.HasStubsVariants() && depTag.Shared && depTag.Library { if cc.HasStubsVariants() {
// dynamic dep to a stubs lib crosses APEX boundary if depTag.Shared && depTag.Library {
return false // dynamic dep to a stubs lib crosses APEX boundary
return false
}
if IsRuntimeDepTag(depTag) {
// runtime dep to a stubs lib also crosses APEX boundary
return false
}
} }
if depTag.FromStatic { if depTag.FromStatic {
// shared_lib dependency from a static lib is considered as crossing // shared_lib dependency from a static lib is considered as crossing