Rename hiddenAPIFlagFileInfo to HiddenAPIInfo

This reflects that it has expanded from its initial purpose to include
more than just flag files. It is exported for use in tests in other
packages.

Bug: 179354495
Test: m nothing
Change-Id: I9f780b20e18ce3a774e4aa04a276463070a64c34
This commit is contained in:
Paul Duffin
2021-05-21 22:18:56 +01:00
parent 1352f7c471
commit af99afa919
3 changed files with 22 additions and 24 deletions

View File

@@ -555,12 +555,12 @@ func (b *BootclasspathFragmentModule) generateHiddenAPIBuildActions(ctx android.
hiddenAPIModules := gatherHiddenAPIModuleFromContents(ctx, contents) hiddenAPIModules := gatherHiddenAPIModuleFromContents(ctx, contents)
// Delegate the production of the hidden API all flags file to a module type specific method. // Delegate the production of the hidden API all-flags.csv file to a module type specific method.
common := ctx.Module().(commonBootclasspathFragment) common := ctx.Module().(commonBootclasspathFragment)
output := common.produceHiddenAPIAllFlagsFile(ctx, hiddenAPIModules, input) output := common.produceHiddenAPIAllFlagsFile(ctx, hiddenAPIModules, input)
// Initialize a hiddenAPIFlagFileInfo structure and provide it for use by other modules. // Initialize a HiddenAPIInfo structure and provide it for use by other modules.
flagFileInfo := hiddenAPIFlagFileInfo{ hiddenAPIInfo := HiddenAPIInfo{
// The monolithic hidden API processing needs access to the flag files from all the fragments. // The monolithic hidden API processing needs access to the flag files from all the fragments.
FlagFilesByCategory: input.FlagFilesByCategory, FlagFilesByCategory: input.FlagFilesByCategory,
@@ -568,7 +568,7 @@ func (b *BootclasspathFragmentModule) generateHiddenAPIBuildActions(ctx android.
// hidden API processing of this fragment. // hidden API processing of this fragment.
HiddenAPIFlagOutput: *output, HiddenAPIFlagOutput: *output,
} }
ctx.SetProvider(hiddenAPIFlagFileInfoProvider, flagFileInfo) ctx.SetProvider(HiddenAPIInfoProvider, hiddenAPIInfo)
return output return output
} }
@@ -696,17 +696,17 @@ func (b *bootclasspathFragmentSdkMemberProperties) PopulateFromVariant(ctx andro
b.Image_name = module.properties.Image_name b.Image_name = module.properties.Image_name
b.Contents = module.properties.Contents b.Contents = module.properties.Contents
// Get the flag file information from the module. // Get the hidden API information from the module.
mctx := ctx.SdkModuleContext() mctx := ctx.SdkModuleContext()
flagFileInfo := mctx.OtherModuleProvider(module, hiddenAPIFlagFileInfoProvider).(hiddenAPIFlagFileInfo) hiddenAPIInfo := mctx.OtherModuleProvider(module, HiddenAPIInfoProvider).(HiddenAPIInfo)
b.Flag_files_by_category = flagFileInfo.FlagFilesByCategory b.Flag_files_by_category = hiddenAPIInfo.FlagFilesByCategory
// Copy all the generated file paths. // Copy all the generated file paths.
b.Stub_flags_path = android.OptionalPathForPath(flagFileInfo.StubFlagsPath) b.Stub_flags_path = android.OptionalPathForPath(hiddenAPIInfo.StubFlagsPath)
b.Annotation_flags_path = android.OptionalPathForPath(flagFileInfo.AnnotationFlagsPath) b.Annotation_flags_path = android.OptionalPathForPath(hiddenAPIInfo.AnnotationFlagsPath)
b.Metadata_path = android.OptionalPathForPath(flagFileInfo.MetadataPath) b.Metadata_path = android.OptionalPathForPath(hiddenAPIInfo.MetadataPath)
b.Index_path = android.OptionalPathForPath(flagFileInfo.IndexPath) b.Index_path = android.OptionalPathForPath(hiddenAPIInfo.IndexPath)
b.All_flags_path = android.OptionalPathForPath(flagFileInfo.AllFlagsPath) b.All_flags_path = android.OptionalPathForPath(hiddenAPIInfo.AllFlagsPath)
// Copy stub_libs properties. // Copy stub_libs properties.
b.Stub_libs = module.properties.Api.Stub_libs b.Stub_libs = module.properties.Api.Stub_libs

View File

@@ -338,13 +338,11 @@ func (s FlagFilesByCategory) dedup() {
} }
} }
// hiddenAPIFlagFileInfo contains paths resolved from HiddenAPIFlagFileProperties and also generated // HiddenAPIInfo contains information provided by the hidden API processing.
// by hidden API processing.
// //
// This is used both for an individual bootclasspath_fragment to provide it to other modules and // That includes paths resolved from HiddenAPIFlagFileProperties and also generated by hidden API
// for a module to collate the files from the fragments it depends upon. That is why the fields are // processing.
// all Paths even though they are initialized with a single path. type HiddenAPIInfo struct {
type hiddenAPIFlagFileInfo struct {
// FlagFilesByCategory maps from the flag file category to the paths containing information for // FlagFilesByCategory maps from the flag file category to the paths containing information for
// that category. // that category.
FlagFilesByCategory FlagFilesByCategory FlagFilesByCategory FlagFilesByCategory
@@ -353,7 +351,7 @@ type hiddenAPIFlagFileInfo struct {
HiddenAPIFlagOutput HiddenAPIFlagOutput
} }
var hiddenAPIFlagFileInfoProvider = blueprint.NewProvider(hiddenAPIFlagFileInfo{}) var HiddenAPIInfoProvider = blueprint.NewProvider(HiddenAPIInfo{})
// StubDexJarsByKind maps an android.SdkKind to the paths to stub dex jars appropriate for that // StubDexJarsByKind maps an android.SdkKind to the paths to stub dex jars appropriate for that
// level. See hiddenAPIRelevantSdkKinds for a list of the acceptable android.SdkKind values. // level. See hiddenAPIRelevantSdkKinds for a list of the acceptable android.SdkKind values.
@@ -482,7 +480,7 @@ func pathForValidation(ctx android.PathContext, path android.WritablePath) andro
// annotationFlags is the path to the annotation flags file generated from annotation information // annotationFlags is the path to the annotation flags file generated from annotation information
// in each module. // in each module.
// //
// flagFileInfo is a struct containing paths to files that augment the information provided by // hiddenAPIInfo is a struct containing paths to files that augment the information provided by
// the annotationFlags. // the annotationFlags.
func buildRuleToGenerateHiddenApiFlags(ctx android.BuilderContext, name, desc string, outputPath android.WritablePath, baseFlagsPath android.Path, annotationFlags android.Path, flagFilesByCategory FlagFilesByCategory, allFlagsPaths android.Paths) { func buildRuleToGenerateHiddenApiFlags(ctx android.BuilderContext, name, desc string, outputPath android.WritablePath, baseFlagsPath android.Path, annotationFlags android.Path, flagFilesByCategory FlagFilesByCategory, allFlagsPaths android.Paths) {
@@ -578,7 +576,7 @@ func hiddenAPIGenerateAllFlagsForBootclasspathFragment(ctx android.ModuleContext
indexCSV := android.PathForModuleOut(ctx, hiddenApiSubDir, "index.csv") indexCSV := android.PathForModuleOut(ctx, hiddenApiSubDir, "index.csv")
buildRuleToGenerateIndex(ctx, "modular hiddenapi index", classesJars, indexCSV) buildRuleToGenerateIndex(ctx, "modular hiddenapi index", classesJars, indexCSV)
// Removed APIs need to be marked and in order to do that the flagFileInfo needs to specify files // Removed APIs need to be marked and in order to do that the hiddenAPIInfo needs to specify files
// containing dex signatures of all the removed APIs. In the monolithic files that is done by // containing dex signatures of all the removed APIs. In the monolithic files that is done by
// manually combining all the removed.txt files for each API and then converting them to dex // manually combining all the removed.txt files for each API and then converting them to dex
// signatures, see the combined-removed-dex module. That will all be done automatically in future. // signatures, see the combined-removed-dex module. That will all be done automatically in future.

View File

@@ -55,8 +55,8 @@ func newMonolithicHiddenAPIInfo(ctx android.ModuleContext, flagFilesByCategory F
// Merge all the information from the fragments. The fragments form a DAG so it is possible that // Merge all the information from the fragments. The fragments form a DAG so it is possible that
// this will introduce duplicates so they will be resolved after processing all the fragments. // this will introduce duplicates so they will be resolved after processing all the fragments.
for _, fragment := range fragments { for _, fragment := range fragments {
if ctx.OtherModuleHasProvider(fragment, hiddenAPIFlagFileInfoProvider) { if ctx.OtherModuleHasProvider(fragment, HiddenAPIInfoProvider) {
info := ctx.OtherModuleProvider(fragment, hiddenAPIFlagFileInfoProvider).(hiddenAPIFlagFileInfo) info := ctx.OtherModuleProvider(fragment, HiddenAPIInfoProvider).(HiddenAPIInfo)
monolithicInfo.append(&info) monolithicInfo.append(&info)
} }
} }
@@ -68,7 +68,7 @@ func newMonolithicHiddenAPIInfo(ctx android.ModuleContext, flagFilesByCategory F
} }
// append appends all the files from the supplied info to the corresponding files in this struct. // append appends all the files from the supplied info to the corresponding files in this struct.
func (i *MonolithicHiddenAPIInfo) append(other *hiddenAPIFlagFileInfo) { func (i *MonolithicHiddenAPIInfo) append(other *HiddenAPIInfo) {
i.FlagsFilesByCategory.append(other.FlagFilesByCategory) i.FlagsFilesByCategory.append(other.FlagFilesByCategory)
i.StubFlagsPaths = append(i.StubFlagsPaths, other.StubFlagsPath) i.StubFlagsPaths = append(i.StubFlagsPaths, other.StubFlagsPath)
i.AnnotationFlagsPaths = append(i.AnnotationFlagsPaths, other.AnnotationFlagsPath) i.AnnotationFlagsPaths = append(i.AnnotationFlagsPaths, other.AnnotationFlagsPath)