[automerge] Patch to fix Aug train issue with tethering 2p: a649ad5b31

Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/19432194

Bug: 238472881
Change-Id: Ie6560f201b87e7a3998f8f47ab52b1ae882ccb60
This commit is contained in:
Presubmit Automerger Backend
2022-07-28 09:39:44 +00:00
8 changed files with 431 additions and 84 deletions

View File

@@ -769,7 +769,7 @@ func (b *BootclasspathFragmentModule) generateHiddenAPIBuildActions(ctx android.
// their own.
if output.SignaturePatternsPath == nil {
output.SignaturePatternsPath = buildRuleSignaturePatternsFile(
ctx, output.AllFlagsPath, []string{"*"}, nil, nil)
ctx, output.AllFlagsPath, []string{"*"}, nil, nil, "")
}
// Initialize a HiddenAPIInfo structure.
@@ -853,12 +853,10 @@ func (b *BootclasspathFragmentModule) isTestFragment() bool {
return false
}
// produceHiddenAPIOutput produces the hidden API all-flags.csv file (and supporting files)
// for the fragment as well as encoding the flags in the boot dex jars.
func (b *BootclasspathFragmentModule) produceHiddenAPIOutput(ctx android.ModuleContext, contents []android.Module, input HiddenAPIFlagInput) *HiddenAPIOutput {
func (b *BootclasspathFragmentModule) generateHiddenApiFlagRules(ctx android.ModuleContext, contents []android.Module, input HiddenAPIFlagInput, bootDexInfoByModule bootDexInfoByModule, suffix string) HiddenAPIFlagOutput {
// Generate the rules to create the hidden API flags and update the supplied hiddenAPIInfo with the
// paths to the created files.
output := hiddenAPIRulesForBootclasspathFragment(ctx, contents, input)
flagOutput := hiddenAPIFlagRulesForBootclasspathFragment(ctx, bootDexInfoByModule, contents, input, suffix)
// If the module specifies split_packages or package_prefixes then use those to generate the
// signature patterns.
@@ -866,8 +864,8 @@ func (b *BootclasspathFragmentModule) produceHiddenAPIOutput(ctx android.ModuleC
packagePrefixes := b.sourceOnlyProperties.Hidden_api.Package_prefixes
singlePackages := b.sourceOnlyProperties.Hidden_api.Single_packages
if splitPackages != nil || packagePrefixes != nil || singlePackages != nil {
output.SignaturePatternsPath = buildRuleSignaturePatternsFile(
ctx, output.AllFlagsPath, splitPackages, packagePrefixes, singlePackages)
flagOutput.SignaturePatternsPath = buildRuleSignaturePatternsFile(
ctx, flagOutput.AllFlagsPath, splitPackages, packagePrefixes, singlePackages, suffix)
} else if !b.isTestFragment() {
ctx.ModuleErrorf(`Must specify at least one of the split_packages, package_prefixes and single_packages properties
If this is a new bootclasspath_fragment or you are unsure what to do add the
@@ -879,6 +877,49 @@ func (b *BootclasspathFragmentModule) produceHiddenAPIOutput(ctx android.ModuleC
should specify here. If you are happy with its suggestions then you can add
the --fix option and it will fix them for you.`, b.BaseModuleName())
}
return flagOutput
}
// produceHiddenAPIOutput produces the hidden API all-flags.csv file (and supporting files)
// for the fragment as well as encoding the flags in the boot dex jars.
func (b *BootclasspathFragmentModule) produceHiddenAPIOutput(ctx android.ModuleContext, contents []android.Module, input HiddenAPIFlagInput) *HiddenAPIOutput {
// Gather information about the boot dex files for the boot libraries provided by this fragment.
bootDexInfoByModule := extractBootDexInfoFromModules(ctx, contents)
flagOutput := b.generateHiddenApiFlagRules(ctx, contents, input, bootDexInfoByModule, "")
encodedBootDexFilesByModule := hiddenAPIEncodeRulesForBootclasspathFragment(ctx, bootDexInfoByModule, flagOutput.AllFlagsPath)
output := &HiddenAPIOutput{
HiddenAPIFlagOutput: flagOutput,
EncodedBootDexFilesByModule: encodedBootDexFilesByModule,
}
config := ctx.Config()
targetApiLevel := android.ApiLevelOrPanic(ctx,
config.GetenvWithDefault("SOONG_SDK_SNAPSHOT_TARGET_BUILD_RELEASE", "current"))
filterContents := []android.Module{}
for _, module := range contents {
minApiLevel := android.MinApiLevelForSdkSnapshot(ctx, module)
if minApiLevel.GreaterThan(targetApiLevel) {
delete(bootDexInfoByModule, module.Name())
delete(input.StubDexJarsByScope, module.Name())
continue
}
filterContents = append(filterContents, module)
}
if len(filterContents) != len(contents) {
flagOutput = b.generateHiddenApiFlagRules(ctx, filterContents, input, bootDexInfoByModule, "-for-sdk-snapshot")
}
// Copy the information and make it available for sdk snapshot.
ctx.SetProvider(HiddenAPIInfoForSdkProvider, HiddenAPIInfoForSdk{
FlagFilesByCategory: input.FlagFilesByCategory,
HiddenAPIFlagOutput: flagOutput,
})
return output
}
@@ -1044,7 +1085,7 @@ func (b *bootclasspathFragmentSdkMemberProperties) PopulateFromVariant(ctx andro
// Get the hidden API information from the module.
mctx := ctx.SdkModuleContext()
hiddenAPIInfo := mctx.OtherModuleProvider(module, HiddenAPIInfoProvider).(HiddenAPIInfo)
hiddenAPIInfo := mctx.OtherModuleProvider(module, HiddenAPIInfoForSdkProvider).(HiddenAPIInfoForSdk)
b.Flag_files_by_category = hiddenAPIInfo.FlagFilesByCategory
// Copy all the generated file paths.
@@ -1223,6 +1264,15 @@ func (module *PrebuiltBootclasspathFragmentModule) produceHiddenAPIOutput(ctx an
output.FilteredStubFlagsPath = pathForOptionalSrc(module.prebuiltProperties.Hidden_api.Filtered_stub_flags, output.StubFlagsPath)
output.FilteredFlagsPath = pathForOptionalSrc(module.prebuiltProperties.Hidden_api.Filtered_flags, output.AllFlagsPath)
// If the prebuilts module does not provide a signature patterns file then generate one from the
// flags.
// TODO(b/192868581): Remove once the prebuilts all provide a signature patterns file of their
// own.
if output.SignaturePatternsPath == nil {
output.SignaturePatternsPath = buildRuleSignaturePatternsFile(
ctx, output.AllFlagsPath, []string{"*"}, nil, nil, "")
}
return &output
}