Merge "Export non-apex variants of modules to make"
This commit is contained in:
commit
bebe607db4
9 changed files with 49 additions and 42 deletions
|
@ -560,6 +560,8 @@ func (a *AndroidMkEntries) fillInEntries(ctx fillInEntriesContext, mod blueprint
|
||||||
a.SetPaths("LOCAL_SOONG_INSTALL_SYMLINKS", base.katiSymlinks.InstallPaths().Paths())
|
a.SetPaths("LOCAL_SOONG_INSTALL_SYMLINKS", base.katiSymlinks.InstallPaths().Paths())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", base.commonProperties.SkipInstall)
|
||||||
|
|
||||||
if am, ok := mod.(ApexModule); ok {
|
if am, ok := mod.(ApexModule); ok {
|
||||||
a.SetBoolIfTrue("LOCAL_NOT_AVAILABLE_FOR_PLATFORM", am.NotAvailableForPlatform())
|
a.SetBoolIfTrue("LOCAL_NOT_AVAILABLE_FOR_PLATFORM", am.NotAvailableForPlatform())
|
||||||
}
|
}
|
||||||
|
|
|
@ -603,7 +603,7 @@ func CreateApexVariations(mctx BottomUpMutatorContext, module ApexModule) []Modu
|
||||||
// Do not install the module for platform, but still allow it to output
|
// Do not install the module for platform, but still allow it to output
|
||||||
// uninstallable AndroidMk entries in certain cases when they have side
|
// uninstallable AndroidMk entries in certain cases when they have side
|
||||||
// effects. TODO(jiyong): move this routine to somewhere else
|
// effects. TODO(jiyong): move this routine to somewhere else
|
||||||
mod.MakeUninstallable()
|
mod.SkipInstall()
|
||||||
}
|
}
|
||||||
if !platformVariation {
|
if !platformVariation {
|
||||||
mctx.SetVariationProvider(mod, ApexInfoProvider, apexInfos[i-1])
|
mctx.SetVariationProvider(mod, ApexInfoProvider, apexInfos[i-1])
|
||||||
|
|
|
@ -505,8 +505,8 @@ type Module interface {
|
||||||
PartitionTag(DeviceConfig) string
|
PartitionTag(DeviceConfig) string
|
||||||
HideFromMake()
|
HideFromMake()
|
||||||
IsHideFromMake() bool
|
IsHideFromMake() bool
|
||||||
|
SkipInstall()
|
||||||
IsSkipInstall() bool
|
IsSkipInstall() bool
|
||||||
MakeUninstallable()
|
|
||||||
ReplacedByPrebuilt()
|
ReplacedByPrebuilt()
|
||||||
IsReplacedByPrebuilt() bool
|
IsReplacedByPrebuilt() bool
|
||||||
ExportedToMake() bool
|
ExportedToMake() bool
|
||||||
|
@ -1964,15 +1964,6 @@ func (m *ModuleBase) IsSkipInstall() bool {
|
||||||
return m.commonProperties.SkipInstall
|
return m.commonProperties.SkipInstall
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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.HideFromMake()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *ModuleBase) ReplacedByPrebuilt() {
|
func (m *ModuleBase) ReplacedByPrebuilt() {
|
||||||
m.commonProperties.ReplacedByPrebuilt = true
|
m.commonProperties.ReplacedByPrebuilt = true
|
||||||
m.HideFromMake()
|
m.HideFromMake()
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
package android
|
package android
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/google/blueprint"
|
"github.com/google/blueprint"
|
||||||
|
@ -28,6 +29,8 @@ type componentTestModule struct {
|
||||||
Deps []string
|
Deps []string
|
||||||
Skip_install *bool
|
Skip_install *bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
builtFile Path
|
||||||
}
|
}
|
||||||
|
|
||||||
// dep tag used in this test. All dependencies are considered as installable.
|
// dep tag used in this test. All dependencies are considered as installable.
|
||||||
|
@ -48,13 +51,21 @@ func (m *componentTestModule) DepsMutator(ctx BottomUpMutatorContext) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *componentTestModule) GenerateAndroidBuildActions(ctx ModuleContext) {
|
func (m *componentTestModule) GenerateAndroidBuildActions(ctx ModuleContext) {
|
||||||
builtFile := PathForModuleOut(ctx, m.Name())
|
m.builtFile = PathForModuleOut(ctx, m.Name())
|
||||||
dir := ctx.Target().Arch.ArchType.Multilib
|
dir := ctx.Target().Arch.ArchType.Multilib
|
||||||
installDir := PathForModuleInstall(ctx, dir)
|
installDir := PathForModuleInstall(ctx, dir)
|
||||||
if proptools.Bool(m.props.Skip_install) {
|
if proptools.Bool(m.props.Skip_install) {
|
||||||
m.SkipInstall()
|
m.SkipInstall()
|
||||||
}
|
}
|
||||||
ctx.InstallFile(installDir, m.Name(), builtFile)
|
ctx.InstallFile(installDir, m.Name(), m.builtFile)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *componentTestModule) AndroidMkEntries() []AndroidMkEntries {
|
||||||
|
return []AndroidMkEntries{
|
||||||
|
{
|
||||||
|
OutputFile: OptionalPathForPath(m.builtFile),
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Module that itself is a package
|
// Module that itself is a package
|
||||||
|
@ -251,6 +262,35 @@ func TestPackagingBaseMultiTarget(t *testing.T) {
|
||||||
`, []string{"lib32/foo", "lib64/foo", "lib64/bar"})
|
`, []string{"lib32/foo", "lib64/foo", "lib64/bar"})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestSkipInstallProducesLocalUninstallableModule(t *testing.T) {
|
||||||
|
result := GroupFixturePreparers(
|
||||||
|
PrepareForTestWithArchMutator,
|
||||||
|
FixtureRegisterWithContext(func(ctx RegistrationContext) {
|
||||||
|
ctx.RegisterModuleType("component", componentTestModuleFactory)
|
||||||
|
ctx.RegisterModuleType("package_module", packageTestModuleFactory)
|
||||||
|
}),
|
||||||
|
FixtureWithRootAndroidBp(`
|
||||||
|
component {
|
||||||
|
name: "foo",
|
||||||
|
skip_install: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
package_module {
|
||||||
|
name: "package",
|
||||||
|
deps: ["foo"],
|
||||||
|
}
|
||||||
|
`),
|
||||||
|
).RunTest(t)
|
||||||
|
module := result.ModuleForTests("foo", "android_arm64_armv8-a").Module().(*componentTestModule)
|
||||||
|
entries := AndroidMkEntriesForTest(t, result.TestContext, module)
|
||||||
|
builder := &strings.Builder{}
|
||||||
|
entries[0].write(builder)
|
||||||
|
androidMkString := builder.String()
|
||||||
|
if !strings.Contains(androidMkString, "LOCAL_UNINSTALLABLE_MODULE := true") {
|
||||||
|
t.Errorf("Expected android mk entries to contain \"LOCAL_UNINSTALLABLE_MODULE := true\", got: \n%s", androidMkString)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestPackagingBaseSingleTarget(t *testing.T) {
|
func TestPackagingBaseSingleTarget(t *testing.T) {
|
||||||
multiTarget := false
|
multiTarget := false
|
||||||
runPackagingTest(t, multiTarget,
|
runPackagingTest(t, multiTarget,
|
||||||
|
|
9
cc/cc.go
9
cc/cc.go
|
@ -609,7 +609,6 @@ type installer interface {
|
||||||
inSanitizerDir() bool
|
inSanitizerDir() bool
|
||||||
hostToolPath() android.OptionalPath
|
hostToolPath() android.OptionalPath
|
||||||
relativeInstallPath() string
|
relativeInstallPath() string
|
||||||
makeUninstallable(mod *Module)
|
|
||||||
installInRoot() bool
|
installInRoot() bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3525,14 +3524,6 @@ func (c *Module) InstallInRecovery() bool {
|
||||||
return c.InRecovery()
|
return c.InRecovery()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Module) MakeUninstallable() {
|
|
||||||
if c.installer == nil {
|
|
||||||
c.ModuleBase.MakeUninstallable()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
c.installer.makeUninstallable(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Module) HostToolPath() android.OptionalPath {
|
func (c *Module) HostToolPath() android.OptionalPath {
|
||||||
if c.installer == nil {
|
if c.installer == nil {
|
||||||
return android.OptionalPath{}
|
return android.OptionalPath{}
|
||||||
|
|
|
@ -121,10 +121,6 @@ func (installer *baseInstaller) relativeInstallPath() string {
|
||||||
return String(installer.Properties.Relative_install_path)
|
return String(installer.Properties.Relative_install_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (installer *baseInstaller) makeUninstallable(mod *Module) {
|
|
||||||
mod.ModuleBase.MakeUninstallable()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (installer *baseInstaller) installInRoot() bool {
|
func (installer *baseInstaller) installInRoot() bool {
|
||||||
return Bool(installer.Properties.Install_in_root)
|
return Bool(installer.Properties.Install_in_root)
|
||||||
}
|
}
|
||||||
|
|
|
@ -2439,17 +2439,6 @@ func (library *libraryDecorator) installable() *bool {
|
||||||
return nil
|
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
|
|
||||||
// anything since AndroidMkEntries always sets LOCAL_UNINSTALLABLE_MODULE
|
|
||||||
// for these entries. This is done to still get the make targets for NOTICE
|
|
||||||
// files from notice_files.mk, which other libraries might depend on.
|
|
||||||
return
|
|
||||||
}
|
|
||||||
mod.ModuleBase.MakeUninstallable()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (library *libraryDecorator) getPartition() string {
|
func (library *libraryDecorator) getPartition() string {
|
||||||
return library.path.Partition()
|
return library.path.Partition()
|
||||||
}
|
}
|
||||||
|
|
|
@ -214,7 +214,7 @@ func (p *prebuiltLibraryLinker) link(ctx ModuleContext,
|
||||||
// without the prefix hack below.
|
// without the prefix hack below.
|
||||||
if p.hasStubsVariants() && !p.buildStubs() && !ctx.Host() &&
|
if p.hasStubsVariants() && !p.buildStubs() && !ctx.Host() &&
|
||||||
!strings.HasPrefix(ctx.baseModuleName(), "libclang_rt.") {
|
!strings.HasPrefix(ctx.baseModuleName(), "libclang_rt.") {
|
||||||
ctx.Module().MakeUninstallable()
|
ctx.Module().SkipInstall()
|
||||||
}
|
}
|
||||||
|
|
||||||
return outputFile
|
return outputFile
|
||||||
|
|
|
@ -76,9 +76,6 @@ func (library *Library) AndroidMkEntries() []android.AndroidMkEntries {
|
||||||
entriesList = append(entriesList, dexpreoptEntries...)
|
entriesList = append(entriesList, dexpreoptEntries...)
|
||||||
}
|
}
|
||||||
entriesList = append(entriesList, android.AndroidMkEntries{Disabled: true})
|
entriesList = append(entriesList, android.AndroidMkEntries{Disabled: true})
|
||||||
} else if !library.ApexModuleBase.AvailableFor(android.AvailableToPlatform) {
|
|
||||||
// Platform variant. If not available for the platform, we don't need Make module.
|
|
||||||
entriesList = append(entriesList, android.AndroidMkEntries{Disabled: true})
|
|
||||||
} else {
|
} else {
|
||||||
entriesList = append(entriesList, android.AndroidMkEntries{
|
entriesList = append(entriesList, android.AndroidMkEntries{
|
||||||
Class: "JAVA_LIBRARIES",
|
Class: "JAVA_LIBRARIES",
|
||||||
|
@ -94,7 +91,8 @@ func (library *Library) AndroidMkEntries() []android.AndroidMkEntries {
|
||||||
entries.AddStrings("LOCAL_LOGTAGS_FILES", logtags...)
|
entries.AddStrings("LOCAL_LOGTAGS_FILES", logtags...)
|
||||||
}
|
}
|
||||||
|
|
||||||
if library.installFile == nil {
|
if library.installFile == nil || !library.ApexModuleBase.AvailableFor(android.AvailableToPlatform) {
|
||||||
|
// If the ApexModule is not available for the platform, it shouldn't be installed.
|
||||||
entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", true)
|
entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", true)
|
||||||
}
|
}
|
||||||
if library.dexJarFile.IsSet() {
|
if library.dexJarFile.IsSet() {
|
||||||
|
|
Loading…
Reference in a new issue