Do not install transitive packaging specs of overriden modules
e.g. if a cc_binary is overriden, its shared_libs should not be
installed.
To do, a new `depNames` array is introduced to track the top-level
module which requested the packaging spec. If the top-level module has
been overridden, the packaging spec will not be installed.
Test: go test ./filesystem
Test: vendor partition diffs for aosp cf https://diff.googleplex.com/#key=276Je74QO1VE
Change-Id: I1c8df831c696990bb0982e4537129b8e85abeda6
diff --git a/filesystem/filesystem_test.go b/filesystem/filesystem_test.go
index ab63550..7300061 100644
--- a/filesystem/filesystem_test.go
+++ b/filesystem/filesystem_test.go
@@ -629,3 +629,38 @@
fileList := android.ContentFromFileRuleForTests(t, result.TestContext, partition.Output("fileList"))
android.AssertDeepEquals(t, "cc_library listed in deps", "lib64/libc++.so\nlib64/libc.so\nlib64/libdl.so\nlib64/libfoo.so\nlib64/libm.so\n", fileList)
}
+
+// binfoo1 overrides binbar. transitive deps of binbar should not be installed.
+func TestDoNotInstallTransitiveDepOfOverriddenModule(t *testing.T) {
+ result := fixture.RunTestWithBp(t, `
+android_filesystem {
+ name: "myfilesystem",
+ deps: ["binfoo1", "libfoo2", "binbar"],
+}
+cc_binary {
+ name: "binfoo1",
+ shared_libs: ["libfoo"],
+ overrides: ["binbar"],
+}
+cc_library {
+ name: "libfoo",
+}
+cc_library {
+ name: "libfoo2",
+ overrides: ["libfoo"],
+}
+// binbar gets overridden by binfoo1
+// therefore, libbar should not be installed
+cc_binary {
+ name: "binbar",
+ shared_libs: ["libbar"]
+}
+cc_library {
+ name: "libbar",
+}
+ `)
+
+ partition := result.ModuleForTests("myfilesystem", "android_common")
+ fileList := android.ContentFromFileRuleForTests(t, result.TestContext, partition.Output("fileList"))
+ android.AssertDeepEquals(t, "Shared library dep of overridden binary should not be installed", fileList, "bin/binfoo1\nlib64/libc++.so\nlib64/libc.so\nlib64/libdl.so\nlib64/libfoo2.so\nlib64/libm.so\n")
+}