From c1ded7e7d50c4b146ef35c1e7c6aa18b3e1a1fab Mon Sep 17 00:00:00 2001 From: Spandan Das Date: Fri, 1 Nov 2024 00:52:33 +0000 Subject: 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 --- filesystem/filesystem_test.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'filesystem/filesystem_test.go') diff --git a/filesystem/filesystem_test.go b/filesystem/filesystem_test.go index f767eaed1..29f9373d7 100644 --- a/filesystem/filesystem_test.go +++ b/filesystem/filesystem_test.go @@ -691,3 +691,27 @@ cc_library { 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) +} -- cgit v1.2.3-59-g8ed1b