Support EXPERIMENTAL_USE_OPENJDK9=false.

This fourth possible value currently has the same semantics
as a default/unset EXPERIMENTAL_USE_OPENJDK9, but allows
people to explicitly switch back to the old semantics when
the default changes.

Test: make showcommands core-oj (in environments with
      EXPERIMENTAL_USE_OPENJDK9 set to "", "1.8", and "true").
Bug: 38177295

Change-Id: I25accf14344a05349a6e97572d7c2c1f6a7f2063
This commit is contained in:
Tobias Thierer 2017-11-15 21:16:25 +00:00
parent ef633e0959
commit a7cdd156a6
2 changed files with 3 additions and 1 deletions

View file

@ -291,6 +291,8 @@ func (c *config) fromEnv() error {
switch c.Getenv("EXPERIMENTAL_USE_OPENJDK9") { switch c.Getenv("EXPERIMENTAL_USE_OPENJDK9") {
case "": case "":
// Use OpenJDK8 // Use OpenJDK8
case "false":
// Use OpenJDK8
case "1.8": case "1.8":
// Use OpenJDK9, but target 1.8 // Use OpenJDK9, but target 1.8
c.useOpenJDK9 = true c.useOpenJDK9 = true

View file

@ -149,7 +149,7 @@ func NewConfig(ctx Context, args ...string) Config {
if override, ok := ret.environ.Get("OVERRIDE_ANDROID_JAVA_HOME"); ok { if override, ok := ret.environ.Get("OVERRIDE_ANDROID_JAVA_HOME"); ok {
return override return override
} }
if v, ok := ret.environ.Get("EXPERIMENTAL_USE_OPENJDK9"); ok && v != "" { if v, ok := ret.environ.Get("EXPERIMENTAL_USE_OPENJDK9"); ok && v != "" && v != "false" {
return filepath.Join("prebuilts/jdk/jdk9", ret.HostPrebuiltTag()) return filepath.Join("prebuilts/jdk/jdk9", ret.HostPrebuiltTag())
} }
return filepath.Join("prebuilts/jdk/jdk8", ret.HostPrebuiltTag()) return filepath.Join("prebuilts/jdk/jdk8", ret.HostPrebuiltTag())