diff options
author | 2024-07-16 18:20:03 +0000 | |
---|---|---|
committer | 2024-07-16 19:41:31 +0000 | |
commit | 98ea83687f9504eb5b1909c99e916395aacbc6cb (patch) | |
tree | 868b8b7a3921c6a043d08da35e79cb368f539796 /java/aapt2.go | |
parent | 03b228e7250f325aaef7478c06288601778c9af2 (diff) |
Support aapt2 resources flagging
This change modifies the aconfig and aapt2 build rules to support
resources flagging in aapt2.
Implementation details:
- Modify the aconfig text rule to include flag permission in the output
text file
- Pass the `--flags-packages` argument to `aapt2 compile` command,
similar to what is currently being done in the `aapt2 link` command
Bug: 344979955
Test: m nothing --no-skip-soong-tests
Change-Id: I3b0b1fd6dcd691b7cc50ba3d081ecafd82c2c904
Diffstat (limited to 'java/aapt2.go')
-rw-r--r-- | java/aapt2.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/java/aapt2.go b/java/aapt2.go index f704fc6fc..61cf37381 100644 --- a/java/aapt2.go +++ b/java/aapt2.go @@ -69,7 +69,7 @@ var aapt2CompileRule = pctx.AndroidStaticRule("aapt2Compile", // aapt2Compile compiles resources and puts the results in the requested directory. func aapt2Compile(ctx android.ModuleContext, dir android.Path, paths android.Paths, - flags []string, productToFilter string) android.WritablePaths { + flags []string, productToFilter string, featureFlagsPaths android.Paths) android.WritablePaths { if productToFilter != "" && productToFilter != "default" { // --filter-product leaves only product-specific resources. Product-specific resources only exist // in value resources (values/*.xml), so filter value resource files only. Ignore other types of @@ -85,6 +85,10 @@ func aapt2Compile(ctx android.ModuleContext, dir android.Path, paths android.Pat flags = append([]string{"--filter-product " + productToFilter}, flags...) } + for _, featureFlagsPath := range android.SortedUniquePaths(featureFlagsPaths) { + flags = append(flags, "--feature-flags", "@"+featureFlagsPath.String()) + } + // Shard the input paths so that they can be processed in parallel. If we shard them into too // small chunks, the additional cost of spinning up aapt2 outweighs the performance gain. The // current shard size, 100, seems to be a good balance between the added cost and the gain. @@ -112,6 +116,7 @@ func aapt2Compile(ctx android.ModuleContext, dir android.Path, paths android.Pat ctx.Build(pctx, android.BuildParams{ Rule: aapt2CompileRule, Description: "aapt2 compile " + dir.String() + shardDesc, + Implicits: featureFlagsPaths, Inputs: shard, Outputs: outPaths, Args: map[string]string{ |