summaryrefslogtreecommitdiff
path: root/java/builder.go
diff options
context:
space:
mode:
author Colin Cross <ccross@android.com> 2018-11-12 10:13:39 -0800
committer Colin Cross <ccross@android.com> 2018-12-13 15:53:54 +0000
commit29ff88741e710b05743dcf347484c31311e81cda (patch)
treece14d0baba3cafc1948fe899e2788faf642701eb /java/builder.go
parent9d824cc850e957d41a7eea69aa05a224675b84b2 (diff)
Dexpreopt soong modules inside soong
Port the dexpreopt logic from Make to the dexpreopt package in Soong, and use it to dexpreopt Soong modules. The same package is also compiled into the dexpreopt_gen binary to generate dexpreopt scripts for Make modules. Bug: 119412419 Bug: 120273280 Test: no differences to dexpreopt outputs on aosp_sailfish system/, only expected changes to dexpreopt outputs on system_other (.vdex files for privileged Soong modules no longer incorrectly contain .dex contents). Change-Id: Ib67e2febf9ed921f06e8a86b9ec945c80dff35eb
Diffstat (limited to 'java/builder.go')
-rw-r--r--java/builder.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/java/builder.go b/java/builder.go
index cefb916df..861566495 100644
--- a/java/builder.go
+++ b/java/builder.go
@@ -138,6 +138,17 @@ var (
CommandDeps: []string{"${config.JavaCmd}", "${config.JetifierJar}"},
},
)
+
+ zipalign = pctx.AndroidStaticRule("zipalign",
+ blueprint.RuleParams{
+ Command: "if ! ${config.ZipAlign} -c 4 $in > /dev/null; then " +
+ "${config.ZipAlign} -f 4 $in $out; " +
+ "else " +
+ "cp -f $in $out; " +
+ "fi",
+ CommandDeps: []string{"${config.ZipAlign}"},
+ },
+ )
)
func init() {
@@ -410,6 +421,15 @@ func GenerateMainClassManifest(ctx android.ModuleContext, outputFile android.Wri
})
}
+func TransformZipAlign(ctx android.ModuleContext, outputFile android.WritablePath, inputFile android.Path) {
+ ctx.Build(pctx, android.BuildParams{
+ Rule: zipalign,
+ Description: "align",
+ Input: inputFile,
+ Output: outputFile,
+ })
+}
+
type classpath []android.Path
func (x *classpath) FormJavaClassPath(optName string) string {