Rename hiddenAPIFlagFileInfo to HiddenAPIInfo am: af99afa919 am: 02139ea746

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

Change-Id: Ibe96018a8531e19d49f179fb5f1f9cae90e313a4
This commit is contained in:
Paul Duffin
2021-05-24 15:55:36 +00:00
committed by Automerger Merge Worker
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)
// 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)
output := common.produceHiddenAPIAllFlagsFile(ctx, hiddenAPIModules, input)
// Initialize a hiddenAPIFlagFileInfo structure and provide it for use by other modules.
flagFileInfo := hiddenAPIFlagFileInfo{
// Initialize a HiddenAPIInfo structure and provide it for use by other modules.
hiddenAPIInfo := HiddenAPIInfo{
// The monolithic hidden API processing needs access to the flag files from all the fragments.
FlagFilesByCategory: input.FlagFilesByCategory,
@@ -568,7 +568,7 @@ func (b *BootclasspathFragmentModule) generateHiddenAPIBuildActions(ctx android.
// hidden API processing of this fragment.
HiddenAPIFlagOutput: *output,
}
ctx.SetProvider(hiddenAPIFlagFileInfoProvider, flagFileInfo)
ctx.SetProvider(HiddenAPIInfoProvider, hiddenAPIInfo)
return output
}
@@ -696,17 +696,17 @@ func (b *bootclasspathFragmentSdkMemberProperties) PopulateFromVariant(ctx andro
b.Image_name = module.properties.Image_name
b.Contents = module.properties.Contents
// Get the flag file information from the module.
// Get the hidden API information from the module.
mctx := ctx.SdkModuleContext()
flagFileInfo := mctx.OtherModuleProvider(module, hiddenAPIFlagFileInfoProvider).(hiddenAPIFlagFileInfo)
b.Flag_files_by_category = flagFileInfo.FlagFilesByCategory
hiddenAPIInfo := mctx.OtherModuleProvider(module, HiddenAPIInfoProvider).(HiddenAPIInfo)
b.Flag_files_by_category = hiddenAPIInfo.FlagFilesByCategory
// Copy all the generated file paths.
b.Stub_flags_path = android.OptionalPathForPath(flagFileInfo.StubFlagsPath)
b.Annotation_flags_path = android.OptionalPathForPath(flagFileInfo.AnnotationFlagsPath)
b.Metadata_path = android.OptionalPathForPath(flagFileInfo.MetadataPath)
b.Index_path = android.OptionalPathForPath(flagFileInfo.IndexPath)
b.All_flags_path = android.OptionalPathForPath(flagFileInfo.AllFlagsPath)
b.Stub_flags_path = android.OptionalPathForPath(hiddenAPIInfo.StubFlagsPath)
b.Annotation_flags_path = android.OptionalPathForPath(hiddenAPIInfo.AnnotationFlagsPath)
b.Metadata_path = android.OptionalPathForPath(hiddenAPIInfo.MetadataPath)
b.Index_path = android.OptionalPathForPath(hiddenAPIInfo.IndexPath)
b.All_flags_path = android.OptionalPathForPath(hiddenAPIInfo.AllFlagsPath)
// Copy stub_libs properties.
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
// by hidden API processing.
// HiddenAPIInfo contains information provided by the hidden API processing.
//
// This is used both for an individual bootclasspath_fragment to provide it to other modules and
// for a module to collate the files from the fragments it depends upon. That is why the fields are
// all Paths even though they are initialized with a single path.
type hiddenAPIFlagFileInfo struct {
// That includes paths resolved from HiddenAPIFlagFileProperties and also generated by hidden API
// processing.
type HiddenAPIInfo struct {
// FlagFilesByCategory maps from the flag file category to the paths containing information for
// that category.
FlagFilesByCategory FlagFilesByCategory
@@ -353,7 +351,7 @@ type hiddenAPIFlagFileInfo struct {
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
// 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
// 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.
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")
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
// 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.

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
// this will introduce duplicates so they will be resolved after processing all the fragments.
for _, fragment := range fragments {
if ctx.OtherModuleHasProvider(fragment, hiddenAPIFlagFileInfoProvider) {
info := ctx.OtherModuleProvider(fragment, hiddenAPIFlagFileInfoProvider).(hiddenAPIFlagFileInfo)
if ctx.OtherModuleHasProvider(fragment, HiddenAPIInfoProvider) {
info := ctx.OtherModuleProvider(fragment, HiddenAPIInfoProvider).(HiddenAPIInfo)
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.
func (i *MonolithicHiddenAPIInfo) append(other *hiddenAPIFlagFileInfo) {
func (i *MonolithicHiddenAPIInfo) append(other *HiddenAPIInfo) {
i.FlagsFilesByCategory.append(other.FlagFilesByCategory)
i.StubFlagsPaths = append(i.StubFlagsPaths, other.StubFlagsPath)
i.AnnotationFlagsPaths = append(i.AnnotationFlagsPaths, other.AnnotationFlagsPath)