Support override_android_(app|apex) in deps of android_filesystem
These modules implicitly override their base module. e.g. if
com.android.foo and com.company.android.foo are listed in deps, only the
latter should be installed.
Override modules are implemented as an "override" variant of the base
module, and all the build actions are generated there. To not install
the overridden app/apex, the following properties are updated in the
_overriding_ PackagingSpec variant of the base apex
1. overrides: base apex (e.g. com.android.foo)
2. owner: overriding apex (e.g. com.company.android.foo)
Test: go test ./filesystem
Change-Id: I59f17134dc6ed99a252977c3615b1be5d6d746ba
diff --git a/filesystem/filesystem_test.go b/filesystem/filesystem_test.go
index f767eae..29f9373 100644
--- a/filesystem/filesystem_test.go
+++ b/filesystem/filesystem_test.go
@@ -691,3 +691,27 @@
android.AssertStringDoesContain(t, "Could not find linker.config.json file in cmd", linkerConfigCmd, "conv_linker_config proto --force -s linker.config.json")
android.AssertStringDoesContain(t, "Could not find stub in `provideLibs`", linkerConfigCmd, "--key provideLibs --value libfoo_has_stubs.so")
}
+
+// override_android_* modules implicitly override their base module.
+// If both of these are listed in `deps`, the base module should not be installed.
+func TestOverrideModulesInDeps(t *testing.T) {
+ result := fixture.RunTestWithBp(t, `
+ android_filesystem {
+ name: "myfilesystem",
+ deps: ["myapp", "myoverrideapp"],
+ }
+
+ android_app {
+ name: "myapp",
+ platform_apis: true,
+ }
+ override_android_app {
+ name: "myoverrideapp",
+ base: "myapp",
+ }
+ `)
+
+ partition := result.ModuleForTests("myfilesystem", "android_common")
+ fileList := android.ContentFromFileRuleForTests(t, result.TestContext, partition.Output("fileList"))
+ android.AssertStringEquals(t, "filesystem with override app", "app/myoverrideapp/myoverrideapp.apk\n", fileList)
+}