From 4b97a5661584e6db7942146e6dd0f343f4c6108e Mon Sep 17 00:00:00 2001 From: Jaewoong Jung Date: Thu, 17 Dec 2020 09:43:28 -0800 Subject: [PATCH] Remove the return value from dexpreopt dexpreopt doesn't strip dex files from the input jar anymore, so there's no point returning the input jar path untouched. Test: m nothing + TreeHugger Change-Id: I8fde6cdc19e85a2fbc946513696417b945c5de0f --- java/app.go | 10 +++++----- java/dexpreopt.go | 8 +++----- java/java.go | 4 ++-- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/java/app.go b/java/app.go index c0ac9c289..bcb610cdb 100755 --- a/java/app.go +++ b/java/app.go @@ -1546,11 +1546,11 @@ func (a *AndroidAppImport) generateAndroidBuildActions(ctx android.ModuleContext a.dexpreopter.enforceUsesLibs = a.usesLibrary.enforceUsesLibraries() a.dexpreopter.classLoaderContexts = a.usesLibrary.classLoaderContextForUsesLibDeps(ctx) - dexOutput := a.dexpreopter.dexpreopt(ctx, jnisUncompressed) + a.dexpreopter.dexpreopt(ctx, jnisUncompressed) if a.dexpreopter.uncompressedDex { dexUncompressed := android.PathForModuleOut(ctx, "dex-uncompressed", ctx.ModuleName()+".apk") - a.uncompressDex(ctx, dexOutput, dexUncompressed.OutputPath) - dexOutput = dexUncompressed + a.uncompressDex(ctx, jnisUncompressed, dexUncompressed.OutputPath) + jnisUncompressed = dexUncompressed } apkFilename := proptools.StringDefault(a.properties.Filename, a.BaseModuleName()+".apk") @@ -1574,11 +1574,11 @@ func (a *AndroidAppImport) generateAndroidBuildActions(ctx android.ModuleContext if lineage := String(a.properties.Lineage); lineage != "" { lineageFile = android.PathForModuleSrc(ctx, lineage) } - SignAppPackage(ctx, signed, dexOutput, certificates, nil, lineageFile) + SignAppPackage(ctx, signed, jnisUncompressed, certificates, nil, lineageFile) a.outputFile = signed } else { alignedApk := android.PathForModuleOut(ctx, "zip-aligned", apkFilename) - TransformZipAlign(ctx, alignedApk, dexOutput) + TransformZipAlign(ctx, alignedApk, jnisUncompressed) a.outputFile = alignedApk a.certificate = PresignedCertificate } diff --git a/java/dexpreopt.go b/java/dexpreopt.go index 67738d49b..b5830c744 100644 --- a/java/dexpreopt.go +++ b/java/dexpreopt.go @@ -112,13 +112,13 @@ func odexOnSystemOther(ctx android.ModuleContext, installPath android.InstallPat return dexpreopt.OdexOnSystemOtherByName(ctx.ModuleName(), android.InstallPathToOnDevicePath(ctx, installPath), dexpreopt.GetGlobalConfig(ctx)) } -func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.ModuleOutPath) android.ModuleOutPath { +func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.ModuleOutPath) { // TODO(b/148690468): The check on d.installPath is to bail out in cases where // the dexpreopter struct hasn't been fully initialized before we're called, // e.g. in aar.go. This keeps the behaviour that dexpreopting is effectively // disabled, even if installable is true. if d.dexpreoptDisabled(ctx) || d.installPath.Base() == "." { - return dexJarFile + return } globalSoong := dexpreopt.GetGlobalSoongConfig(ctx) @@ -213,12 +213,10 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.Mo dexpreoptRule, err := dexpreopt.GenerateDexpreoptRule(ctx, globalSoong, global, dexpreoptConfig) if err != nil { ctx.ModuleErrorf("error generating dexpreopt rule: %s", err.Error()) - return dexJarFile + return } dexpreoptRule.Build("dexpreopt", "dexpreopt") d.builtInstalled = dexpreoptRule.Installs().String() - - return dexJarFile } diff --git a/java/java.go b/java/java.go index 02d78f2bf..9e47b2f20 100644 --- a/java/java.go +++ b/java/java.go @@ -1786,7 +1786,7 @@ func (j *Module) compile(ctx android.ModuleContext, aaptSrcJar android.Path) { j.dexJarFile = dexOutputFile // Dexpreopting - dexOutputFile = j.dexpreopt(ctx, dexOutputFile) + j.dexpreopt(ctx, dexOutputFile) j.maybeStrippedDexJarFile = dexOutputFile @@ -3123,7 +3123,7 @@ func (j *DexImport) GenerateAndroidBuildActions(ctx android.ModuleContext) { j.dexJarFile = dexOutputFile - dexOutputFile = j.dexpreopt(ctx, dexOutputFile) + j.dexpreopt(ctx, dexOutputFile) j.maybeStrippedDexJarFile = dexOutputFile