diff --git a/java/bootclasspath_fragment.go b/java/bootclasspath_fragment.go index d8c5453d5..ec61e7094 100644 --- a/java/bootclasspath_fragment.go +++ b/java/bootclasspath_fragment.go @@ -120,6 +120,15 @@ type BootclasspathFragmentModule struct { properties bootclasspathFragmentProperties } +// commonBootclasspathFragment defines the methods that are implemented by both source and prebuilt +// bootclasspath fragment modules. +type commonBootclasspathFragment interface { + // produceHiddenAPIAllFlagsFile produces the all-flags.csv and intermediate files. + // + // Updates the supplied flagFileInfo with the paths to the generated files set. + produceHiddenAPIAllFlagsFile(ctx android.ModuleContext, contents []android.Module, stubJarsByKind map[android.SdkKind]android.Paths, flagFileInfo *hiddenAPIFlagFileInfo) +} + func bootclasspathFragmentFactory() android.Module { m := &BootclasspathFragmentModule{} m.AddProperties(&m.properties) @@ -381,7 +390,7 @@ func (b *BootclasspathFragmentModule) GenerateAndroidBuildActions(ctx android.Mo }) // Perform hidden API processing. - b.generateHiddenAPIBuildActions(ctx) + b.generateHiddenAPIBuildActions(ctx, contents) // Construct the boot image info from the config. info := BootclasspathFragmentApexContentInfo{ @@ -441,12 +450,7 @@ func (b *BootclasspathFragmentModule) getImageConfig(ctx android.EarlyModuleCont } // generateHiddenAPIBuildActions generates all the hidden API related build rules. -func (b *BootclasspathFragmentModule) generateHiddenAPIBuildActions(ctx android.ModuleContext) { - // Resolve the properties to paths. - flagFileInfo := b.properties.Hidden_api.hiddenAPIFlagFileInfo(ctx) - - // Store the information for use by platform_bootclasspath. - ctx.SetProvider(hiddenAPIFlagFileInfoProvider, flagFileInfo) +func (b *BootclasspathFragmentModule) generateHiddenAPIBuildActions(ctx android.ModuleContext, contents []android.Module) { // Convert the kind specific lists of modules into kind specific lists of jars. stubJarsByKind := hiddenAPIGatherStubLibDexJarPaths(ctx) @@ -454,6 +458,33 @@ func (b *BootclasspathFragmentModule) generateHiddenAPIBuildActions(ctx android. // Store the information for use by other modules. bootclasspathApiInfo := bootclasspathApiInfo{stubJarsByKind: stubJarsByKind} ctx.SetProvider(bootclasspathApiInfoProvider, bootclasspathApiInfo) + + // Resolve the properties to paths. + flagFileInfo := b.properties.Hidden_api.hiddenAPIFlagFileInfo(ctx) + + // Delegate the production of the hidden API all flags file to a module type specific method. + common := ctx.Module().(commonBootclasspathFragment) + common.produceHiddenAPIAllFlagsFile(ctx, contents, stubJarsByKind, &flagFileInfo) + + // Store the information for use by platform_bootclasspath. + ctx.SetProvider(hiddenAPIFlagFileInfoProvider, flagFileInfo) +} + +// produceHiddenAPIAllFlagsFile produces the hidden API all-flags.csv file (and supporting files) +// for the fragment. +func (b *BootclasspathFragmentModule) produceHiddenAPIAllFlagsFile(ctx android.ModuleContext, contents []android.Module, stubJarsByKind map[android.SdkKind]android.Paths, flagFileInfo *hiddenAPIFlagFileInfo) { + // If no stubs have been provided then don't perform hidden API processing. This is a temporary + // workaround to avoid existing bootclasspath_fragments that do not provide stubs breaking the + // build. + // TODO(b/179354495): Remove this workaround. + if len(stubJarsByKind) == 0 { + // Nothing to do. + return + } + + // Generate the rules to create the hidden API flags and update the supplied flagFileInfo with the + // paths to the created files. + hiddenAPIGenerateAllFlagsForBootclasspathFragment(ctx, contents, stubJarsByKind, flagFileInfo) } // generateBootImageBuildActions generates ninja rules to create the boot image if required for this @@ -534,6 +565,32 @@ type bootclasspathFragmentSdkMemberProperties struct { // Flag files by *hiddenAPIFlagFileCategory Flag_files_by_category map[*hiddenAPIFlagFileCategory]android.Paths + + // The path to the generated stub-flags.csv file. + Stub_flags_path android.OptionalPath + + // The path to the generated annotation-flags.csv file. + Annotation_flags_path android.OptionalPath + + // The path to the generated metadata.csv file. + Metadata_path android.OptionalPath + + // The path to the generated index.csv file. + Index_path android.OptionalPath + + // The path to the generated all-flags.csv file. + All_flags_path android.OptionalPath +} + +func pathsToOptionalPath(paths android.Paths) android.OptionalPath { + switch len(paths) { + case 0: + return android.OptionalPath{} + case 1: + return android.OptionalPathForPath(paths[0]) + default: + panic(fmt.Errorf("expected 0 or 1 paths, found %q", paths)) + } } func (b *bootclasspathFragmentSdkMemberProperties) PopulateFromVariant(ctx android.SdkMemberContext, variant android.Module) { @@ -547,6 +604,13 @@ func (b *bootclasspathFragmentSdkMemberProperties) PopulateFromVariant(ctx andro flagFileInfo := mctx.OtherModuleProvider(module, hiddenAPIFlagFileInfoProvider).(hiddenAPIFlagFileInfo) b.Flag_files_by_category = flagFileInfo.categoryToPaths + // Copy all the generated file paths. + b.Stub_flags_path = pathsToOptionalPath(flagFileInfo.StubFlagsPaths) + b.Annotation_flags_path = pathsToOptionalPath(flagFileInfo.AnnotationFlagsPaths) + b.Metadata_path = pathsToOptionalPath(flagFileInfo.MetadataPaths) + b.Index_path = pathsToOptionalPath(flagFileInfo.IndexPaths) + b.All_flags_path = pathsToOptionalPath(flagFileInfo.AllFlagsPaths) + // Copy stub_libs properties. b.Stub_libs = module.properties.Api.Stub_libs b.Core_platform_stub_libs = module.properties.Core_platform_api.Stub_libs @@ -573,14 +637,17 @@ func (b *bootclasspathFragmentSdkMemberProperties) AddToPropertySet(ctx android. corePlatformApiPropertySet.AddPropertyWithTag("stub_libs", b.Core_platform_stub_libs, requiredMemberDependency) } + hiddenAPISet := propertySet.AddPropertySet("hidden_api") + hiddenAPIDir := "hiddenapi" + + // Copy manually curated flag files specified on the bootclasspath_fragment. if b.Flag_files_by_category != nil { - hiddenAPISet := propertySet.AddPropertySet("hidden_api") for _, category := range hiddenAPIFlagFileCategories { paths := b.Flag_files_by_category[category] if len(paths) > 0 { dests := []string{} for _, p := range paths { - dest := filepath.Join("hiddenapi", p.Base()) + dest := filepath.Join(hiddenAPIDir, p.Base()) builder.CopyToSnapshot(p, dest) dests = append(dests, dest) } @@ -588,10 +655,47 @@ func (b *bootclasspathFragmentSdkMemberProperties) AddToPropertySet(ctx android. } } } + + copyOptionalPath := func(path android.OptionalPath, property string) { + if path.Valid() { + p := path.Path() + dest := filepath.Join(hiddenAPIDir, p.Base()) + builder.CopyToSnapshot(p, dest) + hiddenAPISet.AddProperty(property, dest) + } + } + + // Copy all the generated files, if available. + copyOptionalPath(b.Stub_flags_path, "stub_flags") + copyOptionalPath(b.Annotation_flags_path, "annotation_flags") + copyOptionalPath(b.Metadata_path, "metadata") + copyOptionalPath(b.Index_path, "index") + copyOptionalPath(b.All_flags_path, "all_flags") } var _ android.SdkMemberType = (*bootclasspathFragmentMemberType)(nil) +// prebuiltBootclasspathFragmentProperties contains additional prebuilt_bootclasspath_fragment +// specific properties. +type prebuiltBootclasspathFragmentProperties struct { + Hidden_api struct { + // The path to the stub-flags.csv file created by the bootclasspath_fragment. + Stub_flags *string `android:"path"` + + // The path to the annotation-flags.csv file created by the bootclasspath_fragment. + Annotation_flags *string `android:"path"` + + // The path to the metadata.csv file created by the bootclasspath_fragment. + Metadata *string `android:"path"` + + // The path to the index.csv file created by the bootclasspath_fragment. + Index *string `android:"path"` + + // The path to the all-flags.csv file created by the bootclasspath_fragment. + All_flags *string `android:"path"` + } +} + // A prebuilt version of the bootclasspath_fragment module. // // At the moment this is basically just a bootclasspath_fragment module that can be used as a @@ -600,6 +704,9 @@ var _ android.SdkMemberType = (*bootclasspathFragmentMemberType)(nil) type prebuiltBootclasspathFragmentModule struct { BootclasspathFragmentModule prebuilt android.Prebuilt + + // Additional prebuilt specific properties. + prebuiltProperties prebuiltBootclasspathFragmentProperties } func (module *prebuiltBootclasspathFragmentModule) Prebuilt() *android.Prebuilt { @@ -610,9 +717,29 @@ func (module *prebuiltBootclasspathFragmentModule) Name() string { return module.prebuilt.Name(module.ModuleBase.Name()) } +// produceHiddenAPIAllFlagsFile returns a path to the prebuilt all-flags.csv or nil if none is +// specified. +func (module *prebuiltBootclasspathFragmentModule) produceHiddenAPIAllFlagsFile(ctx android.ModuleContext, _ []android.Module, _ map[android.SdkKind]android.Paths, flagFileInfo *hiddenAPIFlagFileInfo) { + pathsForOptionalSrc := func(src *string) android.Paths { + if src == nil { + // TODO(b/179354495): Fail if this is not provided once prebuilts have been updated. + return nil + } + return android.Paths{android.PathForModuleSrc(ctx, *src)} + } + + flagFileInfo.StubFlagsPaths = pathsForOptionalSrc(module.prebuiltProperties.Hidden_api.Stub_flags) + flagFileInfo.AnnotationFlagsPaths = pathsForOptionalSrc(module.prebuiltProperties.Hidden_api.Annotation_flags) + flagFileInfo.MetadataPaths = pathsForOptionalSrc(module.prebuiltProperties.Hidden_api.Metadata) + flagFileInfo.IndexPaths = pathsForOptionalSrc(module.prebuiltProperties.Hidden_api.Index) + flagFileInfo.AllFlagsPaths = pathsForOptionalSrc(module.prebuiltProperties.Hidden_api.All_flags) +} + +var _ commonBootclasspathFragment = (*prebuiltBootclasspathFragmentModule)(nil) + func prebuiltBootclasspathFragmentFactory() android.Module { m := &prebuiltBootclasspathFragmentModule{} - m.AddProperties(&m.properties) + m.AddProperties(&m.properties, &m.prebuiltProperties) // This doesn't actually have any prebuilt files of its own so pass a placeholder for the srcs // array. android.InitPrebuiltModule(m, &[]string{"placeholder"}) diff --git a/java/hiddenapi_modular.go b/java/hiddenapi_modular.go index 335f5b861..817452499 100644 --- a/java/hiddenapi_modular.go +++ b/java/hiddenapi_modular.go @@ -166,7 +166,7 @@ var sdkKindToHiddenapiListOption = map[android.SdkKind]string{ // // The rule is initialized but not built so that the caller can modify it and select an appropriate // name. -func ruleToGenerateHiddenAPIStubFlagsFile(ctx android.BuilderContext, outputPath android.OutputPath, bootDexJars android.Paths, sdkKindToPathList map[android.SdkKind]android.Paths) *android.RuleBuilder { +func ruleToGenerateHiddenAPIStubFlagsFile(ctx android.BuilderContext, outputPath android.WritablePath, bootDexJars android.Paths, sdkKindToPathList map[android.SdkKind]android.Paths) *android.RuleBuilder { // Singleton rule which applies hiddenapi on all boot class path dex files. rule := android.NewRuleBuilder(pctx, ctx) @@ -338,23 +338,49 @@ var hiddenAPIFlagFileCategories = []*hiddenAPIFlagFileCategory{ }, } -// hiddenAPIFlagFileInfo contains paths resolved from HiddenAPIFlagFileProperties +// hiddenAPIFlagFileInfo contains paths resolved from HiddenAPIFlagFileProperties and also generated +// by 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 { // categoryToPaths maps from the flag file category to the paths containing information for that // category. categoryToPaths map[*hiddenAPIFlagFileCategory]android.Paths + + // The paths to the generated stub-flags.csv files. + StubFlagsPaths android.Paths + + // The paths to the generated annotation-flags.csv files. + AnnotationFlagsPaths android.Paths + + // The paths to the generated metadata.csv files. + MetadataPaths android.Paths + + // The paths to the generated index.csv files. + IndexPaths android.Paths + + // The paths to the generated all-flags.csv files. + AllFlagsPaths android.Paths } func (i *hiddenAPIFlagFileInfo) append(other hiddenAPIFlagFileInfo) { for _, category := range hiddenAPIFlagFileCategories { i.categoryToPaths[category] = append(i.categoryToPaths[category], other.categoryToPaths[category]...) } + i.StubFlagsPaths = append(i.StubFlagsPaths, other.StubFlagsPaths...) + i.AnnotationFlagsPaths = append(i.AnnotationFlagsPaths, other.AnnotationFlagsPaths...) + i.MetadataPaths = append(i.MetadataPaths, other.MetadataPaths...) + i.IndexPaths = append(i.IndexPaths, other.IndexPaths...) + i.AllFlagsPaths = append(i.AllFlagsPaths, other.AllFlagsPaths...) } var hiddenAPIFlagFileInfoProvider = blueprint.NewProvider(hiddenAPIFlagFileInfo{}) -// ruleToGenerateHiddenApiFlags creates a rule to create the monolithic hidden API flags from the -// flags from all the modules, the stub flags, augmented with some additional configuration files. +// buildRuleToGenerateHiddenApiFlags creates a rule to create the monolithic hidden API flags from +// the flags from all the modules, the stub flags, augmented with some additional configuration +// files. // // baseFlagsPath is the path to the flags file containing all the information from the stubs plus // an entry for every single member in the dex implementation jars of the individual modules. Every @@ -365,19 +391,7 @@ var hiddenAPIFlagFileInfoProvider = blueprint.NewProvider(hiddenAPIFlagFileInfo{ // // augmentationInfo is a struct containing paths to files that augment the information provided by // the moduleSpecificFlagsPaths. -// ruleToGenerateHiddenApiFlags creates a rule to create the monolithic hidden API flags from the -// flags from all the modules, the stub flags, augmented with some additional configuration files. -// -// baseFlagsPath is the path to the flags file containing all the information from the stubs plus -// an entry for every single member in the dex implementation jars of the individual modules. Every -// signature in any of the other files MUST be included in this file. -// -// moduleSpecificFlagsPaths are the paths to the flags files generated by each module using -// information from the baseFlagsPath as well as from annotations within the source. -// -// augmentationInfo is a struct containing paths to files that augment the information provided by -// the moduleSpecificFlagsPaths. -func ruleToGenerateHiddenApiFlags(ctx android.BuilderContext, outputPath android.WritablePath, baseFlagsPath android.Path, moduleSpecificFlagsPaths android.Paths, augmentationInfo hiddenAPIFlagFileInfo) { +func buildRuleToGenerateHiddenApiFlags(ctx android.BuilderContext, name, desc string, outputPath android.WritablePath, baseFlagsPath android.Path, moduleSpecificFlagsPaths android.Paths, flagFileInfo *hiddenAPIFlagFileInfo) { tempPath := tempPathForRestat(ctx, outputPath) rule := android.NewRuleBuilder(pctx, ctx) command := rule.Command(). @@ -388,7 +402,7 @@ func ruleToGenerateHiddenApiFlags(ctx android.BuilderContext, outputPath android // Add the options for the different categories of flag files. for _, category := range hiddenAPIFlagFileCategories { - paths := augmentationInfo.categoryToPaths[category] + paths := flagFileInfo.categoryToPaths[category] for _, path := range paths { category.commandMutator(command, path) } @@ -396,5 +410,103 @@ func ruleToGenerateHiddenApiFlags(ctx android.BuilderContext, outputPath android commitChangeForRestat(rule, tempPath, outputPath) - rule.Build("hiddenAPIFlagsFile", "hiddenapi flags") + rule.Build(name, desc) +} + +// hiddenAPIGenerateAllFlagsForBootclasspathFragment will generate all the flags for a fragment +// of the bootclasspath. +// +// It takes: +// * Map from android.SdkKind to stub dex jar paths defining the API for that sdk kind. +// * The list of modules that are the contents of the fragment. +// * The additional manually curated flag files to use. +// +// It generates: +// * stub-flags.csv +// * annotation-flags.csv +// * metadata.csv +// * index.csv +// * all-flags.csv +func hiddenAPIGenerateAllFlagsForBootclasspathFragment(ctx android.ModuleContext, contents []android.Module, stubJarsByKind map[android.SdkKind]android.Paths, flagFileInfo *hiddenAPIFlagFileInfo) { + + hiddenApiSubDir := "modular-hiddenapi" + + bootDexJars := android.Paths{} + classesJars := android.Paths{} + for _, module := range contents { + if hiddenAPI, ok := module.(hiddenAPIIntf); ok { + classesJars = append(classesJars, hiddenAPI.classesJars()...) + bootDexJar := hiddenAPI.bootDexJar() + if bootDexJar == nil { + ctx.ModuleErrorf("module %s does not provide a dex jar", module) + } else { + bootDexJars = append(bootDexJars, bootDexJar) + } + } else { + ctx.ModuleErrorf("module %s does not implement hiddenAPIIntf", module) + } + } + + // Generate the stub-flags.csv. + stubFlagsCSV := android.PathForModuleOut(ctx, hiddenApiSubDir, "stub-flags.csv") + rule := ruleToGenerateHiddenAPIStubFlagsFile(ctx, stubFlagsCSV, bootDexJars, stubJarsByKind) + rule.Build("modularHiddenAPIStubFlagsFile", "modular hiddenapi stub flags") + + // Generate the set of flags from the annotations in the source code. + annotationFlagsCSV := android.PathForModuleOut(ctx, hiddenApiSubDir, "annotation-flags.csv") + ctx.Build(pctx, android.BuildParams{ + Rule: hiddenAPIGenerateCSVRule, + Description: "modular hiddenapi annotation flags", + Inputs: classesJars, + Output: annotationFlagsCSV, + Implicit: stubFlagsCSV, + Args: map[string]string{ + "outFlag": "--write-flags-csv", + "stubAPIFlags": stubFlagsCSV.String(), + }, + }) + + // Generate the metadata from the annotations in the source code. + metadataCSV := android.PathForModuleOut(ctx, hiddenApiSubDir, "metadata.csv") + ctx.Build(pctx, android.BuildParams{ + Rule: hiddenAPIGenerateCSVRule, + Description: "modular hiddenapi metadata", + Inputs: classesJars, + Output: metadataCSV, + Implicit: stubFlagsCSV, + Args: map[string]string{ + "outFlag": "--write-metadata-csv", + "stubAPIFlags": stubFlagsCSV.String(), + }, + }) + + // Generate the index file from the annotations in the source code. + indexCSV := android.PathForModuleOut(ctx, hiddenApiSubDir, "index.csv") + rule = android.NewRuleBuilder(pctx, ctx) + rule.Command(). + BuiltTool("merge_csv"). + Flag("--zip_input"). + Flag("--key_field signature"). + FlagWithOutput("--output=", indexCSV). + Inputs(classesJars) + rule.Build("modular-hiddenapi-index", "modular hiddenapi index") + + // Removed APIs need to be marked and in order to do that the flagFileInfo 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. + // For now removed APIs are ignored. + // TODO(b/179354495): handle removed apis automatically. + + // Generate the all-flags.csv which are the flags that will, in future, be encoded into the dex + // files. + outputPath := android.PathForModuleOut(ctx, hiddenApiSubDir, "all-flags.csv") + buildRuleToGenerateHiddenApiFlags(ctx, "modularHiddenApiAllFlags", "modular hiddenapi all flags", outputPath, stubFlagsCSV, android.Paths{annotationFlagsCSV}, flagFileInfo) + + // Store the paths in the info for use by other modules and sdk snapshot generation. + flagFileInfo.StubFlagsPaths = android.Paths{stubFlagsCSV} + flagFileInfo.AnnotationFlagsPaths = android.Paths{annotationFlagsCSV} + flagFileInfo.MetadataPaths = android.Paths{metadataCSV} + flagFileInfo.IndexPaths = android.Paths{indexCSV} + flagFileInfo.AllFlagsPaths = android.Paths{outputPath} } diff --git a/java/platform_bootclasspath.go b/java/platform_bootclasspath.go index 1feed3ddd..b5fec95fe 100644 --- a/java/platform_bootclasspath.go +++ b/java/platform_bootclasspath.go @@ -364,7 +364,7 @@ func (b *platformBootclasspathModule) generateHiddenAPIBuildActions(ctx android. outputPath := hiddenAPISingletonPaths(ctx).flags baseFlagsPath := hiddenAPISingletonPaths(ctx).stubFlags - ruleToGenerateHiddenApiFlags(ctx, outputPath, baseFlagsPath, moduleSpecificFlagsPaths, flagFileInfo) + buildRuleToGenerateHiddenApiFlags(ctx, "hiddenAPIFlagsFile", "hiddenapi flags", outputPath, baseFlagsPath, moduleSpecificFlagsPaths, &flagFileInfo) b.generateHiddenAPIStubFlagsRules(ctx, hiddenAPISupportingModules) b.generateHiddenAPIIndexRules(ctx, hiddenAPISupportingModules) diff --git a/java/platform_bootclasspath_test.go b/java/platform_bootclasspath_test.go index 98d46143c..cf2eab370 100644 --- a/java/platform_bootclasspath_test.go +++ b/java/platform_bootclasspath_test.go @@ -155,6 +155,8 @@ func TestPlatformBootclasspath(t *testing.T) { func TestPlatformBootclasspath_Fragments(t *testing.T) { result := android.GroupFixturePreparers( prepareForTestWithPlatformBootclasspath, + PrepareForTestWithJavaSdkLibraryFiles, + FixtureWithLastReleaseApis("foo"), android.FixtureWithRootAndroidBp(` platform_bootclasspath { name: "platform-bootclasspath", @@ -192,6 +194,9 @@ func TestPlatformBootclasspath_Fragments(t *testing.T) { bootclasspath_fragment { name: "bar-fragment", contents: ["bar"], + api: { + stub_libs: ["foo"], + }, hidden_api: { unsupported: [ "bar-unsupported.txt", @@ -227,6 +232,15 @@ func TestPlatformBootclasspath_Fragments(t *testing.T) { sdk_version: "none", compile_dex: true, } + + java_sdk_library { + name: "foo", + srcs: ["a.java"], + public: { + enabled: true, + }, + compile_dex: true, + } `), ).RunTest(t) @@ -240,6 +254,12 @@ func TestPlatformBootclasspath_Fragments(t *testing.T) { expected := []string{fmt.Sprintf("%s.txt", filename), fmt.Sprintf("bar-%s.txt", filename)} android.AssertPathsRelativeToTopEquals(t, message, expected, info.categoryToPaths[category]) } + + android.AssertPathsRelativeToTopEquals(t, "stub flags", []string{"out/soong/.intermediates/bar-fragment/android_common/modular-hiddenapi/stub-flags.csv"}, info.StubFlagsPaths) + android.AssertPathsRelativeToTopEquals(t, "annotation flags", []string{"out/soong/.intermediates/bar-fragment/android_common/modular-hiddenapi/annotation-flags.csv"}, info.AnnotationFlagsPaths) + android.AssertPathsRelativeToTopEquals(t, "metadata flags", []string{"out/soong/.intermediates/bar-fragment/android_common/modular-hiddenapi/metadata.csv"}, info.MetadataPaths) + android.AssertPathsRelativeToTopEquals(t, "index flags", []string{"out/soong/.intermediates/bar-fragment/android_common/modular-hiddenapi/index.csv"}, info.IndexPaths) + android.AssertPathsRelativeToTopEquals(t, "all flags", []string{"out/soong/.intermediates/bar-fragment/android_common/modular-hiddenapi/all-flags.csv"}, info.AllFlagsPaths) } func TestPlatformBootclasspathVariant(t *testing.T) { diff --git a/sdk/bootclasspath_fragment_sdk_test.go b/sdk/bootclasspath_fragment_sdk_test.go index 711fe4d62..bd69f06f2 100644 --- a/sdk/bootclasspath_fragment_sdk_test.go +++ b/sdk/bootclasspath_fragment_sdk_test.go @@ -246,6 +246,13 @@ prebuilt_bootclasspath_fragment { core_platform_api: { stub_libs: ["mycoreplatform"], }, + hidden_api: { + stub_flags: "hiddenapi/stub-flags.csv", + annotation_flags: "hiddenapi/annotation-flags.csv", + metadata: "hiddenapi/metadata.csv", + index: "hiddenapi/index.csv", + all_flags: "hiddenapi/all-flags.csv", + }, } java_import { @@ -319,6 +326,13 @@ prebuilt_bootclasspath_fragment { core_platform_api: { stub_libs: ["mysdk_mycoreplatform@current"], }, + hidden_api: { + stub_flags: "hiddenapi/stub-flags.csv", + annotation_flags: "hiddenapi/annotation-flags.csv", + metadata: "hiddenapi/metadata.csv", + index: "hiddenapi/index.csv", + all_flags: "hiddenapi/all-flags.csv", + }, } java_import { @@ -387,6 +401,11 @@ sdk_snapshot { } `), checkAllCopyRules(` +.intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/stub-flags.csv -> hiddenapi/stub-flags.csv +.intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/annotation-flags.csv -> hiddenapi/annotation-flags.csv +.intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/metadata.csv -> hiddenapi/metadata.csv +.intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/index.csv -> hiddenapi/index.csv +.intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/all-flags.csv -> hiddenapi/all-flags.csv .intermediates/mybootlib/android_common/javac/mybootlib.jar -> java/mybootlib.jar .intermediates/myothersdklibrary.stubs/android_common/javac/myothersdklibrary.stubs.jar -> sdk_library/public/myothersdklibrary-stubs.jar .intermediates/myothersdklibrary.stubs.source/android_common/metalava/myothersdklibrary.stubs.source_api.txt -> sdk_library/public/myothersdklibrary.txt @@ -542,6 +561,11 @@ prebuilt_bootclasspath_fragment { max_target_o_low_priority: ["hiddenapi/my-max-target-o-low-priority.txt"], blocked: ["hiddenapi/my-blocked.txt"], unsupported_packages: ["hiddenapi/my-unsupported-packages.txt"], + stub_flags: "hiddenapi/stub-flags.csv", + annotation_flags: "hiddenapi/annotation-flags.csv", + metadata: "hiddenapi/metadata.csv", + index: "hiddenapi/index.csv", + all_flags: "hiddenapi/all-flags.csv", }, } @@ -578,6 +602,11 @@ my-max-target-p.txt -> hiddenapi/my-max-target-p.txt my-max-target-o-low-priority.txt -> hiddenapi/my-max-target-o-low-priority.txt my-blocked.txt -> hiddenapi/my-blocked.txt my-unsupported-packages.txt -> hiddenapi/my-unsupported-packages.txt +.intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/stub-flags.csv -> hiddenapi/stub-flags.csv +.intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/annotation-flags.csv -> hiddenapi/annotation-flags.csv +.intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/metadata.csv -> hiddenapi/metadata.csv +.intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/index.csv -> hiddenapi/index.csv +.intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/all-flags.csv -> hiddenapi/all-flags.csv .intermediates/mybootlib/android_common/javac/mybootlib.jar -> java/mybootlib.jar .intermediates/mysdklibrary.stubs/android_common/javac/mysdklibrary.stubs.jar -> sdk_library/public/mysdklibrary-stubs.jar .intermediates/mysdklibrary.stubs.source/android_common/metalava/mysdklibrary.stubs.source_api.txt -> sdk_library/public/mysdklibrary.txt