Support experimental building with OpenJDK 17 am: 59c1e6ac0e am: 6984e882eb am: a1a1d6051a

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2006781

Change-Id: Iade0b38332bcca9742ab46284f8e62c088de8830
This commit is contained in:
Colin Cross 2022-03-05 03:28:41 +00:00 committed by Automerger Merge Worker
commit cf58ee5321
2 changed files with 10 additions and 1 deletions

View file

@ -105,7 +105,12 @@ func init() {
if override := ctx.Config().Getenv("OVERRIDE_JLINK_VERSION_NUMBER"); override != "" {
return override
}
return "11"
switch ctx.Config().Getenv("EXPERIMENTAL_USE_OPENJDK17_TOOLCHAIN") {
case "true":
return "17"
default:
return "11"
}
})
pctx.SourcePathVariable("JavaToolchain", "${JavaHome}/bin")

View file

@ -368,10 +368,14 @@ func NewConfig(ctx Context, args ...string) Config {
java8Home := filepath.Join("prebuilts/jdk/jdk8", ret.HostPrebuiltTag())
java9Home := filepath.Join("prebuilts/jdk/jdk9", ret.HostPrebuiltTag())
java11Home := filepath.Join("prebuilts/jdk/jdk11", ret.HostPrebuiltTag())
java17Home := filepath.Join("prebuilts/jdk/jdk17", ret.HostPrebuiltTag())
javaHome := func() string {
if override, ok := ret.environ.Get("OVERRIDE_ANDROID_JAVA_HOME"); ok {
return override
}
if ret.environ.IsEnvTrue("EXPERIMENTAL_USE_OPENJDK17_TOOLCHAIN") {
return java17Home
}
if toolchain11, ok := ret.environ.Get("EXPERIMENTAL_USE_OPENJDK11_TOOLCHAIN"); ok && toolchain11 != "true" {
ctx.Fatalln("The environment variable EXPERIMENTAL_USE_OPENJDK11_TOOLCHAIN is no longer supported. An OpenJDK 11 toolchain is now the global default.")
}