Disable installation for sdk snapshot versioned prebuilts
The sdk snapshot creates two prebuilts for each member one that is
versioned and one that is not. If they are both installed then they
lead to duplicate rules in make for creating the same installed file.
This change adds an installable property to cc modules that will
prevent the installation of the file and then adds installable: false
on the versioned prebuilt for cc modules.
Bug: 142935992
Test: m nothing
Change-Id: I4cb294c2b0c8a3f411eea569775835d9e41726d6
diff --git a/cc/cc.go b/cc/cc.go
index 8b3c772..4310a36 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -250,6 +250,8 @@
// Used by vendor snapshot to record dependencies from snapshot modules.
SnapshotSharedLibs []string `blueprint:"mutated"`
SnapshotRuntimeLibs []string `blueprint:"mutated"`
+
+ Installable *bool
}
type VendorProperties struct {
@@ -371,6 +373,7 @@
type installer interface {
installerProps() []interface{}
install(ctx ModuleContext, path android.Path)
+ everInstallable() bool
inData() bool
inSanitizerDir() bool
hostToolPath() android.OptionalPath
@@ -1488,6 +1491,13 @@
if ctx.Failed() {
return
}
+ } else if !proptools.BoolDefault(c.Properties.Installable, true) {
+ // If the module has been specifically configure to not be installed then
+ // skip the installation as otherwise it will break when running inside make
+ // as the output path to install will not be specified. Not all uninstallable
+ // modules can skip installation as some are needed for resolving make side
+ // dependencies.
+ c.SkipInstall()
}
}
@@ -2629,8 +2639,18 @@
}
}
+// Return true if the module is ever installable.
+func (c *Module) EverInstallable() bool {
+ return c.installer != nil &&
+ // Check to see whether the module is actually ever installable.
+ c.installer.everInstallable()
+}
+
func (c *Module) installable() bool {
- ret := c.installer != nil && !c.Properties.PreventInstall && c.outputFile.Valid()
+ ret := c.EverInstallable() &&
+ // Check to see whether the module has been configured to not be installed.
+ proptools.BoolDefault(c.Properties.Installable, true) &&
+ !c.Properties.PreventInstall && c.outputFile.Valid()
// The platform variant doesn't need further condition. Apex variants however might not
// be installable because it will likely to be included in the APEX and won't appear