Add aconfig flag value text file in aconfig_declarations provider
Alongside with the generated proto file, the aconfig_declaration now
also outputs a text file that lists aconfig flags and values of its
corresponding proto file, in the format as shown below:
```
my.flag1=true
my.flag2=false
...
```
To prevent confusion between the preexisting proto file and the newly
introduced text file, the change also renames the variables of the proto
file from `intermediatePath` to `intermediateCacheOutputPath` and
likewise.
The utilization of the generated text file will be done in the child
changes.
Test: m out/soong/.intermediates/build/make/tools/aconfig/aconfig.test.flags/intermediate.txt && inspect output
Bug: 306024510
Change-Id: Iee16ad57bb87e992a477fc96502f79e971d01233
diff --git a/aconfig/aconfig_declarations.go b/aconfig/aconfig_declarations.go
index 05a6371..9bf7564 100644
--- a/aconfig/aconfig_declarations.go
+++ b/aconfig/aconfig_declarations.go
@@ -20,6 +20,7 @@
"android/soong/android"
"android/soong/bazel"
+
"github.com/google/blueprint"
)
@@ -116,9 +117,10 @@
// Provider published by aconfig_value_set
type DeclarationsProviderData struct {
- Package string
- Container string
- IntermediatePath android.WritablePath
+ Package string
+ Container string
+ IntermediateCacheOutputPath android.WritablePath
+ IntermediateDumpOutputPath android.WritablePath
}
var DeclarationsProviderKey = blueprint.NewProvider(DeclarationsProviderData{})
@@ -151,14 +153,14 @@
// Intermediate format
declarationFiles := android.PathsForModuleSrc(ctx, module.properties.Srcs)
- intermediatePath := android.PathForModuleOut(ctx, "intermediate.pb")
+ intermediateCacheFilePath := android.PathForModuleOut(ctx, "intermediate.pb")
defaultPermission := ctx.Config().ReleaseAconfigFlagDefaultPermission()
inputFiles := make([]android.Path, len(declarationFiles))
copy(inputFiles, declarationFiles)
inputFiles = append(inputFiles, valuesFiles...)
ctx.Build(pctx, android.BuildParams{
Rule: aconfigRule,
- Output: intermediatePath,
+ Output: intermediateCacheFilePath,
Inputs: inputFiles,
Description: "aconfig_declarations",
Args: map[string]string{
@@ -170,10 +172,19 @@
},
})
+ intermediateDumpFilePath := android.PathForModuleOut(ctx, "intermediate.txt")
+ ctx.Build(pctx, android.BuildParams{
+ Rule: aconfigTextRule,
+ Output: intermediateDumpFilePath,
+ Inputs: android.Paths{intermediateCacheFilePath},
+ Description: "aconfig_text",
+ })
+
ctx.SetProvider(DeclarationsProviderKey, DeclarationsProviderData{
- Package: module.properties.Package,
- Container: module.properties.Container,
- IntermediatePath: intermediatePath,
+ Package: module.properties.Package,
+ Container: module.properties.Container,
+ IntermediateCacheOutputPath: intermediateCacheFilePath,
+ IntermediateDumpOutputPath: intermediateDumpFilePath,
})
}
@@ -182,8 +193,8 @@
*mergedAconfigFiles = make(map[string]android.Paths)
}
ctx.VisitDirectDeps(func(module android.Module) {
- if dep := ctx.OtherModuleProvider(module, DeclarationsProviderKey).(DeclarationsProviderData); dep.IntermediatePath != nil {
- (*mergedAconfigFiles)[dep.Container] = append((*mergedAconfigFiles)[dep.Container], dep.IntermediatePath)
+ if dep := ctx.OtherModuleProvider(module, DeclarationsProviderKey).(DeclarationsProviderData); dep.IntermediateCacheOutputPath != nil {
+ (*mergedAconfigFiles)[dep.Container] = append((*mergedAconfigFiles)[dep.Container], dep.IntermediateCacheOutputPath)
return
}
if dep := ctx.OtherModuleProvider(module, TransitiveDeclarationsInfoProvider).(TransitiveDeclarationsInfo); len(dep.AconfigFiles) > 0 {