From a0ba2f58586dda08178b1eb7acab42e08a555423 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Sat, 22 Jun 2019 12:59:27 -0700 Subject: Allow passing --legacy in aaptflags --legacy will soon no longer be passed by default to all aapt2 compiles. Allow it to be specified in aaptflags by passing it to aapt2 compile when it is present and filtering it out from the flags passed to aapt2 link. Bug: 135597368 Test: m java Change-Id: Ib65d1a9b7c32ae4ff5ab6f58e66aedfb5f296712 --- java/aapt2.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'java/aapt2.go') diff --git a/java/aapt2.go b/java/aapt2.go index a8151608f..ad746f7b8 100644 --- a/java/aapt2.go +++ b/java/aapt2.go @@ -60,7 +60,9 @@ var aapt2CompileRule = pctx.AndroidStaticRule("aapt2Compile", }, "outDir", "cFlags") -func aapt2Compile(ctx android.ModuleContext, dir android.Path, paths android.Paths) android.WritablePaths { +func aapt2Compile(ctx android.ModuleContext, dir android.Path, paths android.Paths, + flags []string) android.WritablePaths { + shards := shardPaths(paths, AAPT2_SHARD_SIZE) ret := make(android.WritablePaths, 0, len(paths)) @@ -81,9 +83,7 @@ func aapt2Compile(ctx android.ModuleContext, dir android.Path, paths android.Pat Outputs: outPaths, Args: map[string]string{ "outDir": android.PathForModuleOut(ctx, "aapt2", dir.String()).String(), - // Always set --pseudo-localize, it will be stripped out later for release - // builds that don't want it. - "cFlags": "--pseudo-localize", + "cFlags": strings.Join(flags, " "), }, }) } @@ -104,7 +104,9 @@ var aapt2CompileZipRule = pctx.AndroidStaticRule("aapt2CompileZip", }, }, "cFlags", "resZipDir", "zipSyncFlags") -func aapt2CompileZip(ctx android.ModuleContext, flata android.WritablePath, zip android.Path, zipPrefix string) { +func aapt2CompileZip(ctx android.ModuleContext, flata android.WritablePath, zip android.Path, zipPrefix string, + flags []string) { + if zipPrefix != "" { zipPrefix = "--zip-prefix " + zipPrefix } @@ -114,9 +116,7 @@ func aapt2CompileZip(ctx android.ModuleContext, flata android.WritablePath, zip Input: zip, Output: flata, Args: map[string]string{ - // Always set --pseudo-localize, it will be stripped out later for release - // builds that don't want it. - "cFlags": "--pseudo-localize", + "cFlags": strings.Join(flags, " "), "resZipDir": android.PathForModuleOut(ctx, "aapt2", "reszip", flata.Base()).String(), "zipSyncFlags": zipPrefix, }, -- cgit v1.2.3-59-g8ed1b