Skip to content

Commit

Permalink
Do not default to the embedded javabase when no other JDK is found.
Browse files Browse the repository at this point in the history
Progress towards #6105.

RELNOTES: If the --javabase flag is unset, it Bazel locates a JDK using the JAVA_HOME environment variable and searching the PATH. If no JDK is found --javabase will be empty, and builds targeting Java will not be supported.  Previously Bazel would fall back to using the embedded JDK as a --javabase, but this is no longer default behaviour. A JDK should be explicitly installed instead to enable Java development.
PiperOrigin-RevId: 213965437
  • Loading branch information
lberki authored and Copybara-Service committed Sep 21, 2018
1 parent 50921e6 commit cc96464
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ public class SkylarkSemanticsOptions extends OptionsBase implements Serializable

@Option(
name = "incompatible_never_use_embedded_jdk_for_javabase",
defaultValue = "false",
defaultValue = "true",
documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
effectTags = {OptionEffectTag.UNKNOWN},
metadataTags = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public static Builder builderWithDefaults() {
.incompatibleStaticNameResolution(false)
.incompatibleStringIsNotIterable(false)
.internalSkylarkFlagTestCanary(false)
.incompatibleNeverUseEmbeddedJDKForJavabase(false)
.incompatibleNeverUseEmbeddedJDKForJavabase(true)
.build();

/** Builder for {@link SkylarkSemantics}. All fields are mandatory. */
Expand Down
2 changes: 1 addition & 1 deletion src/test/shell/integration/bazel_java_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ function test_no_javabase_default_embedded() {

write_javabase_files

bazel --batch build //javabase_test:a
bazel --batch build --noincompatible_never_use_embedded_jdk_for_javabase //javabase_test:a

echo $(bazel-bin/javabase_test/a --print_javabin) >& $TEST_log
expect_log "bazel-bin/javabase_test/a.runfiles/local_jdk/bin/java"
Expand Down

0 comments on commit cc96464

Please sign in to comment.