Skip to content

Commit

Permalink
Remove old flags from scrooge_compile_with_jdk_11
Browse files Browse the repository at this point in the history
Removed several deprecated flags that've been no-ops for years, plus
`--javacopt='--release 11'`, which caused this breakage after the bump
to `rules_java` 7.12.2;

```txt
$ RULES_SCALA_TEST_ONLY="scrooge_compile_with_jdk_11" bash ./test/shell/test_twitter_scrooge.sh

running test scrooge_compile_with_jdk_11
WARNING: Option 'javabase' is deprecated
WARNING: Option 'host_javabase' is deprecated
WARNING: Option 'host_java_toolchain' is deprecated
WARNING: Option 'java_toolchain' is deprecated
WARNING: Option 'javabase' is deprecated
WARNING: Option 'host_javabase' is deprecated
WARNING: Option 'host_java_toolchain' is deprecated
WARNING: Option 'java_toolchain' is deprecated
INFO: Analyzed 64 targets (0 packages loaded, 0 targets configured).
INFO: Found 64 targets...

ERROR:
  .../src/java/io/bazel/rulesscala/scalac/compileoptions/BUILD:3:13:
  Compiling Java headers
  src/java/io/bazel/rulesscala/scalac/compileoptions/libcompileoptions-hjar.jar
  (1 source file) failed: (Exit 1): turbine_direct_graal failed:
  error executing command (from target
  //src/java/io/bazel/rulesscala/scalac/compileoptions:compileoptions)

  external/remote_java_tools_darwin_arm64/java_tools/turbine_direct_graal
    --output
    bazel-out/darwin_arm64-fastbuild/bin/src/java/io/bazel/rulesscala/scalac/compileoptions/libcompileoptions-hjar.jar
    ... (remaining 32 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
  java.lang.NullPointerException:
  attempted to use --release, but JAVA_HOME is not set
    at java.base@21.0.2/java.util.Objects.requireNonNull(Objects.java:259)
    at com.google.turbine.binder.CtSymClassBinder.bind(CtSymClassBinder.java:55)
    at com.google.turbine.main.Main.release(Main.java:318)
    at com.google.turbine.main.Main.bootclasspath(Main.java:304)
    at com.google.turbine.main.Main.compile(Main.java:142)
    at com.google.turbine.main.Main.compile(Main.java:133)
    at com.google.turbine.main.Main.main(Main.java:89)
    at java.base@21.0.2/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)

INFO: Elapsed time: 0.325s, Critical Path: 0.12s
INFO: 11 processes: 10 internal, 1 worker.
FAILED: Build did NOT complete successfully
 Test "scrooge_compile_with_jdk_11" failed  (0 sec)
```

See also:

- Bazel Blog: Bazel 5.0:
  https://blog.bazel.build/2022/01/19/bazel-5.0.html#java

- bazelbuild/bazel:
  incompatible_use_toolchain_resolution_for_java_rules: use toolchain
  resolution for Java rules #7849
  bazelbuild/bazel#7849
  • Loading branch information
mbland committed Dec 8, 2024
1 parent 358b105 commit abc81e3
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions test/shell/test_twitter_scrooge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,7 @@ dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
runner=$(get_test_runner "${1:-local}")

scrooge_compile_with_jdk_11() {
# javabase and java_toolchain parameters are deprecated and may be
# removed in Bazel >= 5.0.0
bazel build --javabase=@rules_java//toolchains:remote_jdk11 \
--host_javabase=@rules_java//toolchains:remote_jdk11 \
--host_java_toolchain=@rules_java//toolchains:toolchain_java11 \
--java_toolchain=@rules_java//toolchains:toolchain_java11 \
--javacopt='--release 11' \
bazel build \
--java_language_version=11 \
--tool_java_language_version=11 \
--java_runtime_version=remotejdk_11 \
Expand Down

0 comments on commit abc81e3

Please sign in to comment.