Installation routine for rust is similar to that of cc
This change makes the installation routine for rust be similar to that of cc. Previously, rust.baseCompiler.install() (which internally calls android.ModuleContext.InstallFile()) was not called when the module is not installable. Although this may sound right at first glance, it is a behavior different from that of cc and prevents an uninstallable rust module from being packaged into a packaging module like android_filesystem. This is because the packaging happens inside InstallFile(). Fixing the issue by following the behavior of cc modules; Call HideFromMake() or SkipInstall() when a rust module is not installable, but call InstallFile() as long as the output file is valid. InstallFile() internally skips the installation (but the packaging) when HideFromMake() or SkipInstall() was called. Bug: N/A Test: atest MicrodroidHostTestCases Change-Id: I15f4adc8544dac53647647d8bc4273f9f4acbeb2
This commit is contained in:
parent
0b58fdb058
commit
d1e366a072
1 changed files with 23 additions and 10 deletions
33
rust/rust.go
33
rust/rust.go
|
@ -130,9 +130,10 @@ type BaseProperties struct {
|
|||
// Minimum sdk version that the artifact should support when it runs as part of mainline modules(APEX).
|
||||
Min_sdk_version *string
|
||||
|
||||
PreventInstall bool
|
||||
HideFromMake bool
|
||||
Installable *bool
|
||||
HideFromMake bool `blueprint:"mutated"`
|
||||
PreventInstall bool `blueprint:"mutated"`
|
||||
|
||||
Installable *bool
|
||||
}
|
||||
|
||||
type Module struct {
|
||||
|
@ -177,8 +178,8 @@ func (mod *Module) SetHideFromMake() {
|
|||
mod.Properties.HideFromMake = true
|
||||
}
|
||||
|
||||
func (c *Module) HiddenFromMake() bool {
|
||||
return c.Properties.HideFromMake
|
||||
func (mod *Module) HiddenFromMake() bool {
|
||||
return mod.Properties.HideFromMake
|
||||
}
|
||||
|
||||
func (mod *Module) SanitizePropDefined() bool {
|
||||
|
@ -526,10 +527,6 @@ func (mod *Module) PreventInstall() bool {
|
|||
return mod.Properties.PreventInstall
|
||||
}
|
||||
|
||||
func (mod *Module) HideFromMake() {
|
||||
mod.Properties.HideFromMake = true
|
||||
}
|
||||
|
||||
func (mod *Module) MarkAsCoverageVariant(coverage bool) {
|
||||
mod.coverage.Properties.IsCoverageVariant = coverage
|
||||
}
|
||||
|
@ -898,8 +895,24 @@ func (mod *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
|
|||
}
|
||||
|
||||
apexInfo := actx.Provider(android.ApexInfoProvider).(android.ApexInfo)
|
||||
if mod.installable(apexInfo) {
|
||||
if !proptools.BoolDefault(mod.Installable(), mod.EverInstallable()) {
|
||||
// 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.
|
||||
mod.HideFromMake()
|
||||
} else if !mod.installable(apexInfo) {
|
||||
mod.SkipInstall()
|
||||
}
|
||||
|
||||
// Still call install though, the installs will be stored as PackageSpecs to allow
|
||||
// using the outputs in a genrule.
|
||||
if mod.OutputFile().Valid() {
|
||||
mod.compiler.install(ctx)
|
||||
if ctx.Failed() {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
ctx.Phony("rust", ctx.RustModule().OutputFile().Path())
|
||||
|
|
Loading…
Reference in a new issue