Merge "Use no_full_install: true instead of installable: false" into main am: baaa1b1eeb

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3069502

Change-Id: I4ae32cc61dabd1359d493f52d3200f4f07ce917b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot
2024-05-03 15:32:34 +00:00
committed by Automerger Merge Worker
3 changed files with 29 additions and 3 deletions

View File

@@ -36,6 +36,7 @@ import (
"github.com/google/blueprint" "github.com/google/blueprint"
"github.com/google/blueprint/bootstrap" "github.com/google/blueprint/bootstrap"
"github.com/google/blueprint/pathtools" "github.com/google/blueprint/pathtools"
"github.com/google/blueprint/proptools"
) )
func init() { func init() {
@@ -541,6 +542,11 @@ func (a *AndroidMkEntries) fillInEntries(ctx fillInEntriesContext, mod blueprint
a.SetPath("LOCAL_SOONG_INSTALLED_MODULE", base.katiInstalls[len(base.katiInstalls)-1].to) a.SetPath("LOCAL_SOONG_INSTALLED_MODULE", base.katiInstalls[len(base.katiInstalls)-1].to)
a.SetString("LOCAL_SOONG_INSTALL_PAIRS", base.katiInstalls.BuiltInstalled()) a.SetString("LOCAL_SOONG_INSTALL_PAIRS", base.katiInstalls.BuiltInstalled())
a.SetPaths("LOCAL_SOONG_INSTALL_SYMLINKS", base.katiSymlinks.InstallPaths().Paths()) a.SetPaths("LOCAL_SOONG_INSTALL_SYMLINKS", base.katiSymlinks.InstallPaths().Paths())
} else {
// Soong may not have generated the install rule also when `no_full_install: true`.
// Mark this module as uninstallable in order to prevent Make from creating an
// install rule there.
a.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", proptools.Bool(base.commonProperties.No_full_install))
} }
if len(base.testData) > 0 { if len(base.testData) > 0 {

View File

@@ -484,6 +484,11 @@ type commonProperties struct {
// Set by osMutator. // Set by osMutator.
CommonOSVariant bool `blueprint:"mutated"` CommonOSVariant bool `blueprint:"mutated"`
// When set to true, this module is not installed to the full install path (ex: under
// out/target/product/<name>/<partition>). It can be installed only to the packaging
// modules like android_filesystem.
No_full_install *bool
// When HideFromMake is set to true, no entry for this variant will be emitted in the // When HideFromMake is set to true, no entry for this variant will be emitted in the
// generated Android.mk file. // generated Android.mk file.
HideFromMake bool `blueprint:"mutated"` HideFromMake bool `blueprint:"mutated"`

View File

@@ -444,6 +444,21 @@ func (m *moduleContext) skipInstall() bool {
return false return false
} }
// Tells whether this module is installed to the full install path (ex:
// out/target/product/<name>/<partition>) or not. If this returns false, the install build rule is
// not created and this module can only be installed to packaging modules like android_filesystem.
func (m *moduleContext) requiresFullInstall() bool {
if m.skipInstall() {
return false
}
if proptools.Bool(m.module.base().commonProperties.No_full_install) {
return false
}
return true
}
func (m *moduleContext) InstallFile(installPath InstallPath, name string, srcPath Path, func (m *moduleContext) InstallFile(installPath InstallPath, name string, srcPath Path,
deps ...InstallPath) InstallPath { deps ...InstallPath) InstallPath {
return m.installFile(installPath, name, srcPath, deps, false, true, nil) return m.installFile(installPath, name, srcPath, deps, false, true, nil)
@@ -490,7 +505,7 @@ func (m *moduleContext) installFile(installPath InstallPath, name string, srcPat
m.module.base().hooks.runInstallHooks(m, srcPath, fullInstallPath, false) m.module.base().hooks.runInstallHooks(m, srcPath, fullInstallPath, false)
} }
if !m.skipInstall() { if m.requiresFullInstall() {
deps = append(deps, InstallPaths(m.module.base().installFilesDepSet.ToList())...) deps = append(deps, InstallPaths(m.module.base().installFilesDepSet.ToList())...)
deps = append(deps, m.module.base().installedInitRcPaths...) deps = append(deps, m.module.base().installedInitRcPaths...)
deps = append(deps, m.module.base().installedVintfFragmentsPaths...) deps = append(deps, m.module.base().installedVintfFragmentsPaths...)
@@ -563,7 +578,7 @@ func (m *moduleContext) InstallSymlink(installPath InstallPath, name string, src
if err != nil { if err != nil {
panic(fmt.Sprintf("Unable to generate symlink between %q and %q: %s", fullInstallPath.Base(), srcPath.Base(), err)) panic(fmt.Sprintf("Unable to generate symlink between %q and %q: %s", fullInstallPath.Base(), srcPath.Base(), err))
} }
if !m.skipInstall() { if m.requiresFullInstall() {
if m.Config().KatiEnabled() { if m.Config().KatiEnabled() {
// When creating the symlink rule in Soong but embedding in Make, write the rule to a // When creating the symlink rule in Soong but embedding in Make, write the rule to a
@@ -612,7 +627,7 @@ func (m *moduleContext) InstallAbsoluteSymlink(installPath InstallPath, name str
fullInstallPath := installPath.Join(m, name) fullInstallPath := installPath.Join(m, name)
m.module.base().hooks.runInstallHooks(m, nil, fullInstallPath, true) m.module.base().hooks.runInstallHooks(m, nil, fullInstallPath, true)
if !m.skipInstall() { if m.requiresFullInstall() {
if m.Config().KatiEnabled() { if m.Config().KatiEnabled() {
// When creating the symlink rule in Soong but embedding in Make, write the rule to a // When creating the symlink rule in Soong but embedding in Make, write the rule to a
// makefile instead of directly to the ninja file so that main.mk can add the // makefile instead of directly to the ninja file so that main.mk can add the