Move generation of global hidden API flags to platform_bootclasspath
This change moves the generation of the global hidden API flags from
the singleton to the platform_bootclasspath module. It involves:
1. Moving the ruleToGenerateHiddenApiFlags to hiddenapi_modular.go.
2. Adding HiddenAPIAugmentationProperties to be used by the
platform_bootclasspath type.
3. Moving the file paths into the platform-bootclasspath module
definition in frameworks/base/boot/Android.bp.
The flagsRule is kept as a placeholder for now. The emptyFlagsRule is
also kept so that builds continue to work even when the frameworks/base
repository is not present.
Bug: 177892522
Test: verified that the out/soong/hiddenapi/... files are unchanged
by this change
Change-Id: Idf4dd414a016831bfe04a01f93234c1c33819881
diff --git a/java/platform_bootclasspath.go b/java/platform_bootclasspath.go
index 95d19b9..e292d80 100644
--- a/java/platform_bootclasspath.go
+++ b/java/platform_bootclasspath.go
@@ -84,10 +84,11 @@
}
type platformBootclasspathProperties struct {
-
// The names of the bootclasspath_fragment modules that form part of this
// platform_bootclasspath.
Fragments []ApexVariantReference
+
+ Hidden_api HiddenAPIAugmentationProperties
}
func platformBootclasspathFactory() android.Module {
@@ -191,6 +192,8 @@
}
})
+ b.generateHiddenAPIBuildActions(ctx, b.configuredModules)
+
// Nothing to do if skipping the dexpreopt of boot image jars.
if SkipDexpreoptBootJars(ctx) {
return
@@ -215,3 +218,24 @@
func (b *platformBootclasspathModule) getImageConfig(ctx android.EarlyModuleContext) *bootImageConfig {
return defaultBootImageConfig(ctx)
}
+
+// generateHiddenAPIBuildActions generates all the hidden API related build rules.
+func (b *platformBootclasspathModule) generateHiddenAPIBuildActions(ctx android.ModuleContext, modules []android.Module) {
+
+ moduleSpecificFlagsPaths := android.Paths{}
+ for _, module := range modules {
+ if h, ok := module.(hiddenAPIIntf); ok {
+ if csv := h.flagsCSV(); csv != nil {
+ moduleSpecificFlagsPaths = append(moduleSpecificFlagsPaths, csv)
+ }
+ } else {
+ ctx.ModuleErrorf("module %s of type %s does not implement hiddenAPIIntf", module, ctx.OtherModuleType(module))
+ }
+ }
+
+ augmentationInfo := b.properties.Hidden_api.hiddenAPIAugmentationInfo(ctx)
+
+ outputPath := hiddenAPISingletonPaths(ctx).flags
+ baseFlagsPath := hiddenAPISingletonPaths(ctx).stubFlags
+ ruleToGenerateHiddenApiFlags(ctx, outputPath, baseFlagsPath, moduleSpecificFlagsPaths, augmentationInfo)
+}