diff options
Diffstat (limited to 'java/hiddenapi_modular.go')
-rw-r--r-- | java/hiddenapi_modular.go | 55 |
1 files changed, 26 insertions, 29 deletions
diff --git a/java/hiddenapi_modular.go b/java/hiddenapi_modular.go index 7b678037c..08e684c3b 100644 --- a/java/hiddenapi_modular.go +++ b/java/hiddenapi_modular.go @@ -1116,8 +1116,8 @@ func buildRuleValidateOverlappingCsvFiles(ctx android.BuilderContext, name strin return validFile } -// hiddenAPIRulesForBootclasspathFragment will generate all the flags for a fragment of the -// bootclasspath and then encode the flags into the boot dex files. +// hiddenAPIFlagRulesForBootclasspathFragment 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. @@ -1130,13 +1130,9 @@ func buildRuleValidateOverlappingCsvFiles(ctx android.BuilderContext, name strin // * metadata.csv // * index.csv // * all-flags.csv -// * encoded boot dex files -func hiddenAPIRulesForBootclasspathFragment(ctx android.ModuleContext, contents []android.Module, input HiddenAPIFlagInput) *HiddenAPIOutput { +func hiddenAPIFlagRulesForBootclasspathFragment(ctx android.ModuleContext, bootDexInfoByModule bootDexInfoByModule, contents []android.Module, input HiddenAPIFlagInput) HiddenAPIFlagOutput { hiddenApiSubDir := "modular-hiddenapi" - // Gather information about the boot dex files for the boot libraries provided by this fragment. - bootDexInfoByModule := extractBootDexInfoFromModules(ctx, contents) - // Generate the stub-flags.csv. stubFlagsCSV := android.PathForModuleOut(ctx, hiddenApiSubDir, "stub-flags.csv") buildRuleToGenerateHiddenAPIStubFlagsFile(ctx, "modularHiddenAPIStubFlagsFile", "modular hiddenapi stub flags", stubFlagsCSV, bootDexInfoByModule.bootDexJars(), input, nil) @@ -1169,16 +1165,6 @@ func hiddenAPIRulesForBootclasspathFragment(ctx android.ModuleContext, contents allFlagsCSV := android.PathForModuleOut(ctx, hiddenApiSubDir, "all-flags.csv") buildRuleToGenerateHiddenApiFlags(ctx, "modularHiddenApiAllFlags", "modular hiddenapi all flags", allFlagsCSV, stubFlagsCSV, android.Paths{annotationFlagsCSV}, input.FlagFilesByCategory, nil, removedDexSignatures) - // Encode the flags into the boot dex files. - encodedBootDexJarsByModule := map[string]android.Path{} - outputDir := android.PathForModuleOut(ctx, "hiddenapi-modular/encoded").OutputPath - for _, name := range android.SortedStringKeys(bootDexInfoByModule) { - bootDexInfo := bootDexInfoByModule[name] - unencodedDex := bootDexInfo.path - encodedDex := hiddenAPIEncodeDex(ctx, unencodedDex, allFlagsCSV, bootDexInfo.uncompressDex, bootDexInfo.minSdkVersion, outputDir) - encodedBootDexJarsByModule[name] = encodedDex - } - // Generate the filtered-stub-flags.csv file which contains the filtered stub flags that will be // compared against the monolithic stub flags. filteredStubFlagsCSV := android.PathForModuleOut(ctx, hiddenApiSubDir, "filtered-stub-flags.csv") @@ -1194,19 +1180,30 @@ func hiddenAPIRulesForBootclasspathFragment(ctx android.ModuleContext, contents HIDDENAPI_FLAGS_CSV_IMPL_FLAGS) // Store the paths in the info for use by other modules and sdk snapshot generation. - output := HiddenAPIOutput{ - HiddenAPIFlagOutput: HiddenAPIFlagOutput{ - AnnotationFlagsPath: annotationFlagsCSV, - MetadataPath: metadataCSV, - IndexPath: indexCSV, - StubFlagsPath: stubFlagsCSV, - AllFlagsPath: allFlagsCSV, - FilteredStubFlagsPath: filteredStubFlagsCSV, - FilteredFlagsPath: filteredFlagsCSV, - }, - EncodedBootDexFilesByModule: encodedBootDexJarsByModule, + return HiddenAPIFlagOutput{ + AnnotationFlagsPath: annotationFlagsCSV, + MetadataPath: metadataCSV, + IndexPath: indexCSV, + StubFlagsPath: stubFlagsCSV, + AllFlagsPath: allFlagsCSV, + FilteredStubFlagsPath: filteredStubFlagsCSV, + FilteredFlagsPath: filteredFlagsCSV, + } +} + +// hiddenAPIEncodeRulesForBootclasspathFragment generates rules to encode hidden API flags into the +// dex jars in bootDexInfoByModule. +func hiddenAPIEncodeRulesForBootclasspathFragment(ctx android.ModuleContext, bootDexInfoByModule bootDexInfoByModule, allFlagsCSV android.Path) bootDexJarByModule { + // Encode the flags into the boot dex files. + encodedBootDexJarsByModule := bootDexJarByModule{} + outputDir := android.PathForModuleOut(ctx, "hiddenapi-modular/encoded").OutputPath + for _, name := range android.SortedStringKeys(bootDexInfoByModule) { + bootDexInfo := bootDexInfoByModule[name] + unencodedDex := bootDexInfo.path + encodedDex := hiddenAPIEncodeDex(ctx, unencodedDex, allFlagsCSV, bootDexInfo.uncompressDex, bootDexInfo.minSdkVersion, outputDir) + encodedBootDexJarsByModule[name] = encodedDex } - return &output + return encodedBootDexJarsByModule } func buildRuleToGenerateRemovedDexSignatures(ctx android.ModuleContext, removedTxtFiles android.Paths) android.OptionalPath { |