Merge "Hide unflagged mainline prebuilts with missing source." into main
This commit is contained in:
@@ -119,7 +119,10 @@ func (a *allApexContributions) DepsMutator(ctx BottomUpMutatorContext) {
|
||||
func (a *allApexContributions) SetPrebuiltSelectionInfoProvider(ctx BaseModuleContext) {
|
||||
addContentsToProvider := func(p *PrebuiltSelectionInfoMap, m *apexContributions) {
|
||||
for _, content := range m.Contents() {
|
||||
if !ctx.OtherModuleExists(content) && !ctx.Config().AllowMissingDependencies() {
|
||||
// Verify that the module listed in contents exists in the tree
|
||||
// Remove the prebuilt_ prefix to account for partner worksapces where the source module does not
|
||||
// exist, and PrebuiltRenameMutator renames `prebuilt_foo` to `foo`
|
||||
if !ctx.OtherModuleExists(content) && !ctx.OtherModuleExists(RemoveOptionalPrebuiltPrefix(content)) && !ctx.Config().AllowMissingDependencies() {
|
||||
ctx.ModuleErrorf("%s listed in apex_contributions %s does not exist\n", content, m.Name())
|
||||
}
|
||||
pi := &PrebuiltSelectionInfo{
|
||||
|
@@ -2004,41 +2004,41 @@ func (c *config) UseResourceProcessorByDefault() bool {
|
||||
}
|
||||
|
||||
var (
|
||||
mainlineApexContributionBuildFlags = []string{
|
||||
"RELEASE_APEX_CONTRIBUTIONS_ADBD",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_ADSERVICES",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_APPSEARCH",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_ART",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_BLUETOOTH",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_CAPTIVEPORTALLOGIN",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_CELLBROADCAST",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_CONFIGINFRASTRUCTURE",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_CONNECTIVITY",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_CONSCRYPT",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_CRASHRECOVERY",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_DEVICELOCK",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_DOCUMENTSUIGOOGLE",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_EXTSERVICES",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_HEALTHFITNESS",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_IPSEC",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_MEDIA",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_MEDIAPROVIDER",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_MODULE_METADATA",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_NETWORKSTACKGOOGLE",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_NEURALNETWORKS",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_ONDEVICEPERSONALIZATION",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_PERMISSION",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_PRIMARY_LIBS",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_REMOTEKEYPROVISIONING",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_RESOLV",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_SCHEDULING",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_SDKEXTENSIONS",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_SWCODEC",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_STATSD",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_TELEMETRY_TVP",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_TZDATA",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_UWB",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_WIFI",
|
||||
mainlineApexContributionBuildFlagsToApexNames = map[string]string{
|
||||
"RELEASE_APEX_CONTRIBUTIONS_ADBD": "com.android.adbd",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_ADSERVICES": "com.android.adservices",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_APPSEARCH": "com.android.appsearch",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_ART": "com.android.art",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_BLUETOOTH": "com.android.btservices",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_CAPTIVEPORTALLOGIN": "",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_CELLBROADCAST": "com.android.cellbroadcast",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_CONFIGINFRASTRUCTURE": "com.android.configinfrastructure",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_CONNECTIVITY": "com.android.tethering",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_CONSCRYPT": "com.android.conscrypt",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_CRASHRECOVERY": "",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_DEVICELOCK": "com.android.devicelock",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_DOCUMENTSUIGOOGLE": "",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_EXTSERVICES": "com.android.extservices",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_HEALTHFITNESS": "com.android.healthfitness",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_IPSEC": "com.android.ipsec",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_MEDIA": "com.android.media",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_MEDIAPROVIDER": "com.android.mediaprovider",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_MODULE_METADATA": "",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_NETWORKSTACKGOOGLE": "",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_NEURALNETWORKS": "com.android.neuralnetworks",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_ONDEVICEPERSONALIZATION": "com.android.ondevicepersonalization",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_PERMISSION": "com.android.permission",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_PRIMARY_LIBS": "",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_REMOTEKEYPROVISIONING": "com.android.rkpd",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_RESOLV": "com.android.resolv",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_SCHEDULING": "com.android.scheduling",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_SDKEXTENSIONS": "com.android.sdkext",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_SWCODEC": "com.android.media.swcodec",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_STATSD": "com.android.os.statsd",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_TELEMETRY_TVP": "",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_TZDATA": "com.android.tzdata",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_UWB": "com.android.uwb",
|
||||
"RELEASE_APEX_CONTRIBUTIONS_WIFI": "com.android.wifi",
|
||||
}
|
||||
)
|
||||
|
||||
@@ -2046,7 +2046,7 @@ var (
|
||||
// Each mainline module will have one entry in the list
|
||||
func (c *config) AllApexContributions() []string {
|
||||
ret := []string{}
|
||||
for _, f := range mainlineApexContributionBuildFlags {
|
||||
for _, f := range SortedKeys(mainlineApexContributionBuildFlagsToApexNames) {
|
||||
if val, exists := c.GetBuildFlag(f); exists && val != "" {
|
||||
ret = append(ret, val)
|
||||
}
|
||||
@@ -2054,6 +2054,10 @@ func (c *config) AllApexContributions() []string {
|
||||
return ret
|
||||
}
|
||||
|
||||
func (c *config) AllMainlineApexNames() []string {
|
||||
return SortedStringValues(mainlineApexContributionBuildFlagsToApexNames)
|
||||
}
|
||||
|
||||
func (c *config) BuildIgnoreApexContributionContents() *bool {
|
||||
return c.productVariables.BuildIgnoreApexContributionContents
|
||||
}
|
||||
|
@@ -419,15 +419,7 @@ func PrebuiltRenameMutator(ctx BottomUpMutatorContext) {
|
||||
// The metadata will be used for source vs prebuilts selection
|
||||
func PrebuiltSourceDepsMutator(ctx BottomUpMutatorContext) {
|
||||
m := ctx.Module()
|
||||
// If this module is a prebuilt, is enabled and has not been renamed to source then add a
|
||||
// dependency onto the source if it is present.
|
||||
if p := GetEmbeddedPrebuilt(m); p != nil && m.Enabled(ctx) && !p.properties.PrebuiltRenamedToSource {
|
||||
bmn, _ := m.(baseModuleName)
|
||||
name := bmn.BaseModuleName()
|
||||
if ctx.OtherModuleReverseDependencyVariantExists(name) {
|
||||
ctx.AddReverseDependency(ctx.Module(), PrebuiltDepTag, name)
|
||||
p.properties.SourceExists = true
|
||||
}
|
||||
if p := GetEmbeddedPrebuilt(m); p != nil {
|
||||
// Add a dependency from the prebuilt to the `all_apex_contributions`
|
||||
// metadata module
|
||||
// TODO: When all branches contain this singleton module, make this strict
|
||||
@@ -435,7 +427,16 @@ func PrebuiltSourceDepsMutator(ctx BottomUpMutatorContext) {
|
||||
if ctx.OtherModuleExists("all_apex_contributions") {
|
||||
ctx.AddDependency(m, AcDepTag, "all_apex_contributions")
|
||||
}
|
||||
|
||||
if m.Enabled(ctx) && !p.properties.PrebuiltRenamedToSource {
|
||||
// If this module is a prebuilt, is enabled and has not been renamed to source then add a
|
||||
// dependency onto the source if it is present.
|
||||
bmn, _ := m.(baseModuleName)
|
||||
name := bmn.BaseModuleName()
|
||||
if ctx.OtherModuleReverseDependencyVariantExists(name) {
|
||||
ctx.AddReverseDependency(ctx.Module(), PrebuiltDepTag, name)
|
||||
p.properties.SourceExists = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -664,12 +665,37 @@ func (p *Prebuilt) variantIsDisabled(ctx BaseMutatorContext, prebuilt Module) bo
|
||||
return p.srcsSupplier != nil && len(p.srcsSupplier(ctx, prebuilt)) == 0
|
||||
}
|
||||
|
||||
type apexVariationName interface {
|
||||
ApexVariationName() string
|
||||
}
|
||||
|
||||
// usePrebuilt returns true if a prebuilt should be used instead of the source module. The prebuilt
|
||||
// will be used if it is marked "prefer" or if the source module is disabled.
|
||||
func (p *Prebuilt) usePrebuilt(ctx BaseMutatorContext, source Module, prebuilt Module) bool {
|
||||
isMainlinePrebuilt := func(prebuilt Module) bool {
|
||||
apex, ok := prebuilt.(apexVariationName)
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
// Prebuilts of aosp apexes in prebuilts/runtime
|
||||
// Used in minimal art branches
|
||||
if prebuilt.base().BaseModuleName() == apex.ApexVariationName() {
|
||||
return false
|
||||
}
|
||||
return InList(apex.ApexVariationName(), ctx.Config().AllMainlineApexNames())
|
||||
}
|
||||
|
||||
// Use `all_apex_contributions` for source vs prebuilt selection.
|
||||
psi := PrebuiltSelectionInfoMap{}
|
||||
ctx.VisitDirectDepsWithTag(PrebuiltDepTag, func(am Module) {
|
||||
var psiDepTag blueprint.DependencyTag
|
||||
if p := GetEmbeddedPrebuilt(ctx.Module()); p != nil {
|
||||
// This is a prebuilt module, visit all_apex_contributions to get the info
|
||||
psiDepTag = AcDepTag
|
||||
} else {
|
||||
// This is a source module, visit any of its prebuilts to get the info
|
||||
psiDepTag = PrebuiltDepTag
|
||||
}
|
||||
ctx.VisitDirectDepsWithTag(psiDepTag, func(am Module) {
|
||||
psi, _ = OtherModuleProvider(ctx, am, PrebuiltSelectionInfoProvider)
|
||||
})
|
||||
|
||||
@@ -682,6 +708,11 @@ func (p *Prebuilt) usePrebuilt(ctx BaseMutatorContext, source Module, prebuilt M
|
||||
return true
|
||||
}
|
||||
|
||||
// If this is a mainline prebuilt, but has not been flagged, hide it.
|
||||
if isMainlinePrebuilt(prebuilt) {
|
||||
return false
|
||||
}
|
||||
|
||||
// If the baseModuleName could not be found in the metadata module,
|
||||
// fall back to the existing source vs prebuilt selection.
|
||||
// TODO: Drop the fallback mechanisms
|
||||
|
Reference in New Issue
Block a user