summaryrefslogtreecommitdiff
path: root/aconfig
diff options
context:
space:
mode:
author Mårten Kongstad <amhk@google.com> 2025-01-16 11:03:47 +0100
committer Mårten Kongstad <amhk@google.com> 2025-01-17 09:21:58 +0100
commitd78234b6e16d6230819211aad41d707a577947aa (patch)
treef7e026f559f572eb57aa0d19e4d7df91ae9aa3a1 /aconfig
parent81050fa3eb70a3be150a61d8dd48aa3c0527891b (diff)
all_aconfig_declarations: record finalized flags
Teach all_aconfig_declarations to create an artifact that records all flags used with @FlaggedApi that are currently slated for inclusion in the next API finalization. The actual data processing is offloaded to a new tool, record-finalized-flags. The artifact will be stored in the prebuilts/sdk/<version>/ directories. Bug: 377676163 Test: m sdk dist && test -e out/dist/finalized-flags.txt Change-Id: Iacd7c1d61ca35a4cfae9d83006331fe81337045e
Diffstat (limited to 'aconfig')
-rw-r--r--aconfig/Android.bp6
-rw-r--r--aconfig/all_aconfig_declarations.go29
-rw-r--r--aconfig/init.go8
3 files changed, 42 insertions, 1 deletions
diff --git a/aconfig/Android.bp b/aconfig/Android.bp
index 1fe417e7a..1505ba55e 100644
--- a/aconfig/Android.bp
+++ b/aconfig/Android.bp
@@ -31,4 +31,10 @@ bootstrap_go_package {
all_aconfig_declarations {
name: "all_aconfig_declarations",
+ api_files: [
+ ":frameworks-base-api-current.txt",
+ ":frameworks-base-api-system-current.txt",
+ ":frameworks-base-api-system-server-current.txt",
+ ":frameworks-base-api-module-lib-current.txt",
+ ],
}
diff --git a/aconfig/all_aconfig_declarations.go b/aconfig/all_aconfig_declarations.go
index 05cb065cc..bb906077a 100644
--- a/aconfig/all_aconfig_declarations.go
+++ b/aconfig/all_aconfig_declarations.go
@@ -30,7 +30,8 @@ import (
// doesn't need to pull from multiple builds and merge them.
func AllAconfigDeclarationsFactory() android.SingletonModule {
module := &allAconfigDeclarationsSingleton{releaseMap: make(map[string]allAconfigReleaseDeclarationsSingleton)}
- android.InitAndroidModule(module)
+ module.AddProperties(&module.properties)
+ android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
return module
}
@@ -39,10 +40,15 @@ type allAconfigReleaseDeclarationsSingleton struct {
intermediateTextProtoPath android.OutputPath
}
+type allAconfigReleaseDeclarationsProperties struct {
+ Api_files []string `android:"arch_variant,path"`
+}
+
type allAconfigDeclarationsSingleton struct {
android.SingletonModuleBase
releaseMap map[string]allAconfigReleaseDeclarationsSingleton
+ properties allAconfigReleaseDeclarationsProperties
}
func (this *allAconfigDeclarationsSingleton) sortedConfigNames() []string {
@@ -55,6 +61,26 @@ func (this *allAconfigDeclarationsSingleton) sortedConfigNames() []string {
}
func (this *allAconfigDeclarationsSingleton) GenerateAndroidBuildActions(ctx android.ModuleContext) {
+ apiFiles := android.Paths{}
+ for _, apiFile := range this.properties.Api_files {
+ if path := android.PathForModuleSrc(ctx, apiFile); path != nil {
+ apiFiles = append(apiFiles, path)
+ }
+ }
+ flagFile := android.PathForIntermediates(ctx, "all_aconfig_declarations.pb")
+
+ output := android.PathForIntermediates(ctx, "finalized-flags.txt")
+
+ ctx.Build(pctx, android.BuildParams{
+ Rule: RecordFinalizedFlagsRule,
+ Inputs: append(apiFiles, flagFile),
+ Output: output,
+ Args: map[string]string{
+ "api_files": android.JoinPathsWithPrefix(apiFiles, "--api-file "),
+ "flag_file": "--flag-file " + flagFile.String(),
+ },
+ })
+ ctx.Phony("all_aconfig_declarations", output)
}
func (this *allAconfigDeclarationsSingleton) GenerateSingletonBuildActions(ctx android.SingletonContext) {
@@ -123,4 +149,5 @@ func (this *allAconfigDeclarationsSingleton) MakeVars(ctx android.MakeVarsContex
ctx.DistForGoalWithFilename(goal, this.releaseMap[rcName].intermediateTextProtoPath, assembleFileName(rcName, "flags.textproto"))
}
}
+ ctx.DistForGoalWithFilename("sdk", android.PathForIntermediates(ctx, "finalized-flags.txt"), "finalized-flags.txt")
}
diff --git a/aconfig/init.go b/aconfig/init.go
index 519d50264..e221153a7 100644
--- a/aconfig/init.go
+++ b/aconfig/init.go
@@ -70,6 +70,13 @@ var (
"${aconfig}",
},
}, "cache_files")
+ RecordFinalizedFlagsRule = pctx.AndroidStaticRule("RecordFinalizedFlagsRule",
+ blueprint.RuleParams{
+ Command: `${record-finalized-flags} ${flag_file} ${api_files} > ${out}`,
+ CommandDeps: []string{
+ "${record-finalized-flags}",
+ },
+ }, "api_files", "flag_file")
CreateStorageRule = pctx.AndroidStaticRule("aconfig_create_storage",
blueprint.RuleParams{
@@ -112,6 +119,7 @@ func init() {
RegisterBuildComponents(android.InitRegistrationContext)
pctx.HostBinToolVariable("aconfig", "aconfig")
pctx.HostBinToolVariable("soong_zip", "soong_zip")
+ pctx.HostBinToolVariable("record-finalized-flags", "record-finalized-flags")
}
func RegisterBuildComponents(ctx android.RegistrationContext) {