Add install_in_root to cc_binary

To support init_first_stage, install_in_root property is added to
cc_binary. The output is installed to {partition}, rather than
{partition}/{mount_point}/bin.

Bug: 187196593
Test: build init_first_stage
Change-Id: Ibc351645308676ed188f748972eb6312c9cbd64f
This commit is contained in:
Inseob Kim
2021-06-14 12:03:51 +09:00
parent 94b2e705d1
commit 800d114003
3 changed files with 28 additions and 0 deletions

View File

@@ -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)
}