Add aconfig flag support for android_app
This change adds an overrideable property flags_packages to android_app,
which is used to list the aconfig_declarations module names that the app
depends on. The build action of android_app is modified to pass all
flags text file provided by the aconfig_declarations to aapt2 link as
--feature-flags arguments.
Test: m nothing --no-skip-soong-tests
Bug: 306024510
Change-Id: I4924f88b9954950cc1936a472cd7ac70f41add5d
diff --git a/java/aapt2.go b/java/aapt2.go
index 17ee6ee..445e912 100644
--- a/java/aapt2.go
+++ b/java/aapt2.go
@@ -202,7 +202,8 @@
func aapt2Link(ctx android.ModuleContext,
packageRes, genJar, proguardOptions, rTxt android.WritablePath,
flags []string, deps android.Paths,
- compiledRes, compiledOverlay, assetPackages android.Paths, splitPackages android.WritablePaths) {
+ compiledRes, compiledOverlay, assetPackages android.Paths, splitPackages android.WritablePaths,
+ featureFlagsPaths android.Paths) {
var inFlags []string
@@ -255,6 +256,11 @@
})
}
+ for _, featureFlagsPath := range featureFlagsPaths {
+ deps = append(deps, featureFlagsPath)
+ inFlags = append(inFlags, "--feature-flags", "@"+featureFlagsPath.String())
+ }
+
// Note the absence of splitPackages. The caller is supposed to compose and provide --split flag
// values via the flags parameter when it wants to split outputs.
// TODO(b/174509108): Perhaps we can process it in this func while keeping the code reasonably