From c37c6343e24399d8238ebeb2ece665fcf660cc13 Mon Sep 17 00:00:00 2001 From: Alan Leung Date: Wed, 13 Dec 2017 00:28:49 -0800 Subject: [PATCH] Prep D8 default instead of CompatDX in build/soong Bug: 69329508 Test: m checkbuild tests Change-Id: Ibaa2d787c644cf25104af78305a6eed16028dcf0 --- android/config.go | 4 ++++ java/builder.go | 2 +- java/config/makevars.go | 4 +++- java/java.go | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/android/config.go b/android/config.go index 56e952541..dd0301e95 100644 --- a/android/config.go +++ b/android/config.go @@ -584,6 +584,10 @@ func (c *config) Android64() bool { return false } +func (c *config) UseD8Desugar() bool { + return c.IsEnvTrue("USE_D8_DESUGAR") +} + func (c *config) UseGoma() bool { return Bool(c.ProductVariables.UseGoma) } diff --git a/java/builder.go b/java/builder.go index ff618d85a..dd0d927dd 100644 --- a/java/builder.go +++ b/java/builder.go @@ -441,7 +441,7 @@ func TransformClassesJarToDexJar(ctx android.ModuleContext, outputFile android.W rule := dx desc := "dx" - if ctx.AConfig().IsEnvTrue("USE_D8_DESUGAR") { + if ctx.Config().UseD8Desugar() { rule = d8 desc = "d8" } diff --git a/java/config/makevars.go b/java/config/makevars.go index 5c8589e1a..c382cc1ab 100644 --- a/java/config/makevars.go +++ b/java/config/makevars.go @@ -46,12 +46,14 @@ func makeVarsProvider(ctx android.MakeVarsContext) { ctx.Strict("JAVADOC", "${JavadocCmd}") ctx.Strict("COMMON_JDK_FLAGS", "${CommonJdkFlags}") - if ctx.Config().IsEnvTrue("USE_D8_DESUGAR") { + if ctx.Config().UseD8Desugar() { ctx.Strict("DX", "${D8Cmd}") ctx.Strict("DX_COMMAND", "${D8Cmd} -JXms16M -JXmx2048M") + ctx.Strict("USE_D8_DESUGAR", "true") } else { ctx.Strict("DX", "${DxCmd}") ctx.Strict("DX_COMMAND", "${DxCmd} -JXms16M -JXmx2048M") + ctx.Strict("USE_D8_DESUGAR", "false") } ctx.Strict("TURBINE", "${TurbineJar}") diff --git a/java/java.go b/java/java.go index 9b345fdcd..05d38f237 100644 --- a/java/java.go +++ b/java/java.go @@ -677,7 +677,7 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars ...android.Path // Store the list of .java files that was passed to javac j.compiledJavaSrcs = uniqueSrcFiles j.compiledSrcJars = srcJars - fullD8 := ctx.AConfig().IsEnvTrue("USE_D8_DESUGAR") + fullD8 := ctx.Config().UseD8Desugar() enable_sharding := false if ctx.Device() && !ctx.Config().IsEnvFalse("TURBINE_ENABLED") {