Merge "Export hidden api related types and fields" am: 5e1073b7cd

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

Change-Id: I3a24d55d95460bbebb7378411d8b5d449ffce628
This commit is contained in:
Paul Duffin 2021-06-11 04:49:38 +00:00 committed by Automerger Merge Worker
commit a6752bb7ed
5 changed files with 22 additions and 23 deletions

View file

@ -763,7 +763,7 @@ func (b *bootclasspathFragmentSdkMemberProperties) AddToPropertySet(ctx android.
// Copy manually curated flag files specified on the bootclasspath_fragment.
if b.Flag_files_by_category != nil {
for _, category := range hiddenAPIFlagFileCategories {
for _, category := range HiddenAPIFlagFileCategories {
paths := b.Flag_files_by_category[category]
if len(paths) > 0 {
dests := []string{}
@ -772,7 +772,7 @@ func (b *bootclasspathFragmentSdkMemberProperties) AddToPropertySet(ctx android.
builder.CopyToSnapshot(p, dest)
dests = append(dests, dest)
}
hiddenAPISet.AddProperty(category.propertyName, dests)
hiddenAPISet.AddProperty(category.PropertyName, dests)
}
}
}

View file

@ -248,8 +248,8 @@ type HiddenAPIFlagFileProperties struct {
}
type hiddenAPIFlagFileCategory struct {
// propertyName is the name of the property for this category.
propertyName string
// PropertyName is the name of the property for this category.
PropertyName string
// propertyValueReader retrieves the value of the property for this category from the set of
// properties.
@ -262,12 +262,12 @@ type hiddenAPIFlagFileCategory struct {
// The flag file category for removed members of the API.
//
// This is extracted from hiddenAPIFlagFileCategories as it is needed to add the dex signatures
// This is extracted from HiddenAPIFlagFileCategories as it is needed to add the dex signatures
// list of removed API members that are generated automatically from the removed.txt files provided
// by API stubs.
var hiddenAPIRemovedFlagFileCategory = &hiddenAPIFlagFileCategory{
// See HiddenAPIFlagFileProperties.Removed
propertyName: "removed",
PropertyName: "removed",
propertyValueReader: func(properties *HiddenAPIFlagFileProperties) []string {
return properties.Removed
},
@ -276,10 +276,10 @@ var hiddenAPIRemovedFlagFileCategory = &hiddenAPIFlagFileCategory{
},
}
var hiddenAPIFlagFileCategories = []*hiddenAPIFlagFileCategory{
var HiddenAPIFlagFileCategories = []*hiddenAPIFlagFileCategory{
// See HiddenAPIFlagFileProperties.Unsupported
{
propertyName: "unsupported",
PropertyName: "unsupported",
propertyValueReader: func(properties *HiddenAPIFlagFileProperties) []string {
return properties.Unsupported
},
@ -290,7 +290,7 @@ var hiddenAPIFlagFileCategories = []*hiddenAPIFlagFileCategory{
hiddenAPIRemovedFlagFileCategory,
// See HiddenAPIFlagFileProperties.Max_target_r_low_priority
{
propertyName: "max_target_r_low_priority",
PropertyName: "max_target_r_low_priority",
propertyValueReader: func(properties *HiddenAPIFlagFileProperties) []string {
return properties.Max_target_r_low_priority
},
@ -300,7 +300,7 @@ var hiddenAPIFlagFileCategories = []*hiddenAPIFlagFileCategory{
},
// See HiddenAPIFlagFileProperties.Max_target_q
{
propertyName: "max_target_q",
PropertyName: "max_target_q",
propertyValueReader: func(properties *HiddenAPIFlagFileProperties) []string {
return properties.Max_target_q
},
@ -310,7 +310,7 @@ var hiddenAPIFlagFileCategories = []*hiddenAPIFlagFileCategory{
},
// See HiddenAPIFlagFileProperties.Max_target_p
{
propertyName: "max_target_p",
PropertyName: "max_target_p",
propertyValueReader: func(properties *HiddenAPIFlagFileProperties) []string {
return properties.Max_target_p
},
@ -320,7 +320,7 @@ var hiddenAPIFlagFileCategories = []*hiddenAPIFlagFileCategory{
},
// See HiddenAPIFlagFileProperties.Max_target_o_low_priority
{
propertyName: "max_target_o_low_priority",
PropertyName: "max_target_o_low_priority",
propertyValueReader: func(properties *HiddenAPIFlagFileProperties) []string {
return properties.Max_target_o_low_priority
},
@ -330,7 +330,7 @@ var hiddenAPIFlagFileCategories = []*hiddenAPIFlagFileCategory{
},
// See HiddenAPIFlagFileProperties.Blocked
{
propertyName: "blocked",
PropertyName: "blocked",
propertyValueReader: func(properties *HiddenAPIFlagFileProperties) []string {
return properties.Blocked
},
@ -340,7 +340,7 @@ var hiddenAPIFlagFileCategories = []*hiddenAPIFlagFileCategory{
},
// See HiddenAPIFlagFileProperties.Unsupported_packages
{
propertyName: "unsupported_packages",
PropertyName: "unsupported_packages",
propertyValueReader: func(properties *HiddenAPIFlagFileProperties) []string {
return properties.Unsupported_packages
},
@ -355,7 +355,7 @@ type FlagFilesByCategory map[*hiddenAPIFlagFileCategory]android.Paths
// append appends the supplied flags files to the corresponding category in this map.
func (s FlagFilesByCategory) append(other FlagFilesByCategory) {
for _, category := range hiddenAPIFlagFileCategories {
for _, category := range HiddenAPIFlagFileCategories {
s[category] = append(s[category], other[category]...)
}
}
@ -540,7 +540,7 @@ func (i *HiddenAPIFlagInput) gatherStubLibInfo(ctx android.ModuleContext, conten
// extractFlagFilesFromProperties extracts the paths to flag files that are specified in the
// supplied properties and stores them in this struct.
func (i *HiddenAPIFlagInput) extractFlagFilesFromProperties(ctx android.ModuleContext, p *HiddenAPIFlagFileProperties) {
for _, category := range hiddenAPIFlagFileCategories {
for _, category := range HiddenAPIFlagFileCategories {
paths := android.PathsForModuleSrc(ctx, category.propertyValueReader(p))
i.FlagFilesByCategory[category] = paths
}
@ -630,7 +630,7 @@ func buildRuleToGenerateHiddenApiFlags(ctx android.BuilderContext, name, desc st
FlagWithOutput("--output ", tempPath)
// Add the options for the different categories of flag files.
for _, category := range hiddenAPIFlagFileCategories {
for _, category := range HiddenAPIFlagFileCategories {
paths := flagFilesByCategory[category]
for _, path := range paths {
category.commandMutator(command, path)

View file

@ -99,4 +99,4 @@ func (i *MonolithicHiddenAPIInfo) dedup() {
i.AllFlagsPaths = android.FirstUniquePaths(i.AllFlagsPaths)
}
var monolithicHiddenAPIInfoProvider = blueprint.NewProvider(MonolithicHiddenAPIInfo{})
var MonolithicHiddenAPIInfoProvider = blueprint.NewProvider(MonolithicHiddenAPIInfo{})

View file

@ -280,7 +280,6 @@ func (b *platformBootclasspathModule) generateHiddenAPIBuildActions(ctx android.
}
monolithicInfo := b.createAndProvideMonolithicHiddenAPIInfo(ctx, fragments)
// Create the input to pass to ruleToGenerateHiddenAPIStubFlagsFile
input := newHiddenAPIFlagInput()
@ -342,7 +341,7 @@ func (b *platformBootclasspathModule) createAndProvideMonolithicHiddenAPIInfo(ct
monolithicInfo := newMonolithicHiddenAPIInfo(ctx, temporaryInput.FlagFilesByCategory, fragments)
// Store the information for testing.
ctx.SetProvider(monolithicHiddenAPIInfoProvider, monolithicInfo)
ctx.SetProvider(MonolithicHiddenAPIInfoProvider, monolithicInfo)
return monolithicInfo
}

View file

@ -245,10 +245,10 @@ func TestPlatformBootclasspath_Fragments(t *testing.T) {
).RunTest(t)
pbcp := result.Module("platform-bootclasspath", "android_common")
info := result.ModuleProvider(pbcp, monolithicHiddenAPIInfoProvider).(MonolithicHiddenAPIInfo)
info := result.ModuleProvider(pbcp, MonolithicHiddenAPIInfoProvider).(MonolithicHiddenAPIInfo)
for _, category := range hiddenAPIFlagFileCategories {
name := category.propertyName
for _, category := range HiddenAPIFlagFileCategories {
name := category.PropertyName
message := fmt.Sprintf("category %s", name)
filename := strings.ReplaceAll(name, "_", "-")
expected := []string{fmt.Sprintf("%s.txt", filename), fmt.Sprintf("bar-%s.txt", filename)}