Make installable arch-variant and static vs shared variant for cc modules
libc's native_bridge shared variant needs to be installable: false,
make the installable property arch-variant and allow the static and
shared clauses to override it.
This relands I8e0eaed2169e89520b07bb0326bb97ac0b4a70ac with fixes to
allow only the shared variant to be marked installable: false.
Bug: 204136549
Test: m checkbuild
Change-Id: Ie579b5ba56ca21f4d9243088afd5078d8c122a68
diff --git a/cc/cc.go b/cc/cc.go
index 1c65549..32652c1 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -325,7 +325,7 @@
SnapshotStaticLibs []string `blueprint:"mutated"`
SnapshotRuntimeLibs []string `blueprint:"mutated"`
- Installable *bool
+ Installable *bool `android:"arch_variant"`
// Set by factories of module types that can only be referenced from variants compiled against
// the SDK.
@@ -1865,7 +1865,7 @@
}
func (c *Module) maybeInstall(ctx ModuleContext, apexInfo android.ApexInfo) {
- if !proptools.BoolDefault(c.Properties.Installable, true) {
+ if !proptools.BoolDefault(c.Installable(), true) {
// If the module has been specifically configure to not be installed then
// hide from make as otherwise it will break when running inside make
// as the output path to install will not be specified. Not all uninstallable
@@ -3260,6 +3260,11 @@
}
func (c *Module) Installable() *bool {
+ if c.library != nil {
+ if i := c.library.installable(); i != nil {
+ return i
+ }
+ }
return c.Properties.Installable
}
diff --git a/cc/fuzz.go b/cc/fuzz.go
index 40f16f3..e987fe4 100644
--- a/cc/fuzz.go
+++ b/cc/fuzz.go
@@ -123,7 +123,7 @@
}
// Discard installable:false libraries because they are expected to be absent
// in runtime.
- if !proptools.BoolDefault(ccLibrary.Properties.Installable, true) {
+ if !proptools.BoolDefault(ccLibrary.Installable(), true) {
return false
}
}
diff --git a/cc/library.go b/cc/library.go
index d63acfb..0559323 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -159,6 +159,8 @@
Export_static_lib_headers []string `android:"arch_variant"`
Apex_available []string `android:"arch_variant"`
+
+ Installable *bool `android:"arch_variant"`
}
type LibraryMutatedProperties struct {
@@ -1046,6 +1048,8 @@
availableFor(string) bool
getAPIListCoverageXMLPath() android.ModuleOutPath
+
+ installable() *bool
}
type versionedInterface interface {
@@ -1971,6 +1975,15 @@
return android.CheckAvailableForApex(what, list)
}
+func (library *libraryDecorator) installable() *bool {
+ if library.static() {
+ return library.StaticProperties.Static.Installable
+ } else if library.shared() {
+ return library.SharedProperties.Shared.Installable
+ }
+ return nil
+}
+
func (library *libraryDecorator) makeUninstallable(mod *Module) {
if library.static() && library.buildStatic() && !library.buildStubs() {
// If we're asked to make a static library uninstallable we don't do