rust modules in APEX don't get installed to the system partition

Otherwise, we get duplicated build rules.

Bug: N/A
Test: OUT_DIR=out DIST_DIR=out/dist
build/soong/scripts/build-ndk-prebuilts.sh

Change-Id: I2be0695d284bd72a19e02c8b7509a7f39afade8b
This commit is contained in:
Jiyong Park 2020-12-15 11:02:21 +09:00
parent f1c48afc31
commit 459feca5cc
1 changed files with 13 additions and 1 deletions

View File

@ -474,6 +474,16 @@ func (mod *Module) CoverageFiles() android.Paths {
panic(fmt.Errorf("CoverageFiles called on non-library module: %q", mod.BaseModuleName()))
}
func (mod *Module) installable(apexInfo android.ApexInfo) bool {
// The apex variant is not installable because it is included in the APEX and won't appear
// in the system partition as a standalone file.
if !apexInfo.IsForPlatform() {
return false
}
return mod.outputFile.Valid() && !mod.Properties.PreventInstall
}
var _ cc.LinkableInterface = (*Module)(nil)
func (mod *Module) Init() android.Module {
@ -645,7 +655,9 @@ func (mod *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
outputFile := mod.compiler.compile(ctx, flags, deps)
mod.outputFile = android.OptionalPathForPath(outputFile)
if mod.outputFile.Valid() && !mod.Properties.PreventInstall {
apexInfo := actx.Provider(android.ApexInfoProvider).(android.ApexInfo)
if mod.installable(apexInfo) {
mod.compiler.install(ctx)
}
}