diff options
author | 2025-01-16 11:03:47 +0100 | |
---|---|---|
committer | 2025-01-17 09:21:58 +0100 | |
commit | d78234b6e16d6230819211aad41d707a577947aa (patch) | |
tree | f7e026f559f572eb57aa0d19e4d7df91ae9aa3a1 /aconfig/all_aconfig_declarations.go | |
parent | 81050fa3eb70a3be150a61d8dd48aa3c0527891b (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/all_aconfig_declarations.go')
-rw-r--r-- | aconfig/all_aconfig_declarations.go | 29 |
1 files changed, 28 insertions, 1 deletions
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") } |