Add installable property for prebuilt_apex

In case of shim apexes, we prebuilt all of them, but only need to
install v1 to a system partition.

Bug: 128677967
Test: manually checked that non-installable prebuilts don't end in /system
Change-Id: I112432abfd8f03cc7d7379ea3cab3f5491ace49c
This commit is contained in:
Nikita Ioffe 2019-04-04 13:42:00 +01:00
parent 56405f8071
commit dd53e8be18
1 changed files with 10 additions and 1 deletions

View File

@ -1317,6 +1317,12 @@ type PrebuiltProperties struct {
Src *string
}
}
Installable *bool
}
func (p *Prebuilt) installable() bool {
return p.properties.Installable == nil || proptools.Bool(p.properties.Installable)
}
func (p *Prebuilt) DepsMutator(ctx android.BottomUpMutatorContext) {
@ -1351,7 +1357,9 @@ func (p *Prebuilt) GenerateAndroidBuildActions(ctx android.ModuleContext) {
// TODO(jungjw): Check the key validity.
p.inputApex = p.Prebuilt().SingleSourcePath(ctx)
p.installDir = android.PathForModuleInstall(ctx, "apex")
ctx.InstallFile(p.installDir, ctx.ModuleName()+imageApexSuffix, p.inputApex)
if p.installable() {
ctx.InstallFile(p.installDir, ctx.ModuleName()+imageApexSuffix, p.inputApex)
}
}
func (p *Prebuilt) Prebuilt() *android.Prebuilt {
@ -1371,6 +1379,7 @@ func (p *Prebuilt) AndroidMk() android.AndroidMkData {
func(w io.Writer, outputFile android.Path) {
fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", filepath.Join("$(OUT_DIR)", p.installDir.RelPathString()))
fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", p.BaseModuleName()+imageApexSuffix)
fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE :=", !p.installable())
},
},
}