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:
commit
a6752bb7ed
5 changed files with 22 additions and 23 deletions
|
@ -763,7 +763,7 @@ func (b *bootclasspathFragmentSdkMemberProperties) AddToPropertySet(ctx android.
|
||||||
|
|
||||||
// Copy manually curated flag files specified on the bootclasspath_fragment.
|
// Copy manually curated flag files specified on the bootclasspath_fragment.
|
||||||
if b.Flag_files_by_category != nil {
|
if b.Flag_files_by_category != nil {
|
||||||
for _, category := range hiddenAPIFlagFileCategories {
|
for _, category := range HiddenAPIFlagFileCategories {
|
||||||
paths := b.Flag_files_by_category[category]
|
paths := b.Flag_files_by_category[category]
|
||||||
if len(paths) > 0 {
|
if len(paths) > 0 {
|
||||||
dests := []string{}
|
dests := []string{}
|
||||||
|
@ -772,7 +772,7 @@ func (b *bootclasspathFragmentSdkMemberProperties) AddToPropertySet(ctx android.
|
||||||
builder.CopyToSnapshot(p, dest)
|
builder.CopyToSnapshot(p, dest)
|
||||||
dests = append(dests, dest)
|
dests = append(dests, dest)
|
||||||
}
|
}
|
||||||
hiddenAPISet.AddProperty(category.propertyName, dests)
|
hiddenAPISet.AddProperty(category.PropertyName, dests)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -248,8 +248,8 @@ type HiddenAPIFlagFileProperties struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type hiddenAPIFlagFileCategory struct {
|
type hiddenAPIFlagFileCategory struct {
|
||||||
// propertyName is the name of the property for this category.
|
// PropertyName is the name of the property for this category.
|
||||||
propertyName string
|
PropertyName string
|
||||||
|
|
||||||
// propertyValueReader retrieves the value of the property for this category from the set of
|
// propertyValueReader retrieves the value of the property for this category from the set of
|
||||||
// properties.
|
// properties.
|
||||||
|
@ -262,12 +262,12 @@ type hiddenAPIFlagFileCategory struct {
|
||||||
|
|
||||||
// The flag file category for removed members of the API.
|
// 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
|
// list of removed API members that are generated automatically from the removed.txt files provided
|
||||||
// by API stubs.
|
// by API stubs.
|
||||||
var hiddenAPIRemovedFlagFileCategory = &hiddenAPIFlagFileCategory{
|
var hiddenAPIRemovedFlagFileCategory = &hiddenAPIFlagFileCategory{
|
||||||
// See HiddenAPIFlagFileProperties.Removed
|
// See HiddenAPIFlagFileProperties.Removed
|
||||||
propertyName: "removed",
|
PropertyName: "removed",
|
||||||
propertyValueReader: func(properties *HiddenAPIFlagFileProperties) []string {
|
propertyValueReader: func(properties *HiddenAPIFlagFileProperties) []string {
|
||||||
return properties.Removed
|
return properties.Removed
|
||||||
},
|
},
|
||||||
|
@ -276,10 +276,10 @@ var hiddenAPIRemovedFlagFileCategory = &hiddenAPIFlagFileCategory{
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
var hiddenAPIFlagFileCategories = []*hiddenAPIFlagFileCategory{
|
var HiddenAPIFlagFileCategories = []*hiddenAPIFlagFileCategory{
|
||||||
// See HiddenAPIFlagFileProperties.Unsupported
|
// See HiddenAPIFlagFileProperties.Unsupported
|
||||||
{
|
{
|
||||||
propertyName: "unsupported",
|
PropertyName: "unsupported",
|
||||||
propertyValueReader: func(properties *HiddenAPIFlagFileProperties) []string {
|
propertyValueReader: func(properties *HiddenAPIFlagFileProperties) []string {
|
||||||
return properties.Unsupported
|
return properties.Unsupported
|
||||||
},
|
},
|
||||||
|
@ -290,7 +290,7 @@ var hiddenAPIFlagFileCategories = []*hiddenAPIFlagFileCategory{
|
||||||
hiddenAPIRemovedFlagFileCategory,
|
hiddenAPIRemovedFlagFileCategory,
|
||||||
// See HiddenAPIFlagFileProperties.Max_target_r_low_priority
|
// See HiddenAPIFlagFileProperties.Max_target_r_low_priority
|
||||||
{
|
{
|
||||||
propertyName: "max_target_r_low_priority",
|
PropertyName: "max_target_r_low_priority",
|
||||||
propertyValueReader: func(properties *HiddenAPIFlagFileProperties) []string {
|
propertyValueReader: func(properties *HiddenAPIFlagFileProperties) []string {
|
||||||
return properties.Max_target_r_low_priority
|
return properties.Max_target_r_low_priority
|
||||||
},
|
},
|
||||||
|
@ -300,7 +300,7 @@ var hiddenAPIFlagFileCategories = []*hiddenAPIFlagFileCategory{
|
||||||
},
|
},
|
||||||
// See HiddenAPIFlagFileProperties.Max_target_q
|
// See HiddenAPIFlagFileProperties.Max_target_q
|
||||||
{
|
{
|
||||||
propertyName: "max_target_q",
|
PropertyName: "max_target_q",
|
||||||
propertyValueReader: func(properties *HiddenAPIFlagFileProperties) []string {
|
propertyValueReader: func(properties *HiddenAPIFlagFileProperties) []string {
|
||||||
return properties.Max_target_q
|
return properties.Max_target_q
|
||||||
},
|
},
|
||||||
|
@ -310,7 +310,7 @@ var hiddenAPIFlagFileCategories = []*hiddenAPIFlagFileCategory{
|
||||||
},
|
},
|
||||||
// See HiddenAPIFlagFileProperties.Max_target_p
|
// See HiddenAPIFlagFileProperties.Max_target_p
|
||||||
{
|
{
|
||||||
propertyName: "max_target_p",
|
PropertyName: "max_target_p",
|
||||||
propertyValueReader: func(properties *HiddenAPIFlagFileProperties) []string {
|
propertyValueReader: func(properties *HiddenAPIFlagFileProperties) []string {
|
||||||
return properties.Max_target_p
|
return properties.Max_target_p
|
||||||
},
|
},
|
||||||
|
@ -320,7 +320,7 @@ var hiddenAPIFlagFileCategories = []*hiddenAPIFlagFileCategory{
|
||||||
},
|
},
|
||||||
// See HiddenAPIFlagFileProperties.Max_target_o_low_priority
|
// See HiddenAPIFlagFileProperties.Max_target_o_low_priority
|
||||||
{
|
{
|
||||||
propertyName: "max_target_o_low_priority",
|
PropertyName: "max_target_o_low_priority",
|
||||||
propertyValueReader: func(properties *HiddenAPIFlagFileProperties) []string {
|
propertyValueReader: func(properties *HiddenAPIFlagFileProperties) []string {
|
||||||
return properties.Max_target_o_low_priority
|
return properties.Max_target_o_low_priority
|
||||||
},
|
},
|
||||||
|
@ -330,7 +330,7 @@ var hiddenAPIFlagFileCategories = []*hiddenAPIFlagFileCategory{
|
||||||
},
|
},
|
||||||
// See HiddenAPIFlagFileProperties.Blocked
|
// See HiddenAPIFlagFileProperties.Blocked
|
||||||
{
|
{
|
||||||
propertyName: "blocked",
|
PropertyName: "blocked",
|
||||||
propertyValueReader: func(properties *HiddenAPIFlagFileProperties) []string {
|
propertyValueReader: func(properties *HiddenAPIFlagFileProperties) []string {
|
||||||
return properties.Blocked
|
return properties.Blocked
|
||||||
},
|
},
|
||||||
|
@ -340,7 +340,7 @@ var hiddenAPIFlagFileCategories = []*hiddenAPIFlagFileCategory{
|
||||||
},
|
},
|
||||||
// See HiddenAPIFlagFileProperties.Unsupported_packages
|
// See HiddenAPIFlagFileProperties.Unsupported_packages
|
||||||
{
|
{
|
||||||
propertyName: "unsupported_packages",
|
PropertyName: "unsupported_packages",
|
||||||
propertyValueReader: func(properties *HiddenAPIFlagFileProperties) []string {
|
propertyValueReader: func(properties *HiddenAPIFlagFileProperties) []string {
|
||||||
return properties.Unsupported_packages
|
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.
|
// append appends the supplied flags files to the corresponding category in this map.
|
||||||
func (s FlagFilesByCategory) append(other FlagFilesByCategory) {
|
func (s FlagFilesByCategory) append(other FlagFilesByCategory) {
|
||||||
for _, category := range hiddenAPIFlagFileCategories {
|
for _, category := range HiddenAPIFlagFileCategories {
|
||||||
s[category] = append(s[category], other[category]...)
|
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
|
// extractFlagFilesFromProperties extracts the paths to flag files that are specified in the
|
||||||
// supplied properties and stores them in this struct.
|
// supplied properties and stores them in this struct.
|
||||||
func (i *HiddenAPIFlagInput) extractFlagFilesFromProperties(ctx android.ModuleContext, p *HiddenAPIFlagFileProperties) {
|
func (i *HiddenAPIFlagInput) extractFlagFilesFromProperties(ctx android.ModuleContext, p *HiddenAPIFlagFileProperties) {
|
||||||
for _, category := range hiddenAPIFlagFileCategories {
|
for _, category := range HiddenAPIFlagFileCategories {
|
||||||
paths := android.PathsForModuleSrc(ctx, category.propertyValueReader(p))
|
paths := android.PathsForModuleSrc(ctx, category.propertyValueReader(p))
|
||||||
i.FlagFilesByCategory[category] = paths
|
i.FlagFilesByCategory[category] = paths
|
||||||
}
|
}
|
||||||
|
@ -630,7 +630,7 @@ func buildRuleToGenerateHiddenApiFlags(ctx android.BuilderContext, name, desc st
|
||||||
FlagWithOutput("--output ", tempPath)
|
FlagWithOutput("--output ", tempPath)
|
||||||
|
|
||||||
// Add the options for the different categories of flag files.
|
// Add the options for the different categories of flag files.
|
||||||
for _, category := range hiddenAPIFlagFileCategories {
|
for _, category := range HiddenAPIFlagFileCategories {
|
||||||
paths := flagFilesByCategory[category]
|
paths := flagFilesByCategory[category]
|
||||||
for _, path := range paths {
|
for _, path := range paths {
|
||||||
category.commandMutator(command, path)
|
category.commandMutator(command, path)
|
||||||
|
|
|
@ -99,4 +99,4 @@ func (i *MonolithicHiddenAPIInfo) dedup() {
|
||||||
i.AllFlagsPaths = android.FirstUniquePaths(i.AllFlagsPaths)
|
i.AllFlagsPaths = android.FirstUniquePaths(i.AllFlagsPaths)
|
||||||
}
|
}
|
||||||
|
|
||||||
var monolithicHiddenAPIInfoProvider = blueprint.NewProvider(MonolithicHiddenAPIInfo{})
|
var MonolithicHiddenAPIInfoProvider = blueprint.NewProvider(MonolithicHiddenAPIInfo{})
|
||||||
|
|
|
@ -280,7 +280,6 @@ func (b *platformBootclasspathModule) generateHiddenAPIBuildActions(ctx android.
|
||||||
}
|
}
|
||||||
|
|
||||||
monolithicInfo := b.createAndProvideMonolithicHiddenAPIInfo(ctx, fragments)
|
monolithicInfo := b.createAndProvideMonolithicHiddenAPIInfo(ctx, fragments)
|
||||||
|
|
||||||
// Create the input to pass to ruleToGenerateHiddenAPIStubFlagsFile
|
// Create the input to pass to ruleToGenerateHiddenAPIStubFlagsFile
|
||||||
input := newHiddenAPIFlagInput()
|
input := newHiddenAPIFlagInput()
|
||||||
|
|
||||||
|
@ -342,7 +341,7 @@ func (b *platformBootclasspathModule) createAndProvideMonolithicHiddenAPIInfo(ct
|
||||||
monolithicInfo := newMonolithicHiddenAPIInfo(ctx, temporaryInput.FlagFilesByCategory, fragments)
|
monolithicInfo := newMonolithicHiddenAPIInfo(ctx, temporaryInput.FlagFilesByCategory, fragments)
|
||||||
|
|
||||||
// Store the information for testing.
|
// Store the information for testing.
|
||||||
ctx.SetProvider(monolithicHiddenAPIInfoProvider, monolithicInfo)
|
ctx.SetProvider(MonolithicHiddenAPIInfoProvider, monolithicInfo)
|
||||||
return monolithicInfo
|
return monolithicInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -245,10 +245,10 @@ func TestPlatformBootclasspath_Fragments(t *testing.T) {
|
||||||
).RunTest(t)
|
).RunTest(t)
|
||||||
|
|
||||||
pbcp := result.Module("platform-bootclasspath", "android_common")
|
pbcp := result.Module("platform-bootclasspath", "android_common")
|
||||||
info := result.ModuleProvider(pbcp, monolithicHiddenAPIInfoProvider).(MonolithicHiddenAPIInfo)
|
info := result.ModuleProvider(pbcp, MonolithicHiddenAPIInfoProvider).(MonolithicHiddenAPIInfo)
|
||||||
|
|
||||||
for _, category := range hiddenAPIFlagFileCategories {
|
for _, category := range HiddenAPIFlagFileCategories {
|
||||||
name := category.propertyName
|
name := category.PropertyName
|
||||||
message := fmt.Sprintf("category %s", name)
|
message := fmt.Sprintf("category %s", name)
|
||||||
filename := strings.ReplaceAll(name, "_", "-")
|
filename := strings.ReplaceAll(name, "_", "-")
|
||||||
expected := []string{fmt.Sprintf("%s.txt", filename), fmt.Sprintf("bar-%s.txt", filename)}
|
expected := []string{fmt.Sprintf("%s.txt", filename), fmt.Sprintf("bar-%s.txt", filename)}
|
||||||
|
|
Loading…
Reference in a new issue