Push Hidden_api inside HiddenAPIFlagFileProperties

All usages of HiddenAPIFlagFileProperties use it as the type of a
Hidden_api field. This change pushes the field inside the struct and
just embeds the struct inside the structs that need it making it
simpler and more consistent with how the HiddenApiPackageProperties
struct is used.

This is extracted as a separate change as while the change is simple
it does affect a lot of lines. Keeping it separate makes it easier to
review the changes.

Bug: 240406019
Test: packages/modules/common/build/mainline_modules_sdks.sh
      # Ran the previous command with and without this change to make
      # sure that this change does not change the sdk snapshot
      # contents.
Change-Id: I664453029574ef68dc5712f7bf137a1a6e78e864
This commit is contained in:
Paul Duffin
2022-07-27 16:16:54 +00:00
parent 1e9e9388d8
commit 9b61abbd84
3 changed files with 36 additions and 31 deletions

View File

@@ -128,7 +128,7 @@ type bootclasspathFragmentProperties struct {
Coverage BootclasspathFragmentCoverageAffectedProperties Coverage BootclasspathFragmentCoverageAffectedProperties
// Hidden API related properties. // Hidden API related properties.
Hidden_api HiddenAPIFlagFileProperties HiddenAPIFlagFileProperties
// The list of additional stub libraries which this fragment's contents use but which are not // The list of additional stub libraries which this fragment's contents use but which are not
// provided by another bootclasspath_fragment. // provided by another bootclasspath_fragment.
@@ -825,7 +825,7 @@ func (b *BootclasspathFragmentModule) createHiddenAPIFlagInput(ctx android.Modul
input.gatherStubLibInfo(ctx, contents) input.gatherStubLibInfo(ctx, contents)
// Populate with flag file paths from the properties. // Populate with flag file paths from the properties.
input.extractFlagFilesFromProperties(ctx, &b.properties.Hidden_api) input.extractFlagFilesFromProperties(ctx, &b.properties.HiddenAPIFlagFileProperties)
// Populate with package rules from the properties. // Populate with package rules from the properties.
input.extractPackageRulesFromProperties(&b.sourceOnlyProperties.HiddenAPIPackageProperties) input.extractPackageRulesFromProperties(&b.sourceOnlyProperties.HiddenAPIPackageProperties)

View File

@@ -378,32 +378,37 @@ func buildRuleToGenerateHiddenAPIStubFlagsFile(ctx android.BuilderContext, name,
// with one Java package per line. All members of all classes within that package (but not nested // with one Java package per line. All members of all classes within that package (but not nested
// packages) will be updated in a property specific way. // packages) will be updated in a property specific way.
type HiddenAPIFlagFileProperties struct { type HiddenAPIFlagFileProperties struct {
// Marks each signature in the referenced files as being unsupported. Hidden_api struct {
Unsupported []string `android:"path"` // Marks each signature in the referenced files as being unsupported.
Unsupported []string `android:"path"`
// Marks each signature in the referenced files as being unsupported because it has been removed. // Marks each signature in the referenced files as being unsupported because it has been
// Any conflicts with other flags are ignored. // removed. Any conflicts with other flags are ignored.
Removed []string `android:"path"` Removed []string `android:"path"`
// Marks each signature in the referenced files as being supported only for targetSdkVersion <= R // Marks each signature in the referenced files as being supported only for
// and low priority. // targetSdkVersion <= R and low priority.
Max_target_r_low_priority []string `android:"path"` Max_target_r_low_priority []string `android:"path"`
// Marks each signature in the referenced files as being supported only for targetSdkVersion <= Q. // Marks each signature in the referenced files as being supported only for
Max_target_q []string `android:"path"` // targetSdkVersion <= Q.
Max_target_q []string `android:"path"`
// Marks each signature in the referenced files as being supported only for targetSdkVersion <= P. // Marks each signature in the referenced files as being supported only for
Max_target_p []string `android:"path"` // targetSdkVersion <= P.
Max_target_p []string `android:"path"`
// Marks each signature in the referenced files as being supported only for targetSdkVersion <= O // Marks each signature in the referenced files as being supported only for
// and low priority. Any conflicts with other flags are ignored. // targetSdkVersion <= O
Max_target_o_low_priority []string `android:"path"` // and low priority. Any conflicts with other flags are ignored.
Max_target_o_low_priority []string `android:"path"`
// Marks each signature in the referenced files as being blocked. // Marks each signature in the referenced files as being blocked.
Blocked []string `android:"path"` Blocked []string `android:"path"`
// Marks each signature in every package in the referenced files as being unsupported. // Marks each signature in every package in the referenced files as being unsupported.
Unsupported_packages []string `android:"path"` Unsupported_packages []string `android:"path"`
}
} }
type hiddenAPIFlagFileCategory struct { type hiddenAPIFlagFileCategory struct {
@@ -428,7 +433,7 @@ 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.Hidden_api.Removed
}, },
commandMutator: func(command *android.RuleBuilderCommand, path android.Path) { commandMutator: func(command *android.RuleBuilderCommand, path android.Path) {
command.FlagWithInput("--unsupported ", path).Flag("--ignore-conflicts ").FlagWithArg("--tag ", "removed") command.FlagWithInput("--unsupported ", path).Flag("--ignore-conflicts ").FlagWithArg("--tag ", "removed")
@@ -440,7 +445,7 @@ var HiddenAPIFlagFileCategories = []*hiddenAPIFlagFileCategory{
{ {
PropertyName: "unsupported", PropertyName: "unsupported",
propertyValueReader: func(properties *HiddenAPIFlagFileProperties) []string { propertyValueReader: func(properties *HiddenAPIFlagFileProperties) []string {
return properties.Unsupported return properties.Hidden_api.Unsupported
}, },
commandMutator: func(command *android.RuleBuilderCommand, path android.Path) { commandMutator: func(command *android.RuleBuilderCommand, path android.Path) {
command.FlagWithInput("--unsupported ", path) command.FlagWithInput("--unsupported ", path)
@@ -451,7 +456,7 @@ var HiddenAPIFlagFileCategories = []*hiddenAPIFlagFileCategory{
{ {
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.Hidden_api.Max_target_r_low_priority
}, },
commandMutator: func(command *android.RuleBuilderCommand, path android.Path) { commandMutator: func(command *android.RuleBuilderCommand, path android.Path) {
command.FlagWithInput("--max-target-r ", path).FlagWithArg("--tag ", "lo-prio") command.FlagWithInput("--max-target-r ", path).FlagWithArg("--tag ", "lo-prio")
@@ -461,7 +466,7 @@ var HiddenAPIFlagFileCategories = []*hiddenAPIFlagFileCategory{
{ {
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.Hidden_api.Max_target_q
}, },
commandMutator: func(command *android.RuleBuilderCommand, path android.Path) { commandMutator: func(command *android.RuleBuilderCommand, path android.Path) {
command.FlagWithInput("--max-target-q ", path) command.FlagWithInput("--max-target-q ", path)
@@ -471,7 +476,7 @@ var HiddenAPIFlagFileCategories = []*hiddenAPIFlagFileCategory{
{ {
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.Hidden_api.Max_target_p
}, },
commandMutator: func(command *android.RuleBuilderCommand, path android.Path) { commandMutator: func(command *android.RuleBuilderCommand, path android.Path) {
command.FlagWithInput("--max-target-p ", path) command.FlagWithInput("--max-target-p ", path)
@@ -481,7 +486,7 @@ var HiddenAPIFlagFileCategories = []*hiddenAPIFlagFileCategory{
{ {
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.Hidden_api.Max_target_o_low_priority
}, },
commandMutator: func(command *android.RuleBuilderCommand, path android.Path) { commandMutator: func(command *android.RuleBuilderCommand, path android.Path) {
command.FlagWithInput("--max-target-o ", path).Flag("--ignore-conflicts ").FlagWithArg("--tag ", "lo-prio") command.FlagWithInput("--max-target-o ", path).Flag("--ignore-conflicts ").FlagWithArg("--tag ", "lo-prio")
@@ -491,7 +496,7 @@ var HiddenAPIFlagFileCategories = []*hiddenAPIFlagFileCategory{
{ {
PropertyName: "blocked", PropertyName: "blocked",
propertyValueReader: func(properties *HiddenAPIFlagFileProperties) []string { propertyValueReader: func(properties *HiddenAPIFlagFileProperties) []string {
return properties.Blocked return properties.Hidden_api.Blocked
}, },
commandMutator: func(command *android.RuleBuilderCommand, path android.Path) { commandMutator: func(command *android.RuleBuilderCommand, path android.Path) {
command.FlagWithInput("--blocked ", path) command.FlagWithInput("--blocked ", path)
@@ -501,7 +506,7 @@ var HiddenAPIFlagFileCategories = []*hiddenAPIFlagFileCategory{
{ {
PropertyName: "unsupported_packages", PropertyName: "unsupported_packages",
propertyValueReader: func(properties *HiddenAPIFlagFileProperties) []string { propertyValueReader: func(properties *HiddenAPIFlagFileProperties) []string {
return properties.Unsupported_packages return properties.Hidden_api.Unsupported_packages
}, },
commandMutator: func(command *android.RuleBuilderCommand, path android.Path) { commandMutator: func(command *android.RuleBuilderCommand, path android.Path) {
command.FlagWithInput("--unsupported ", path).Flag("--packages ") command.FlagWithInput("--unsupported ", path).Flag("--packages ")

View File

@@ -62,7 +62,7 @@ type platformBootclasspathModule struct {
type platformBootclasspathProperties struct { type platformBootclasspathProperties struct {
BootclasspathFragmentsDepsProperties BootclasspathFragmentsDepsProperties
Hidden_api HiddenAPIFlagFileProperties HiddenAPIFlagFileProperties
} }
func platformBootclasspathFactory() android.SingletonModule { func platformBootclasspathFactory() android.SingletonModule {
@@ -372,7 +372,7 @@ func (b *platformBootclasspathModule) createAndProvideMonolithicHiddenAPIInfo(ct
temporaryInput := newHiddenAPIFlagInput() temporaryInput := newHiddenAPIFlagInput()
// Create paths to the flag files specified in the properties. // Create paths to the flag files specified in the properties.
temporaryInput.extractFlagFilesFromProperties(ctx, &b.properties.Hidden_api) temporaryInput.extractFlagFilesFromProperties(ctx, &b.properties.HiddenAPIFlagFileProperties)
// Create the monolithic info, by starting with the flag files specified on this and then merging // Create the monolithic info, by starting with the flag files specified on this and then merging
// in information from all the fragment dependencies of this. // in information from all the fragment dependencies of this.