diff options
author | Tobias Thierer <tobiast@google.com> | 2017-11-17 14:14:29 +0000 |
---|---|---|
committer | Tobias Thierer <tobiast@google.com> | 2017-12-05 02:07:30 +0000 |
commit | 0ae8b548af38c8b8fccea7cdef11d54740d3bb6a (patch) | |
tree | f4816707ec7663339b56d3ff62b8aa40f1b1cd7c | |
parent | 7154928c93e062775c1d3885ed59a5b61c48e168 (diff) | |
download | build_soong-0ae8b548af38c8b8fccea7cdef11d54740d3bb6a.tar.gz build_soong-0ae8b548af38c8b8fccea7cdef11d54740d3bb6a.tar.bz2 build_soong-0ae8b548af38c8b8fccea7cdef11d54740d3bb6a.zip |
Build with OpenJDK 9 -target 1.8 by default except for errorprone.
Before this CL topic, the build toolchain for .java source files
used OpenJDK 8, targeting 1.8 (v52 class files) by default.
This CL topic switches the default to OpenJDK 9, but still
targeting 1.8 (v52 class files) by default. If USE_ERROR_PRONE
is set to true, then the default remains OpenJDK 8.
Code in the Android platform should generally be unaffected,
but if host tools that are now compiled and run using
OpenJDK 9 are causing problems for your team, then let me
know.
To manually switch back to the old behavior for now (continue
using OpenJDK 8), run this command in your shell:
export EXPERIMENTAL_USE_OPENJDK9=false
Bug: 69449021
Test: Treehugger
Test: "make core-oj", checked that compilation now uses
OpenJDK 9 javac -target 1.8
Test: Checked that this is still compiled using OpenJDK 8.
export EXPERIMENTAL_USE_OPENJDK9=false
make core-oj
Change-Id: Ic87e9bb2a2e5da0ff13a2e51845b5365901c1507
-rw-r--r-- | android/config.go | 7 | ||||
-rw-r--r-- | ui/build/config.go | 11 |
2 files changed, 15 insertions, 3 deletions
diff --git a/android/config.go b/android/config.go index 0eebb5fb..f806b498 100644 --- a/android/config.go +++ b/android/config.go @@ -295,7 +295,10 @@ func NewConfig(srcDir, buildDir string) (Config, error) { func (c *config) fromEnv() error { switch c.Getenv("EXPERIMENTAL_USE_OPENJDK9") { case "": - // Use OpenJDK8 + if c.Getenv("RUN_ERROR_PRONE") != "true" { + // Use OpenJDK9, but target 1.8 + c.useOpenJDK9 = true + } case "false": // Use OpenJDK8 case "1.8": @@ -306,7 +309,7 @@ func (c *config) fromEnv() error { c.useOpenJDK9 = true c.targetOpenJDK9 = true default: - return fmt.Errorf(`Invalid value for EXPERIMENTAL_USE_OPENJDK9, should be "", "1.8", or "true"`) + return fmt.Errorf(`Invalid value for EXPERIMENTAL_USE_OPENJDK9, should be "", "false", "1.8", or "true"`) } return nil diff --git a/ui/build/config.go b/ui/build/config.go index df97d803..b608d386 100644 --- a/ui/build/config.go +++ b/ui/build/config.go @@ -150,7 +150,16 @@ func NewConfig(ctx Context, args ...string) Config { if override, ok := ret.environ.Get("OVERRIDE_ANDROID_JAVA_HOME"); ok { return override } - if v, ok := ret.environ.Get("EXPERIMENTAL_USE_OPENJDK9"); ok && v != "" && v != "false" { + v, ok := ret.environ.Get("EXPERIMENTAL_USE_OPENJDK9") + if !ok { + v2, ok2 := ret.environ.Get("RUN_ERROR_PRONE") + if ok2 && (v2 == "true") { + v = "false" + } else { + v = "1.8" + } + } + if v != "false" { return filepath.Join("prebuilts/jdk/jdk9", ret.HostPrebuiltTag()) } return filepath.Join("prebuilts/jdk/jdk8", ret.HostPrebuiltTag()) |