Handle missing apex_contributions

Some minimal branches have v/g_s/build/release (where apex_contibutions
have been set to mainline prebuilts), but not v/g/b (where the apex_contributions
for prebuilts have been defined). These minimal branches are unsuitable
for building a product that consume mainline prebuilts, but they would
still like to do aosp product builds.

aosp products should not use the mainline prebuilts anyways, but this
has been implemented as
- always create the dependency edge to the selected apex contributions
- do not visit the dependency edge subsequently if
  IgnoreApexContributions is set set to true

To support aosp product builds in minimal branches, this CL updates the
implementation to skip creating the dependency edge when
IgnoreApexContributions is set to true

Test: go test ./android
Change-Id: Iaa0971760e64f9b7a03542f179231ce2268b6616
This commit is contained in:
Spandan Das 2024-05-30 16:46:44 +00:00
parent 2f9af23734
commit a866713ddb

View file

@ -106,7 +106,13 @@ var (
// Creates a dep to each selected apex_contributions
func (a *allApexContributions) DepsMutator(ctx BottomUpMutatorContext) {
ctx.AddDependency(ctx.Module(), AcDepTag, ctx.Config().AllApexContributions()...)
// Skip apex_contributions if BuildApexContributionContents is true
// This product config var allows some products in the same family to use mainline modules from source
// (e.g. shiba and shiba_fullmte)
// Eventually these product variants will have their own release config maps.
if !proptools.Bool(ctx.Config().BuildIgnoreApexContributionContents()) {
ctx.AddDependency(ctx.Module(), AcDepTag, ctx.Config().AllApexContributions()...)
}
}
// Set PrebuiltSelectionInfoProvider in post deps phase
@ -126,19 +132,13 @@ func (a *allApexContributions) SetPrebuiltSelectionInfoProvider(ctx BaseModuleCo
}
p := PrebuiltSelectionInfoMap{}
// Skip apex_contributions if BuildApexContributionContents is true
// This product config var allows some products in the same family to use mainline modules from source
// (e.g. shiba and shiba_fullmte)
// Eventually these product variants will have their own release config maps.
if !proptools.Bool(ctx.Config().BuildIgnoreApexContributionContents()) {
ctx.VisitDirectDepsWithTag(AcDepTag, func(child Module) {
if m, ok := child.(*apexContributions); ok {
addContentsToProvider(&p, m)
} else {
ctx.ModuleErrorf("%s is not an apex_contributions module\n", child.Name())
}
})
}
ctx.VisitDirectDepsWithTag(AcDepTag, func(child Module) {
if m, ok := child.(*apexContributions); ok {
addContentsToProvider(&p, m)
} else {
ctx.ModuleErrorf("%s is not an apex_contributions module\n", child.Name())
}
})
SetProvider(ctx, PrebuiltSelectionInfoProvider, p)
}