Merge changes from topic "sbox_tools"

* changes:
  Sandbox genrule tools
  Call ctx.InstallFile for uninstallable cc modules
  Don't copy uninstallable variants of NDK libraries to sysroot
This commit is contained in:
Colin Cross
2020-12-17 22:01:06 +00:00
committed by Gerrit Code Review
19 changed files with 292 additions and 79 deletions

View File

@@ -273,7 +273,7 @@ func (library *libraryDecorator) AndroidMkEntries(ctx AndroidMkContext, entries
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() {

View File

@@ -432,6 +432,7 @@ type ModuleContextIntf interface {
mustUseVendorVariant() bool
nativeCoverage() bool
directlyInAnyApex() bool
isPreventInstall() bool
}
type ModuleContext interface {
@@ -1325,6 +1326,10 @@ func (ctx *moduleContextImpl) directlyInAnyApex() bool {
return ctx.mod.DirectlyInAnyApex()
}
func (ctx *moduleContextImpl) isPreventInstall() bool {
return ctx.mod.Properties.PreventInstall
}
func newBaseModule(hod android.HostOrDeviceSupported, multilib android.Multilib) *Module {
return &Module{
hod: hod,
@@ -1575,18 +1580,24 @@ func (c *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
}
}
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()
}
}

View File

@@ -454,7 +454,7 @@ func (c *Module) SetImageVariation(ctx android.BaseModuleContext, variant string
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

View File

@@ -1336,7 +1336,7 @@ func (library *libraryDecorator) install(ctx ModuleContext, file android.Path) {
}
} 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)
@@ -1345,7 +1345,7 @@ func (library *libraryDecorator) install(ctx ModuleContext, file android.Path) {
if Bool(library.Properties.Static_ndk_lib) && library.static() &&
!ctx.useVndk() && !ctx.inRamdisk() && !ctx.inVendorRamdisk() && !ctx.inRecovery() && ctx.Device() &&
library.baseLinker.sanitize.isUnsanitizedVariant() &&
!library.buildStubs() && ctx.sdkVersion() == "" {
ctx.isForPlatform() && !ctx.isPreventInstall() {
installPath := getNdkSysrootBase(ctx).Join(
ctx, "usr/lib", config.NDKTriple(ctx.toolchain()), file.Base())

View File

@@ -131,7 +131,7 @@ func shouldCreateSourceAbiDumpForLibrary(ctx android.BaseModuleContext) bool {
// Module is shared library type.
// Don't check uninstallable modules.
if m.IsSkipInstall() {
if m.IsHideFromMake() {
return false
}

View File

@@ -836,7 +836,7 @@ func VendorSnapshotSourceMutator(ctx android.BottomUpMutatorContext) {
// 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()

View File

@@ -181,8 +181,8 @@ func isSnapshotAware(m *Module, inProprietaryPath bool, apexInfo android.ApexInf
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)

View File

@@ -130,7 +130,7 @@ func (p *vndkPrebuiltLibraryDecorator) link(ctx ModuleContext,
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 @@ func (p *vndkPrebuiltLibraryDecorator) link(ctx ModuleContext,
return in
}
ctx.Module().SkipInstall()
ctx.Module().HideFromMake()
return nil
}