Only output make targets for uninstallable static libs in the APEX
unavailable-to-platform case.
This removes the special case added in https://r.android.com/1274763
from SkipInstall(), so that it doesn't cause conflicting AndroidMk
entries when a cc_prebuilt_library_static module has prefer:true and
the corresponding source module exists.
Test: `m` in a tree with a snapshot created from art-module-sdk where
the libartimagevalues module has prefer:true
Bug: 151303681
Change-Id: I651ae325753b707296892adb4cae80daaddb6af2
diff --git a/android/apex.go b/android/apex.go
index cd84f8a..8c06b63 100644
--- a/android/apex.go
+++ b/android/apex.go
@@ -296,7 +296,10 @@
for i, mod := range modules {
platformVariation := i == 0
if platformVariation && !mctx.Host() && !mod.(ApexModule).AvailableFor(AvailableToPlatform) {
- mod.SkipInstall()
+ // Do not install the module for platform, but still allow it to output
+ // uninstallable AndroidMk entries in certain cases when they have
+ // side effects.
+ mod.MakeUninstallable()
}
if !platformVariation {
mod.(ApexModule).apexModuleBase().ApexProperties.Info = m.apexVariations[i-1]
diff --git a/android/module.go b/android/module.go
index 8605954..2dc2ac7 100644
--- a/android/module.go
+++ b/android/module.go
@@ -256,6 +256,7 @@
InstallForceOS() *OsType
SkipInstall()
IsSkipInstall() bool
+ MakeUninstallable()
ExportedToMake() bool
InitRc() Paths
VintfFragments() Paths
@@ -1046,6 +1047,15 @@
return m.commonProperties.SkipInstall == true
}
+// Similar to SkipInstall, but if the AndroidMk entry would set
+// LOCAL_UNINSTALLABLE_MODULE then this variant may still output that entry
+// rather than leaving it out altogether. That happens in cases where it would
+// have other side effects, in particular when it adds a NOTICE file target,
+// which other install targets might depend on.
+func (m *ModuleBase) MakeUninstallable() {
+ m.SkipInstall()
+}
+
func (m *ModuleBase) ExportedToMake() bool {
return m.commonProperties.NamespaceExportedToMake
}