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
This commit is contained in:
Colin Cross
2018-11-12 10:13:39 -08:00
parent 9d824cc850
commit 29ff88741e
20 changed files with 1690 additions and 118 deletions

View File

@@ -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 {