diff options
author | Dan Willemsen <dwillemsen@google.com> | 2019-05-28 14:49:06 -0700 |
---|---|---|
committer | Dan Willemsen <dwillemsen@google.com> | 2019-05-29 16:54:43 -0700 |
commit | 304cfec778456fd52eb1958195f760dc9aec1601 (patch) | |
tree | 5bf8343b60fc5555c9fd7acbd500ef383242bb46 /java/aapt2.go | |
parent | ff3f43857fce71fefac445dbf953386f1b7c8c03 (diff) | |
download | build_soong-304cfec778456fd52eb1958195f760dc9aec1601.tar.gz build_soong-304cfec778456fd52eb1958195f760dc9aec1601.tar.bz2 build_soong-304cfec778456fd52eb1958195f760dc9aec1601.zip |
Refactor .aar resource compilation
Instead of extracting the aar, and passing the res directory to another rule
(along with a dependency to a different known file), don't keep the
extracted res directory, and pass the aar directly to the resource
compliation rule, which will extract just the res directory.
I need this for my RBE experiments, where non-listed output files won't
exist in other rules.
Test: m
Change-Id: I99074381052cbcebb6a402484abae9ab2e40284f
Diffstat (limited to 'java/aapt2.go')
-rw-r--r-- | java/aapt2.go | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/java/aapt2.go b/java/aapt2.go index bcc8e976..a8151608 100644 --- a/java/aapt2.go +++ b/java/aapt2.go @@ -94,32 +94,20 @@ func aapt2Compile(ctx android.ModuleContext, dir android.Path, paths android.Pat return ret } -func aapt2CompileDirs(ctx android.ModuleContext, flata android.WritablePath, dirs android.Paths, deps android.Paths) { - ctx.Build(pctx, android.BuildParams{ - Rule: aapt2CompileRule, - Description: "aapt2 compile dirs", - Implicits: deps, - Output: flata, - Args: map[string]string{ - "outDir": flata.String(), - // Always set --pseudo-localize, it will be stripped out later for release - // builds that don't want it. - "cFlags": "--pseudo-localize " + android.JoinWithPrefix(dirs.Strings(), "--dir "), - }, - }) -} - var aapt2CompileZipRule = pctx.AndroidStaticRule("aapt2CompileZip", blueprint.RuleParams{ - Command: `${config.ZipSyncCmd} -d $resZipDir $in && ` + + Command: `${config.ZipSyncCmd} -d $resZipDir $zipSyncFlags $in && ` + `${config.Aapt2Cmd} compile -o $out $cFlags --legacy --dir $resZipDir`, CommandDeps: []string{ "${config.Aapt2Cmd}", "${config.ZipSyncCmd}", }, - }, "cFlags", "resZipDir") + }, "cFlags", "resZipDir", "zipSyncFlags") -func aapt2CompileZip(ctx android.ModuleContext, flata android.WritablePath, zip android.Path) { +func aapt2CompileZip(ctx android.ModuleContext, flata android.WritablePath, zip android.Path, zipPrefix string) { + if zipPrefix != "" { + zipPrefix = "--zip-prefix " + zipPrefix + } ctx.Build(pctx, android.BuildParams{ Rule: aapt2CompileZipRule, Description: "aapt2 compile zip", @@ -128,8 +116,9 @@ func aapt2CompileZip(ctx android.ModuleContext, flata android.WritablePath, zip 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(), + "cFlags": "--pseudo-localize", + "resZipDir": android.PathForModuleOut(ctx, "aapt2", "reszip", flata.Base()).String(), + "zipSyncFlags": zipPrefix, }, }) } |