Merge "Only output make targets for uninstallable static libs in the APEX unavailable-to-platform case." am: 9f381d5ce3
am: 0be556121d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1393187 Change-Id: Ie961e81a936ff5cd2e60af10bf2c9168334e9789
This commit is contained in:
@@ -296,7 +296,10 @@ func (m *ApexModuleBase) CreateApexVariations(mctx BottomUpMutatorContext) []Mod
|
|||||||
for i, mod := range modules {
|
for i, mod := range modules {
|
||||||
platformVariation := i == 0
|
platformVariation := i == 0
|
||||||
if platformVariation && !mctx.Host() && !mod.(ApexModule).AvailableFor(AvailableToPlatform) {
|
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 {
|
if !platformVariation {
|
||||||
mod.(ApexModule).apexModuleBase().ApexProperties.Info = m.apexVariations[i-1]
|
mod.(ApexModule).apexModuleBase().ApexProperties.Info = m.apexVariations[i-1]
|
||||||
|
@@ -257,6 +257,7 @@ type Module interface {
|
|||||||
InstallForceOS() *OsType
|
InstallForceOS() *OsType
|
||||||
SkipInstall()
|
SkipInstall()
|
||||||
IsSkipInstall() bool
|
IsSkipInstall() bool
|
||||||
|
MakeUninstallable()
|
||||||
ExportedToMake() bool
|
ExportedToMake() bool
|
||||||
InitRc() Paths
|
InitRc() Paths
|
||||||
VintfFragments() Paths
|
VintfFragments() Paths
|
||||||
@@ -1047,6 +1048,15 @@ func (m *ModuleBase) IsSkipInstall() bool {
|
|||||||
return m.commonProperties.SkipInstall == true
|
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 {
|
func (m *ModuleBase) ExportedToMake() bool {
|
||||||
return m.commonProperties.NamespaceExportedToMake
|
return m.commonProperties.NamespaceExportedToMake
|
||||||
}
|
}
|
||||||
|
@@ -286,10 +286,8 @@ func (library *libraryDecorator) AndroidMkEntries(ctx AndroidMkContext, entries
|
|||||||
entries.SubName = "." + library.stubsVersion()
|
entries.SubName = "." + library.stubsVersion()
|
||||||
}
|
}
|
||||||
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) {
|
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) {
|
||||||
// Note library.skipInstall() has a special case to get here for static
|
// library.makeUninstallable() depends on this to bypass SkipInstall() for
|
||||||
// libraries that otherwise would have skipped installation and hence not
|
// static libraries.
|
||||||
// have executed AndroidMkEntries at all. The reason is to ensure they get
|
|
||||||
// a NOTICE file make target which other libraries might depend on.
|
|
||||||
entries.SetBool("LOCAL_UNINSTALLABLE_MODULE", true)
|
entries.SetBool("LOCAL_UNINSTALLABLE_MODULE", true)
|
||||||
if library.buildStubs() {
|
if library.buildStubs() {
|
||||||
entries.SetBool("LOCAL_NO_NOTICE_FILE", true)
|
entries.SetBool("LOCAL_NO_NOTICE_FILE", true)
|
||||||
|
8
cc/cc.go
8
cc/cc.go
@@ -418,7 +418,7 @@ type installer interface {
|
|||||||
inSanitizerDir() bool
|
inSanitizerDir() bool
|
||||||
hostToolPath() android.OptionalPath
|
hostToolPath() android.OptionalPath
|
||||||
relativeInstallPath() string
|
relativeInstallPath() string
|
||||||
skipInstall(mod *Module)
|
makeUninstallable(mod *Module)
|
||||||
}
|
}
|
||||||
|
|
||||||
type xref interface {
|
type xref interface {
|
||||||
@@ -2730,12 +2730,12 @@ func (c *Module) InstallInRecovery() bool {
|
|||||||
return c.InRecovery()
|
return c.InRecovery()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Module) SkipInstall() {
|
func (c *Module) MakeUninstallable() {
|
||||||
if c.installer == nil {
|
if c.installer == nil {
|
||||||
c.ModuleBase.SkipInstall()
|
c.ModuleBase.MakeUninstallable()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
c.installer.skipInstall(c)
|
c.installer.makeUninstallable(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Module) HostToolPath() android.OptionalPath {
|
func (c *Module) HostToolPath() android.OptionalPath {
|
||||||
|
@@ -107,6 +107,6 @@ func (installer *baseInstaller) relativeInstallPath() string {
|
|||||||
return String(installer.Properties.Relative_install_path)
|
return String(installer.Properties.Relative_install_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (installer *baseInstaller) skipInstall(mod *Module) {
|
func (installer *baseInstaller) makeUninstallable(mod *Module) {
|
||||||
mod.ModuleBase.SkipInstall()
|
mod.ModuleBase.MakeUninstallable()
|
||||||
}
|
}
|
||||||
|
@@ -1365,16 +1365,15 @@ func (library *libraryDecorator) availableFor(what string) bool {
|
|||||||
return android.CheckAvailableForApex(what, list)
|
return android.CheckAvailableForApex(what, list)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (library *libraryDecorator) skipInstall(mod *Module) {
|
func (library *libraryDecorator) makeUninstallable(mod *Module) {
|
||||||
if library.static() && library.buildStatic() && !library.buildStubs() {
|
if library.static() && library.buildStatic() && !library.buildStubs() {
|
||||||
// If we're asked to skip installation of a static library (in particular
|
// If we're asked to make a static library uninstallable we don't do
|
||||||
// when it's not //apex_available:platform) we still want an AndroidMk entry
|
// anything since AndroidMkEntries always sets LOCAL_UNINSTALLABLE_MODULE
|
||||||
// for it to ensure we get the relevant NOTICE file targets (cf.
|
// for these entries. This is done to still get the make targets for NOTICE
|
||||||
// notice_files.mk) that other libraries might depend on. AndroidMkEntries
|
// files from notice_files.mk, which other libraries might depend on.
|
||||||
// always sets LOCAL_UNINSTALLABLE_MODULE for these entries.
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
mod.ModuleBase.SkipInstall()
|
mod.ModuleBase.MakeUninstallable()
|
||||||
}
|
}
|
||||||
|
|
||||||
var versioningMacroNamesListKey = android.NewOnceKey("versioningMacroNamesList")
|
var versioningMacroNamesListKey = android.NewOnceKey("versioningMacroNamesList")
|
||||||
|
@@ -199,10 +199,6 @@ func (p *prebuiltLibraryLinker) disablePrebuilt() {
|
|||||||
p.properties.Srcs = nil
|
p.properties.Srcs = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *prebuiltLibraryLinker) skipInstall(mod *Module) {
|
|
||||||
mod.ModuleBase.SkipInstall()
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewPrebuiltLibrary(hod android.HostOrDeviceSupported) (*Module, *libraryDecorator) {
|
func NewPrebuiltLibrary(hod android.HostOrDeviceSupported) (*Module, *libraryDecorator) {
|
||||||
module, library := NewLibrary(hod)
|
module, library := NewLibrary(hod)
|
||||||
module.compiler = nil
|
module.compiler = nil
|
||||||
@@ -211,7 +207,6 @@ func NewPrebuiltLibrary(hod android.HostOrDeviceSupported) (*Module, *libraryDec
|
|||||||
libraryDecorator: library,
|
libraryDecorator: library,
|
||||||
}
|
}
|
||||||
module.linker = prebuilt
|
module.linker = prebuilt
|
||||||
module.installer = prebuilt
|
|
||||||
|
|
||||||
module.AddProperties(&prebuilt.properties)
|
module.AddProperties(&prebuilt.properties)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user