From 84b2589e6dc85d15af273b8a293ed7f064142af7 Mon Sep 17 00:00:00 2001 From: Jihoon Kang Date: Fri, 1 Dec 2023 22:01:06 +0000 Subject: 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 --- java/aapt2.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'java/aapt2.go') diff --git a/java/aapt2.go b/java/aapt2.go index 17ee6ee42..445e91298 100644 --- a/java/aapt2.go +++ b/java/aapt2.go @@ -202,7 +202,8 @@ var mergeAssetsRule = pctx.AndroidStaticRule("mergeAssets", 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 @@ func aapt2Link(ctx android.ModuleContext, }) } + 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 -- cgit v1.2.3-59-g8ed1b