Track transitive usage of aconfig flags and add LOCAL_ACONFIG_FILES to Android-<product>.mk

Bug: 283910439
Test: m nothing (runs soong tests)
Change-Id: I59f9bef7b7c502565d531a5685c002a177e0a77c
This commit is contained in:
Joe Onorato
2023-07-16 13:20:33 -07:00
parent cfcd0a4960
commit 6fe59eb7f0
10 changed files with 234 additions and 6 deletions

View File

@@ -51,7 +51,7 @@ func (callbacks *JavaAconfigDeclarationsLibraryCallbacks) DepsMutator(module *ja
}
}
func (callbacks *JavaAconfigDeclarationsLibraryCallbacks) GenerateSourceJarBuildActions(ctx android.ModuleContext) android.Path {
func (callbacks *JavaAconfigDeclarationsLibraryCallbacks) GenerateSourceJarBuildActions(module *java.GeneratedJavaLibraryModule, ctx android.ModuleContext) android.Path {
// Get the values that came from the global RELEASE_ACONFIG_VALUE_SETS flag
declarationsModules := ctx.GetDirectDepsWithTag(declarationsTag)
if len(declarationsModules) != 1 {
@@ -59,6 +59,7 @@ func (callbacks *JavaAconfigDeclarationsLibraryCallbacks) GenerateSourceJarBuild
}
declarations := ctx.OtherModuleProvider(declarationsModules[0], declarationsProviderKey).(declarationsProviderData)
// Generate the action to build the srcjar
srcJarPath := android.PathForModuleGen(ctx, ctx.ModuleName()+".srcjar")
ctx.Build(pctx, android.BuildParams{
Rule: srcJarRule,
@@ -67,5 +68,9 @@ func (callbacks *JavaAconfigDeclarationsLibraryCallbacks) GenerateSourceJarBuild
Description: "aconfig.srcjar",
})
// Tell the java module about the .aconfig files, so they can be propagated up the dependency chain.
// TODO: It would be nice to have that propagation code here instead of on java.Module and java.JavaInfo.
module.AddAconfigIntermediate(declarations.IntermediatePath)
return srcJarPath
}