Call ctx.InstallFile for uninstallable cc modules
SkipInstall is actually primarily used to prevent making a module
visible to Make, rename it and add new SkipInstall that actually
skips installation without affecting Make.
Call c.SkipInstall() for uninstallable cc modules to allow calling
c.installer.install, which will collect PackagingSpecs for
uninstallable cc modules, allowing them to be used by genrules.
Bug: 124313442
Test: m checkbuild
Change-Id: I8038ed5c6f05c989ac21ec06c4552fb3136b9a7a
diff --git a/android/androidmk.go b/android/androidmk.go
index b32048a..062dcb3 100644
--- a/android/androidmk.go
+++ b/android/androidmk.go
@@ -820,7 +820,7 @@
}
return !module.Enabled() ||
- module.commonProperties.SkipInstall ||
+ module.commonProperties.HideFromMake ||
// Make does not understand LinuxBionic
module.Os() == LinuxBionic
}
diff --git a/android/module.go b/android/module.go
index 429f311..83f5494 100644
--- a/android/module.go
+++ b/android/module.go
@@ -452,8 +452,8 @@
InstallInRoot() bool
InstallBypassMake() bool
InstallForceOS() (*OsType, *ArchType)
- SkipInstall()
- IsSkipInstall() bool
+ HideFromMake()
+ IsHideFromMake() bool
MakeUninstallable()
ReplacedByPrebuilt()
IsReplacedByPrebuilt() bool
@@ -751,6 +751,13 @@
// Set by osMutator.
CommonOSVariant bool `blueprint:"mutated"`
+ // When HideFromMake is set to true, no entry for this variant will be emitted in the
+ // generated Android.mk file.
+ HideFromMake bool `blueprint:"mutated"`
+
+ // When SkipInstall is set to true, calls to ctx.InstallFile, ctx.InstallExecutable,
+ // ctx.InstallSymlink and ctx.InstallAbsoluteSymlink act like calls to ctx.PackageFile
+ // and don't create a rule to install the file.
SkipInstall bool `blueprint:"mutated"`
// Whether the module has been replaced by a prebuilt
@@ -1355,26 +1362,33 @@
m.commonProperties.ForcedDisabled = true
}
+// HideFromMake marks this variant so that it is not emitted in the generated Android.mk file.
+func (m *ModuleBase) HideFromMake() {
+ m.commonProperties.HideFromMake = true
+}
+
+// IsHideFromMake returns true if HideFromMake was previously called.
+func (m *ModuleBase) IsHideFromMake() bool {
+ return m.commonProperties.HideFromMake == true
+}
+
+// SkipInstall marks this variant to not create install rules when ctx.Install* are called.
func (m *ModuleBase) SkipInstall() {
m.commonProperties.SkipInstall = true
}
-func (m *ModuleBase) IsSkipInstall() bool {
- return m.commonProperties.SkipInstall == true
-}
-
-// Similar to SkipInstall, but if the AndroidMk entry would set
+// Similar to HideFromMake, 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()
+ m.HideFromMake()
}
func (m *ModuleBase) ReplacedByPrebuilt() {
m.commonProperties.ReplacedByPrebuilt = true
- m.SkipInstall()
+ m.HideFromMake()
}
func (m *ModuleBase) IsReplacedByPrebuilt() bool {
@@ -2440,11 +2454,15 @@
return m.module.InstallForceOS()
}
-func (m *moduleContext) skipInstall(fullInstallPath InstallPath) bool {
+func (m *moduleContext) skipInstall() bool {
if m.module.base().commonProperties.SkipInstall {
return true
}
+ if m.module.base().commonProperties.HideFromMake {
+ return true
+ }
+
// We'll need a solution for choosing which of modules with the same name in different
// namespaces to install. For now, reuse the list of namespaces exported to Make as the
// list of namespaces to install in a Soong-only build.
@@ -2492,7 +2510,7 @@
fullInstallPath := installPath.Join(m, name)
m.module.base().hooks.runInstallHooks(m, srcPath, fullInstallPath, false)
- if !m.skipInstall(fullInstallPath) {
+ if !m.skipInstall() {
deps = append(deps, m.module.base().installFilesDepSet.ToList().Paths()...)
var implicitDeps, orderOnlyDeps Paths
@@ -2526,6 +2544,7 @@
m.packageFile(fullInstallPath, srcPath, executable)
m.checkbuildFiles = append(m.checkbuildFiles, srcPath)
+
return fullInstallPath
}
@@ -2537,7 +2556,7 @@
if err != nil {
panic(fmt.Sprintf("Unable to generate symlink between %q and %q: %s", fullInstallPath.Base(), srcPath.Base(), err))
}
- if !m.skipInstall(fullInstallPath) {
+ if !m.skipInstall() {
m.Build(pctx, BuildParams{
Rule: Symlink,
@@ -2570,7 +2589,7 @@
fullInstallPath := installPath.Join(m, name)
m.module.base().hooks.runInstallHooks(m, nil, fullInstallPath, true)
- if !m.skipInstall(fullInstallPath) {
+ if !m.skipInstall() {
m.Build(pctx, BuildParams{
Rule: Symlink,
Description: "install symlink " + fullInstallPath.Base() + " -> " + absPath,
diff --git a/android/override_module.go b/android/override_module.go
index f8342d5..fa08566 100644
--- a/android/override_module.go
+++ b/android/override_module.go
@@ -235,7 +235,7 @@
return
}
// See if there's a prebuilt module that overrides this override module with prefer flag,
- // in which case we call SkipInstall on the corresponding variant later.
+ // in which case we call HideFromMake on the corresponding variant later.
ctx.VisitDirectDepsWithTag(PrebuiltDepTag, func(dep Module) {
prebuilt, ok := dep.(PrebuiltInterface)
if !ok {
@@ -284,7 +284,7 @@
mods[i+1].(OverridableModule).override(ctx, o)
if o.getOverriddenByPrebuilt() {
// The overriding module itself, too, is overridden by a prebuilt. Skip its installation.
- mods[i+1].SkipInstall()
+ mods[i+1].HideFromMake()
}
}
} else if o, ok := ctx.Module().(OverrideModule); ok {
diff --git a/android/prebuilt.go b/android/prebuilt.go
index 8114a65..39d30c5 100644
--- a/android/prebuilt.go
+++ b/android/prebuilt.go
@@ -289,7 +289,7 @@
})
}
} else {
- m.SkipInstall()
+ m.HideFromMake()
}
}
}
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 69b1dbb..4a6aecf 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -6578,7 +6578,7 @@
continue
}
mod := ctx.ModuleForTests(modName, variant).Module().(*cc.Module)
- if !mod.Enabled() || mod.IsSkipInstall() {
+ if !mod.Enabled() || mod.IsHideFromMake() {
continue
}
for _, ent := range android.AndroidMkEntriesForTest(t, config, "", mod) {
diff --git a/apex/prebuilt.go b/apex/prebuilt.go
index ce16d73..7931e9e 100644
--- a/apex/prebuilt.go
+++ b/apex/prebuilt.go
@@ -218,7 +218,7 @@
})
if p.prebuiltCommon.checkForceDisable(ctx) {
- p.SkipInstall()
+ p.HideFromMake()
return
}
@@ -392,7 +392,7 @@
})
if a.prebuiltCommon.checkForceDisable(ctx) {
- a.SkipInstall()
+ a.HideFromMake()
return
}
diff --git a/cc/androidmk.go b/cc/androidmk.go
index 187a2ff..ddacb70 100644
--- a/cc/androidmk.go
+++ b/cc/androidmk.go
@@ -273,7 +273,7 @@
entries.SubName = "." + library.stubsVersion()
}
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) {
- // library.makeUninstallable() depends on this to bypass SkipInstall() for
+ // library.makeUninstallable() depends on this to bypass HideFromMake() for
// static libraries.
entries.SetBool("LOCAL_UNINSTALLABLE_MODULE", true)
if library.buildStubs() {
diff --git a/cc/cc.go b/cc/cc.go
index afc96ba..9f90332 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -1580,18 +1580,24 @@
}
}
- if c.installable(apexInfo) {
+ if !proptools.BoolDefault(c.Properties.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
+ // modules can be hidden from make as some are needed for resolving make side
+ // dependencies.
+ c.HideFromMake()
+ } else if !c.installable(apexInfo) {
+ c.SkipInstall()
+ }
+
+ // Still call c.installer.install though, the installs will be stored as PackageSpecs
+ // to allow using the outputs in a genrule.
+ if c.installer != nil && c.outputFile.Valid() {
c.installer.install(ctx, c.outputFile.Path())
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()
}
}
diff --git a/cc/image.go b/cc/image.go
index 32325b9..cca454a 100644
--- a/cc/image.go
+++ b/cc/image.go
@@ -454,7 +454,7 @@
vndkVersion := ctx.DeviceConfig().VndkVersion()
if vndkVersion != "current" && vndkVersion != "" && vndkVersion != m.Properties.VndkVersion {
m.Properties.HideFromMake = true
- m.SkipInstall()
+ m.HideFromMake()
}
} else if strings.HasPrefix(variant, ProductVariationPrefix) {
m.Properties.ImageVariationPrefix = ProductVariationPrefix
diff --git a/cc/library.go b/cc/library.go
index 73ff754..11ee7dd 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -1336,7 +1336,7 @@
}
} else if ctx.directlyInAnyApex() && ctx.isLlndk(ctx.Config()) && !isBionic(ctx.baseModuleName()) {
// Skip installing LLNDK (non-bionic) libraries moved to APEX.
- ctx.Module().SkipInstall()
+ ctx.Module().HideFromMake()
}
library.baseInstaller.install(ctx, file)
diff --git a/cc/sabi.go b/cc/sabi.go
index 99e718e..c357f8d 100644
--- a/cc/sabi.go
+++ b/cc/sabi.go
@@ -131,7 +131,7 @@
// Module is shared library type.
// Don't check uninstallable modules.
- if m.IsSkipInstall() {
+ if m.IsHideFromMake() {
return false
}
diff --git a/cc/snapshot_prebuilt.go b/cc/snapshot_prebuilt.go
index b291bd0..f5f8121 100644
--- a/cc/snapshot_prebuilt.go
+++ b/cc/snapshot_prebuilt.go
@@ -836,7 +836,7 @@
// Disables source modules if corresponding snapshot exists.
if lib, ok := module.linker.(libraryInterface); ok && lib.buildStatic() && lib.buildShared() {
// But do not disable because the shared variant depends on the static variant.
- module.SkipInstall()
+ module.HideFromMake()
module.Properties.HideFromMake = true
} else {
module.Disable()
diff --git a/cc/vendor_snapshot.go b/cc/vendor_snapshot.go
index da37d0f..bca76dc 100644
--- a/cc/vendor_snapshot.go
+++ b/cc/vendor_snapshot.go
@@ -181,8 +181,8 @@
return false
}
// When android/prebuilt.go selects between source and prebuilt, it sets
- // SkipInstall on the other one to avoid duplicate install rules in make.
- if m.IsSkipInstall() {
+ // HideFromMake on the other one to avoid duplicate install rules in make.
+ if m.IsHideFromMake() {
return false
}
// skip proprietary modules, but (for the vendor snapshot only)
diff --git a/cc/vndk_prebuilt.go b/cc/vndk_prebuilt.go
index e6e2ad8..04162cd 100644
--- a/cc/vndk_prebuilt.go
+++ b/cc/vndk_prebuilt.go
@@ -130,7 +130,7 @@
flags Flags, deps PathDeps, objs Objects) android.Path {
if !p.matchesWithDevice(ctx.DeviceConfig()) {
- ctx.Module().SkipInstall()
+ ctx.Module().HideFromMake()
return nil
}
@@ -175,7 +175,7 @@
return in
}
- ctx.Module().SkipInstall()
+ ctx.Module().HideFromMake()
return nil
}
diff --git a/rust/image.go b/rust/image.go
index 4951d2b..af8c3b2 100644
--- a/rust/image.go
+++ b/rust/image.go
@@ -90,7 +90,7 @@
vndkVersion := ctx.DeviceConfig().VndkVersion()
if vndkVersion != "current" && vndkVersion != "" && vndkVersion != m.Properties.VndkVersion {
m.Properties.HideFromMake = true
- m.SkipInstall()
+ m.HideFromMake()
}
}
}