From 1d73c7316cad5e947b01453d7492e4583f08bb67 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Thu, 5 Aug 2021 15:16:11 +0000 Subject: [PATCH] Revert "Pass jars with resources to R8" This reverts commit 05ca7c8769de5f70b08dc6607f8e8c4a8a6e7f60. Reason for revert: b/195644067 Flaky failure with "missing in.jar" error. Change-Id: Id2d6452de1e43951bc58f0bfb8e20d5ad65ce830 --- java/base.go | 2 +- java/dex.go | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/java/base.go b/java/base.go index d8cd6b3c1..6b8119619 100644 --- a/java/base.go +++ b/java/base.go @@ -1230,7 +1230,7 @@ func (j *Module) compile(ctx android.ModuleContext, aaptSrcJar android.Path) { } // Dex compilation var dexOutputFile android.OutputPath - dexOutputFile = j.dexer.compileDex(ctx, flags, j.MinSdkVersion(ctx), implementationAndResourcesJar, jarName) + dexOutputFile = j.dexer.compileDex(ctx, flags, j.MinSdkVersion(ctx), outputFile, jarName) if ctx.Failed() { return } diff --git a/java/dex.go b/java/dex.go index 8b7e3bab4..6bf0143b1 100644 --- a/java/dex.go +++ b/java/dex.go @@ -92,13 +92,11 @@ func init() { var d8, d8RE = pctx.MultiCommandRemoteStaticRules("d8", blueprint.RuleParams{ Command: `rm -rf "$outDir" && mkdir -p "$outDir" && ` + - `${config.Zip2ZipCmd} -i $in -o $outDir/in.jar -x '**/*.dex' &&` + - `$d8Template${config.D8Cmd} ${config.DexFlags} --output $outDir $d8Flags $outDir/in.jar && ` + + `$d8Template${config.D8Cmd} ${config.DexFlags} --output $outDir $d8Flags $in && ` + `$zipTemplate${config.SoongZipCmd} $zipFlags -o $outDir/classes.dex.jar -C $outDir -f "$outDir/classes*.dex" && ` + `${config.MergeZipsCmd} -D -stripFile "**/*.class" $out $outDir/classes.dex.jar $in`, CommandDeps: []string{ "${config.D8Cmd}", - "${config.Zip2ZipCmd}", "${config.SoongZipCmd}", "${config.MergeZipsCmd}", }, @@ -124,11 +122,10 @@ var r8, r8RE = pctx.MultiCommandRemoteStaticRules("r8", Command: `rm -rf "$outDir" && mkdir -p "$outDir" && ` + `rm -f "$outDict" && rm -rf "${outUsageDir}" && ` + `mkdir -p $$(dirname ${outUsage}) && ` + - `${config.Zip2ZipCmd} -i $in -o $outDir/in.jar -x '**/*.dex' &&` + // TODO(b/181095653): remove R8 timeout and go back to config.R8Cmd. `${runWithTimeoutCmd} -timeout 30m -on_timeout '${jstackCmd} $$PID' -- ` + `$r8Template${config.JavaCmd} ${config.DexJavaFlags} -cp ${config.R8Jar} ` + - `com.android.tools.r8.compatproguard.CompatProguard -injars $outDir/in.jar --output $outDir ` + + `com.android.tools.r8.compatproguard.CompatProguard -injars $in --output $outDir ` + `--no-data-resources ` + `-printmapping ${outDict} ` + `-printusage ${outUsage} ` + @@ -140,7 +137,6 @@ var r8, r8RE = pctx.MultiCommandRemoteStaticRules("r8", `${config.MergeZipsCmd} -D -stripFile "**/*.class" $out $outDir/classes.dex.jar $in`, CommandDeps: []string{ "${config.R8Jar}", - "${config.Zip2ZipCmd}", "${config.SoongZipCmd}", "${config.MergeZipsCmd}", "${runWithTimeoutCmd}",