summaryrefslogtreecommitdiff
path: root/java/bootclasspath_fragment.go
diff options
context:
space:
mode:
author Paul Duffin <paulduffin@google.com> 2021-08-10 16:14:16 +0100
committer Paul Duffin <paulduffin@google.com> 2021-10-01 17:28:13 +0100
commitba68c936305eeec354ad62192173a147eb3e6348 (patch)
tree75bcb68dd8e2a9bdd965ab74a53b7cc70b6a9cef /java/bootclasspath_fragment.go
parentef2df587be53a1a58fc35f195a4226170df17dbb (diff)
Separate hidden API flags needed in sdk snapshots for S and T
Previously, the behavior of the stub_flags and all_flags properties was different between S and T. In S they contained paths for the complete set of stub flags and all the encoded flags. However, in T they contained filtered sets of flags which if used in S would prevent build checks from detecting possible inconsistencies. Also, a new signature_patterns property was added in T that is not supported in S. This change creates separate properties/files for T and reverts the behavior of the properties/files that were added in S back to how they behaved in S. The new properties are called filtered_stub_flags and filtered_flags. The S and T properties are tagged with the appropriate supported_build_releases tag to ensure that they are only output when specifically targeted. Bug: 197842263 Test: m nothing Change-Id: Iec8b9c539796c507245b69c0aed980fde6d8694f
Diffstat (limited to 'java/bootclasspath_fragment.go')
-rw-r--r--java/bootclasspath_fragment.go47
1 files changed, 36 insertions, 11 deletions
diff --git a/java/bootclasspath_fragment.go b/java/bootclasspath_fragment.go
index 79c73ca87..20bbff308 100644
--- a/java/bootclasspath_fragment.go
+++ b/java/bootclasspath_fragment.go
@@ -767,14 +767,20 @@ type bootclasspathFragmentSdkMemberProperties struct {
// The path to the generated index.csv file.
Index_path android.OptionalPath
- // The path to the generated signature-patterns.csv file.
- Signature_patterns_path android.OptionalPath
-
// The path to the generated stub-flags.csv file.
- Stub_flags_path android.OptionalPath
+ Stub_flags_path android.OptionalPath `supported_build_releases:"S"`
// The path to the generated all-flags.csv file.
- All_flags_path android.OptionalPath
+ All_flags_path android.OptionalPath `supported_build_releases:"S"`
+
+ // The path to the generated signature-patterns.csv file.
+ Signature_patterns_path android.OptionalPath `supported_build_releases:"T+"`
+
+ // The path to the generated filtered-stub-flags.csv file.
+ Filtered_stub_flags_path android.OptionalPath `supported_build_releases:"T+"`
+
+ // The path to the generated filtered-flags.csv file.
+ Filtered_flags_path android.OptionalPath `supported_build_releases:"T+"`
}
func (b *bootclasspathFragmentSdkMemberProperties) PopulateFromVariant(ctx android.SdkMemberContext, variant android.Module) {
@@ -793,10 +799,13 @@ func (b *bootclasspathFragmentSdkMemberProperties) PopulateFromVariant(ctx andro
b.Metadata_path = android.OptionalPathForPath(hiddenAPIInfo.MetadataPath)
b.Index_path = android.OptionalPathForPath(hiddenAPIInfo.IndexPath)
- b.Signature_patterns_path = android.OptionalPathForPath(hiddenAPIInfo.SignaturePatternsPath)
b.Stub_flags_path = android.OptionalPathForPath(hiddenAPIInfo.StubFlagsPath)
b.All_flags_path = android.OptionalPathForPath(hiddenAPIInfo.AllFlagsPath)
+ b.Signature_patterns_path = android.OptionalPathForPath(hiddenAPIInfo.SignaturePatternsPath)
+ b.Filtered_stub_flags_path = android.OptionalPathForPath(hiddenAPIInfo.FilteredStubFlagsPath)
+ b.Filtered_flags_path = android.OptionalPathForPath(hiddenAPIInfo.FilteredFlagsPath)
+
// Copy stub_libs properties.
b.Stub_libs = module.properties.Api.Stub_libs
b.Core_platform_stub_libs = module.properties.Core_platform_api.Stub_libs
@@ -861,9 +870,13 @@ func (b *bootclasspathFragmentSdkMemberProperties) AddToPropertySet(ctx android.
copyOptionalPath(b.Annotation_flags_path, "annotation_flags")
copyOptionalPath(b.Metadata_path, "metadata")
copyOptionalPath(b.Index_path, "index")
- copyOptionalPath(b.Signature_patterns_path, "signature_patterns")
+
copyOptionalPath(b.Stub_flags_path, "stub_flags")
copyOptionalPath(b.All_flags_path, "all_flags")
+
+ copyOptionalPath(b.Signature_patterns_path, "signature_patterns")
+ copyOptionalPath(b.Filtered_stub_flags_path, "filtered_stub_flags")
+ copyOptionalPath(b.Filtered_flags_path, "filtered_flags")
}
var _ android.SdkMemberType = (*bootclasspathFragmentMemberType)(nil)
@@ -889,6 +902,12 @@ type prebuiltBootclasspathFragmentProperties struct {
// The path to the all-flags.csv file created by the bootclasspath_fragment.
All_flags *string `android:"path"`
+
+ // The path to the filtered-stub-flags.csv file created by the bootclasspath_fragment.
+ Filtered_stub_flags *string `android:"path"`
+
+ // The path to the filtered-flags.csv file created by the bootclasspath_fragment.
+ Filtered_flags *string `android:"path"`
}
}
@@ -915,7 +934,7 @@ func (module *prebuiltBootclasspathFragmentModule) Name() string {
// produceHiddenAPIOutput returns a path to the prebuilt all-flags.csv or nil if none is specified.
func (module *prebuiltBootclasspathFragmentModule) produceHiddenAPIOutput(ctx android.ModuleContext, contents []android.Module, input HiddenAPIFlagInput) *HiddenAPIOutput {
- pathForOptionalSrc := func(src *string) android.Path {
+ pathForOptionalSrc := func(src *string, defaultPath android.Path) android.Path {
if src == nil {
return nil
}
@@ -938,13 +957,19 @@ func (module *prebuiltBootclasspathFragmentModule) produceHiddenAPIOutput(ctx an
AnnotationFlagsPath: pathForSrc("hidden_api.annotation_flags", module.prebuiltProperties.Hidden_api.Annotation_flags),
MetadataPath: pathForSrc("hidden_api.metadata", module.prebuiltProperties.Hidden_api.Metadata),
IndexPath: pathForSrc("hidden_api.index", module.prebuiltProperties.Hidden_api.Index),
- SignaturePatternsPath: pathForOptionalSrc(module.prebuiltProperties.Hidden_api.Signature_patterns),
- StubFlagsPath: pathForSrc("hidden_api.stub_flags", module.prebuiltProperties.Hidden_api.Stub_flags),
- AllFlagsPath: pathForSrc("hidden_api.all_flags", module.prebuiltProperties.Hidden_api.All_flags),
+ SignaturePatternsPath: pathForOptionalSrc(module.prebuiltProperties.Hidden_api.Signature_patterns, nil),
+ // TODO: Temporarily handle stub_flags/all_flags properties until prebuilts have been updated.
+ StubFlagsPath: pathForOptionalSrc(module.prebuiltProperties.Hidden_api.Stub_flags, nil),
+ AllFlagsPath: pathForOptionalSrc(module.prebuiltProperties.Hidden_api.All_flags, nil),
},
+
EncodedBootDexFilesByModule: encodedBootDexJarsByModule,
}
+ // TODO: Temporarily fallback to stub_flags/all_flags properties until prebuilts have been updated.
+ output.FilteredStubFlagsPath = pathForOptionalSrc(module.prebuiltProperties.Hidden_api.Filtered_stub_flags, output.StubFlagsPath)
+ output.FilteredFlagsPath = pathForOptionalSrc(module.prebuiltProperties.Hidden_api.Filtered_flags, output.AllFlagsPath)
+
return &output
}