aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorTobias Thierer <tobiast@google.com>2017-05-23 13:34:24 +0100
committerTobias Thierer <tobiast@google.com>2017-05-26 12:45:25 +0100
commit849bb6bf99f142039aece3362d8fb4b56aba5c12 (patch)
tree921fbeb777a390904277e1c18f185535fd0188c6 /ui
parent442b7e6dc9d05c0c904c0023753ac6d5e876b507 (diff)
downloadbuild_soong-849bb6bf99f142039aece3362d8fb4b56aba5c12.tar.gz
build_soong-849bb6bf99f142039aece3362d8fb4b56aba5c12.tar.bz2
build_soong-849bb6bf99f142039aece3362d8fb4b56aba5c12.zip
Allow version 9 toolchains for EXPERIMENTAL_USE_OPENJDK9
By default, the Android build enforces an OpenJDK 8 toolchain, whose name contains the strings "openjdk" and "1.8". After this CL, the check can be changed to enforce a toolchain name starting with "9" and without the need for "openjdk" having to occur in the name. This experimental new check can be enabled by running: export EXPERIMENTAL_USE_OPENJDK9=true To switch back to the standard check, run: unset EXPERIMENTAL_USE_OPENJDK9 Test: make ANDROID_COMPILE_WITH_JACK=false checkbuild tests \ && make checkbuild tests (with OpenJDK 8u45 toolchain on the PATH) Test: make EXPERIMENTAL_USE_OPENJDK9=true \ ANDROID_COMPILE_WITH_JACK=false checkbuild (with jdk 9-ea+170 toolchain on the PATH) Bug: 38177295 Change-Id: I75de3e23fe0b7f41eb6dd3f55dadd3fa3c3383bd
Diffstat (limited to 'ui')
-rw-r--r--ui/build/java.go21
1 files changed, 17 insertions, 4 deletions
diff --git a/ui/build/java.go b/ui/build/java.go
index 481a6805..473af012 100644
--- a/ui/build/java.go
+++ b/ui/build/java.go
@@ -66,9 +66,19 @@ func checkJavaVersion(ctx Context, config Config) {
var required_java_version string
var java_version_regexp *regexp.Regexp
var javac_version_regexp *regexp.Regexp
- required_java_version = "1.8"
- java_version_regexp = regexp.MustCompile(`[ "]1\.8[\. "$]`)
- javac_version_regexp = java_version_regexp
+
+ oj9_env, _ := config.Environment().Get("EXPERIMENTAL_USE_OPENJDK9")
+ experimental_use_openjdk9 := oj9_env != ""
+
+ if experimental_use_openjdk9 {
+ required_java_version = "9"
+ java_version_regexp = regexp.MustCompile(`^java .* "9.*"`)
+ javac_version_regexp = regexp.MustCompile(`^javac 9`)
+ } else {
+ required_java_version = "1.8"
+ java_version_regexp = regexp.MustCompile(`[ "]1\.8[\. "$]`)
+ javac_version_regexp = java_version_regexp
+ }
java_version := javaVersionInfo.java_version_output
javac_version := javaVersionInfo.javac_version_output
@@ -95,7 +105,10 @@ func checkJavaVersion(ctx Context, config Config) {
}
if runtime.GOOS == "linux" {
- if !strings.Contains(java_version, "openjdk") {
+ // Early access builds of OpenJDK 9 do not contain the string "openjdk" in the
+ // version name. TODO(tobiast): Reconsider once the OpenJDK 9 toolchain is stable.
+ // http://b/62123342
+ if !strings.Contains(java_version, "openjdk") && !experimental_use_openjdk9 {
ctx.Println("*******************************************************")
ctx.Println("You are attempting to build with an unsupported JDK.")
ctx.Println()