aboutsummaryrefslogtreecommitdiffstats
path: root/java/config
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2018-06-06 16:26:14 -0700
committerandroid-build-merger <android-build-merger@google.com>2018-06-06 16:26:14 -0700
commit0b16af4039f8fab9649461208ccf8bef3a14a04a (patch)
tree2b7ee88f245fb64130085c45e7f5368ab31f9949 /java/config
parenta2f6aebea0df52cbb3cbf2137593a233ce2e66ef (diff)
parentecf35d00ea4e5e83684e1652d4edc8417fcb2a5d (diff)
downloadbuild_soong-0b16af4039f8fab9649461208ccf8bef3a14a04a.tar.gz
build_soong-0b16af4039f8fab9649461208ccf8bef3a14a04a.tar.bz2
build_soong-0b16af4039f8fab9649461208ccf8bef3a14a04a.zip
Merge "Revert "Remove desugar support"" am: 7302905413
am: ecf35d00ea Change-Id: Ib829111904db2eeb3ec19b2d59c0c7bfe331b505
Diffstat (limited to 'java/config')
-rw-r--r--java/config/config.go13
-rw-r--r--java/config/makevars.go11
2 files changed, 22 insertions, 2 deletions
diff --git a/java/config/config.go b/java/config/config.go
index 7842da6e..ec1effa5 100644
--- a/java/config/config.go
+++ b/java/config/config.go
@@ -95,6 +95,18 @@ func init() {
pctx.HostBinToolVariable("Zip2ZipCmd", "zip2zip")
pctx.HostBinToolVariable("ZipSyncCmd", "zipsync")
pctx.HostBinToolVariable("ApiCheckCmd", "apicheck")
+ pctx.VariableFunc("DxCmd", func(ctx android.PackageVarContext) string {
+ config := ctx.Config()
+ if config.IsEnvFalse("USE_D8") {
+ if config.UnbundledBuild() || config.IsPdkBuild() {
+ return "prebuilts/build-tools/common/bin/dx"
+ } else {
+ return pctx.HostBinToolPath(ctx, "dx").String()
+ }
+ } else {
+ return pctx.HostBinToolPath(ctx, "d8-compat-dx").String()
+ }
+ })
pctx.HostBinToolVariable("D8Cmd", "d8")
pctx.HostBinToolVariable("R8Cmd", "r8-compat-proguard")
@@ -108,6 +120,7 @@ func init() {
})
pctx.HostJavaToolVariable("JarjarCmd", "jarjar.jar")
+ pctx.HostJavaToolVariable("DesugarJar", "desugar.jar")
pctx.HostJavaToolVariable("JsilverJar", "jsilver.jar")
pctx.HostJavaToolVariable("DoclavaJar", "doclava.jar")
pctx.HostJavaToolVariable("MetalavaJar", "metalava.jar")
diff --git a/java/config/makevars.go b/java/config/makevars.go
index 4dffa024..27c7daaa 100644
--- a/java/config/makevars.go
+++ b/java/config/makevars.go
@@ -46,8 +46,15 @@ func makeVarsProvider(ctx android.MakeVarsContext) {
ctx.Strict("JAVADOC", "${JavadocCmd}")
ctx.Strict("COMMON_JDK_FLAGS", "${CommonJdkFlags}")
- ctx.Strict("DX", "${D8Cmd}")
- ctx.Strict("DX_COMMAND", "${D8Cmd} -JXms16M -JXmx2048M")
+ 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("R8_COMPAT_PROGUARD", "${R8Cmd}")
ctx.Strict("TURBINE", "${TurbineJar}")