Don't use prebuilt_apex when TARGET_FLATTEN_APEX is set to true
When the device does not support non-flattened APEX (i.e. TARGET_FLATTEN_APEX is set to true), then ignore the prebuilt_apex modules even when `prefer: true`. Bug: 136251130 Bug: 136662772 Test: build marlin, and check if /system/apex has flattened APEXes Change-Id: I9f3dfefc3bd357d6750fbb1e418937d095720b04
This commit is contained in:
parent
43377eeb38
commit
0a573d798f
|
@ -178,3 +178,7 @@ func (p *Prebuilt) usePrebuilt(ctx TopDownMutatorContext, source Module) bool {
|
||||||
|
|
||||||
return source == nil || !source.Enabled()
|
return source == nil || !source.Enabled()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *Prebuilt) SourceExists() bool {
|
||||||
|
return p.properties.SourceExists
|
||||||
|
}
|
||||||
|
|
15
apex/apex.go
15
apex/apex.go
|
@ -1297,7 +1297,8 @@ type Prebuilt struct {
|
||||||
|
|
||||||
type PrebuiltProperties struct {
|
type PrebuiltProperties struct {
|
||||||
// the path to the prebuilt .apex file to import.
|
// the path to the prebuilt .apex file to import.
|
||||||
Source string `blueprint:"mutated"`
|
Source string `blueprint:"mutated"`
|
||||||
|
ForceDisable bool `blueprint:"mutated"`
|
||||||
|
|
||||||
Src *string
|
Src *string
|
||||||
Arch struct {
|
Arch struct {
|
||||||
|
@ -1326,6 +1327,14 @@ func (p *Prebuilt) installable() bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Prebuilt) DepsMutator(ctx android.BottomUpMutatorContext) {
|
func (p *Prebuilt) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||||
|
if ctx.Config().FlattenApex() && !ctx.Config().UnbundledBuild() && p.prebuilt.SourceExists() {
|
||||||
|
// If the device is configured to use flattened APEX, don't set
|
||||||
|
// p.properties.Source so that the prebuilt module (which is
|
||||||
|
// a non-flattened APEX) is not used.
|
||||||
|
p.properties.ForceDisable = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// This is called before prebuilt_select and prebuilt_postdeps mutators
|
// This is called before prebuilt_select and prebuilt_postdeps mutators
|
||||||
// The mutators requires that src to be set correctly for each arch so that
|
// The mutators requires that src to be set correctly for each arch so that
|
||||||
// arch variants are disabled when src is not provided for the arch.
|
// arch variants are disabled when src is not provided for the arch.
|
||||||
|
@ -1362,6 +1371,10 @@ func (p *Prebuilt) InstallFilename() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Prebuilt) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
func (p *Prebuilt) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
|
if p.properties.ForceDisable {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// TODO(jungjw): Check the key validity.
|
// TODO(jungjw): Check the key validity.
|
||||||
p.inputApex = p.Prebuilt().SingleSourcePath(ctx)
|
p.inputApex = p.Prebuilt().SingleSourcePath(ctx)
|
||||||
p.installDir = android.PathForModuleInstall(ctx, "apex")
|
p.installDir = android.PathForModuleInstall(ctx, "apex")
|
||||||
|
|
Loading…
Reference in New Issue