Skip to content

Commit

Permalink
Enable --incompatible_use_jdk11_as_host_javabase
Browse files Browse the repository at this point in the history
Fixes #7219

RELNOTES: incompatible_use_jdk11_as_host_javabase: makes JDK 11 the default --host_javabase for remote jdk (#7219)
PiperOrigin-RevId: 236982455
  • Loading branch information
cushon authored and copybara-github committed Mar 6, 2019
1 parent 180eeef commit 8e5a67f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public ImportDepsCheckingLevelConverter() {

@Option(
name = "incompatible_use_jdk11_as_host_javabase",
defaultValue = "false",
defaultValue = "true",
documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
effectTags = {OptionEffectTag.UNKNOWN},
metadataTags = {
Expand Down
17 changes: 9 additions & 8 deletions src/test/shell/integration/bazel_java_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,28 +72,29 @@ EOF
# Note that this will change in the future but is the current state.
bazel aquery --output=text //java:javalib >& $TEST_log
expect_not_log "exec external/embedded_jdk/bin/java"
expect_log "exec external/remotejdk10_.*/bin/java"
expect_log "exec external/remotejdk11_.*/bin/java"

bazel aquery --output=text --host_javabase=//:host_javabase \
//java:javalib >& $TEST_log
expect_log "exec .*foobar/bin/java"
expect_not_log "exec external/remotejdk_.*/bin/java"

bazel aquery --output=text --incompatible_use_jdk10_as_host_javabase \
bazel aquery --output=text --incompatible_use_jdk11_as_host_javabase \
//java:javalib >& $TEST_log
expect_log "exec external/remotejdk10_.*/bin/java"
expect_log "exec external/remotejdk11_.*/bin/java"
}

function test_javabase() {
mkdir -p zoo/bin
cat << EOF > BUILD
load("@bazel_tools//tools/jdk:default_java_toolchain.bzl", "default_java_toolchain", "JDK9_JVM_OPTS")
load("@bazel_tools//tools/jdk:default_java_toolchain.bzl", "default_java_toolchain")
default_java_toolchain(
name = "toolchain",
# Implicitly use the host_javabase bootclasspath, since the target doesn't
# exist in this test.
bootclasspath = [],
jvm_opts = JDK9_JVM_OPTS,
javabuilder = ["@bazel_tools//tools/jdk:vanillajavabuilder"],
jvm_opts = [],
visibility = ["//visibility:public"],
)
java_runtime(
Expand Down Expand Up @@ -209,7 +210,7 @@ EOF
expect_not_log "bar"
expect_not_log "embedded_jdk"
expect_not_log "remotejdk_"
expect_not_log "remotejdk10_"
expect_not_log "remotejdk11_"

# Test the genrule that specifically depends on :bar_runtime.
bazel cquery --max_config_changes_to_show=0 --implicit_deps \
Expand All @@ -218,7 +219,7 @@ EOF
expect_log "bar"
expect_not_log "embedded_jdk"
expect_not_log "remotejdk_"
expect_not_log "remotejdk10_"
expect_not_log "remotejdk11_"

# Setting the javabase should not change the use of :bar_runtime from the
# roolchains attribute.
Expand All @@ -228,7 +229,7 @@ EOF
expect_log "bar"
expect_not_log "embedded_jdk"
expect_not_log "remotejdk_"
expect_not_log "remotejdk10_"
expect_not_log "remotejdk11_"
}

run_suite "Tests of specifying custom server_javabase/host_javabase and javabase."

0 comments on commit 8e5a67f

Please sign in to comment.