Add install_in_root to cc_binary am: 800d114003
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1736433 Change-Id: If0fc578582e5cb43077251f37b6887f218708848
This commit is contained in:
@@ -55,6 +55,7 @@ func init() {
|
||||
AddNeverAllowRules(createCcSdkVariantRules()...)
|
||||
AddNeverAllowRules(createUncompressDexRules()...)
|
||||
AddNeverAllowRules(createMakefileGoalRules()...)
|
||||
AddNeverAllowRules(createInitFirstStageRules()...)
|
||||
}
|
||||
|
||||
// Add a NeverAllow rule to the set of rules to apply.
|
||||
@@ -216,6 +217,15 @@ func createMakefileGoalRules() []Rule {
|
||||
}
|
||||
}
|
||||
|
||||
func createInitFirstStageRules() []Rule {
|
||||
return []Rule{
|
||||
NeverAllow().
|
||||
Without("name", "init_first_stage").
|
||||
With("install_in_root", "true").
|
||||
Because("install_in_root is only for init_first_stage."),
|
||||
}
|
||||
}
|
||||
|
||||
func neverallowMutator(ctx BottomUpMutatorContext) {
|
||||
m, ok := ctx.Module().(Module)
|
||||
if !ok {
|
||||
|
5
cc/cc.go
5
cc/cc.go
@@ -585,6 +585,7 @@ type installer interface {
|
||||
hostToolPath() android.OptionalPath
|
||||
relativeInstallPath() string
|
||||
makeUninstallable(mod *Module)
|
||||
installInRoot() bool
|
||||
}
|
||||
|
||||
// bazelHandler is the interface for a helper object related to deferring to Bazel for
|
||||
@@ -1309,6 +1310,10 @@ func (c *Module) isCfiAssemblySupportEnabled() bool {
|
||||
Bool(c.sanitize.Properties.Sanitize.Config.Cfi_assembly_support)
|
||||
}
|
||||
|
||||
func (c *Module) InstallInRoot() bool {
|
||||
return c.installer != nil && c.installer.installInRoot()
|
||||
}
|
||||
|
||||
type baseModuleContext struct {
|
||||
android.BaseModuleContext
|
||||
moduleContextImpl
|
||||
|
@@ -25,6 +25,10 @@ import (
|
||||
type InstallerProperties struct {
|
||||
// install to a subdirectory of the default install path for the module
|
||||
Relative_install_path *string `android:"arch_variant"`
|
||||
|
||||
// Install output directly in {partition}/, not in any subdir. This is only intended for use by
|
||||
// init_first_stage.
|
||||
Install_in_root *bool `android:"arch_variant"`
|
||||
}
|
||||
|
||||
type installLocation int
|
||||
@@ -66,6 +70,11 @@ func (installer *baseInstaller) installDir(ctx ModuleContext) android.InstallPat
|
||||
if ctx.toolchain().Is64Bit() && installer.dir64 != "" {
|
||||
dir = installer.dir64
|
||||
}
|
||||
|
||||
if installer.installInRoot() {
|
||||
dir = ""
|
||||
}
|
||||
|
||||
if ctx.Target().NativeBridge == android.NativeBridgeEnabled {
|
||||
dir = filepath.Join(dir, ctx.Target().NativeBridgeRelativePath)
|
||||
} else if !ctx.Host() && ctx.Config().HasMultilibConflict(ctx.Arch().ArchType) {
|
||||
@@ -110,3 +119,7 @@ func (installer *baseInstaller) relativeInstallPath() string {
|
||||
func (installer *baseInstaller) makeUninstallable(mod *Module) {
|
||||
mod.ModuleBase.MakeUninstallable()
|
||||
}
|
||||
|
||||
func (installer *baseInstaller) installInRoot() bool {
|
||||
return Bool(installer.Properties.Install_in_root)
|
||||
}
|
||||
|
Reference in New Issue
Block a user