Fix apex to follow deps of modules with stubs.
In case that an apex module depends on a module with stubs directly *and* indirectly, the build system should follow the deps graph further. Note that WalkDeps() visits deps in DFS and it won't visit again visited modules. Bug: n/a Test: m (apex_test.go amended) Change-Id: I1a6f135dbda6d1eb641575a3fbbc9bbee0622076
This commit is contained in:
@@ -228,6 +228,14 @@ func UpdateApexDependency(apexName string, moduleName string, directDep bool) {
|
|||||||
apexNames[apexName] = apexNames[apexName] || directDep
|
apexNames[apexName] = apexNames[apexName] || directDep
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO(b/146393795): remove this when b/146393795 is fixed
|
||||||
|
func ClearApexDependency() {
|
||||||
|
m := apexNamesMap()
|
||||||
|
for k := range m {
|
||||||
|
delete(m, k)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Tests whether a module named moduleName is directly depended on by an APEX
|
// Tests whether a module named moduleName is directly depended on by an APEX
|
||||||
// named apexName.
|
// named apexName.
|
||||||
func DirectlyInApex(apexName string, moduleName string) bool {
|
func DirectlyInApex(apexName string, moduleName string) bool {
|
||||||
|
@@ -1093,7 +1093,7 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
// don't include it in this APEX
|
// don't include it in this APEX
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if !a.Host() && (cc.IsStubs() || cc.HasStubsVariants()) {
|
if !a.Host() && !android.DirectlyInApex(ctx.ModuleName(), ctx.OtherModuleName(cc)) && (cc.IsStubs() || cc.HasStubsVariants()) {
|
||||||
// If the dependency is a stubs lib, don't include it in this APEX,
|
// If the dependency is a stubs lib, don't include it in this APEX,
|
||||||
// but make sure that the lib is installed on the device.
|
// but make sure that the lib is installed on the device.
|
||||||
// In case no APEX is having the lib, the lib is installed to the system
|
// In case no APEX is having the lib, the lib is installed to the system
|
||||||
|
@@ -92,6 +92,7 @@ func withBinder32bit(fs map[string][]byte, config android.Config) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func testApexContext(t *testing.T, bp string, handlers ...testCustomizer) (*android.TestContext, android.Config) {
|
func testApexContext(t *testing.T, bp string, handlers ...testCustomizer) (*android.TestContext, android.Config) {
|
||||||
|
android.ClearApexDependency()
|
||||||
config := android.TestArchConfig(buildDir, nil)
|
config := android.TestArchConfig(buildDir, nil)
|
||||||
config.TestProductVariables.DeviceVndkVersion = proptools.StringPtr("current")
|
config.TestProductVariables.DeviceVndkVersion = proptools.StringPtr("current")
|
||||||
config.TestProductVariables.DefaultAppCertificate = proptools.StringPtr("vendor/foo/devkeys/test")
|
config.TestProductVariables.DefaultAppCertificate = proptools.StringPtr("vendor/foo/devkeys/test")
|
||||||
@@ -683,6 +684,12 @@ func TestApexWithStubs(t *testing.T) {
|
|||||||
|
|
||||||
// Ensure that genstub is invoked with --apex
|
// Ensure that genstub is invoked with --apex
|
||||||
ensureContains(t, "--apex", ctx.ModuleForTests("mylib2", "android_arm64_armv8-a_static_3_myapex").Rule("genStubSrc").Args["flags"])
|
ensureContains(t, "--apex", ctx.ModuleForTests("mylib2", "android_arm64_armv8-a_static_3_myapex").Rule("genStubSrc").Args["flags"])
|
||||||
|
|
||||||
|
ensureExactContents(t, ctx, "myapex", []string{
|
||||||
|
"lib64/mylib.so",
|
||||||
|
"lib64/mylib3.so",
|
||||||
|
"lib64/mylib4.so",
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestApexWithExplicitStubsDependency(t *testing.T) {
|
func TestApexWithExplicitStubsDependency(t *testing.T) {
|
||||||
|
Reference in New Issue
Block a user