diff options
author | 2019-02-19 16:59:53 -0800 | |
---|---|---|
committer | 2019-02-20 18:12:41 +0000 | |
commit | a592e3eae9955217757e07d3b6a9597a82c04794 (patch) | |
tree | 8e96d1593d55ed4527c695047e5837dc6ecd5a42 /java/aapt2.go | |
parent | b81f48ee029eb0e5c2f1fb74d1315ea22b6b9e1c (diff) |
Support passing resource zips to aapt2
A zip of resources provides an easy way to pass generated resources
to aapt2.
Bug: 74574557
Test: m FrameworksCoreTests
Change-Id: Ie4b1391521a27727694d03e42462b40d775614f8
Diffstat (limited to 'java/aapt2.go')
-rw-r--r-- | java/aapt2.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/java/aapt2.go b/java/aapt2.go index 86eb9c804..d217b9f59 100644 --- a/java/aapt2.go +++ b/java/aapt2.go @@ -109,6 +109,31 @@ func aapt2CompileDirs(ctx android.ModuleContext, flata android.WritablePath, dir }) } +var aapt2CompileZipRule = pctx.AndroidStaticRule("aapt2CompileZip", + blueprint.RuleParams{ + Command: `${config.ZipSyncCmd} -d $resZipDir $in && ` + + `${config.Aapt2Cmd} compile -o $out $cFlags --legacy --dir $resZipDir`, + CommandDeps: []string{ + "${config.Aapt2Cmd}", + "${config.ZipSyncCmd}", + }, + }, "cFlags", "resZipDir") + +func aapt2CompileZip(ctx android.ModuleContext, flata android.WritablePath, zip android.Path) { + ctx.Build(pctx, android.BuildParams{ + Rule: aapt2CompileZipRule, + Description: "aapt2 compile 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", + "resZipDir": android.PathForModuleOut(ctx, "aapt2", "reszip", flata.Base()).String(), + }, + }) +} + var aapt2LinkRule = pctx.AndroidStaticRule("aapt2Link", blueprint.RuleParams{ Command: `rm -rf $genDir && ` + |