-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JavaTestRunner missing dependency warning on MacOS 11 #299
Comments
Related issue: bazelbuild/bazel#16109 According to that issue, the strict java deps checking depends on a bugfix in Java 11. Which might not have landed in the zulu JRE we are getting from nixpkgs. From the build logs here it is:
The issue mentions |
Confirming. Using an official Bazel binary on MacOS (via bazelisk) also fails, so it is not a Bazel packaging issue. The runner on Github uses Eclipse Temurin 11.0.17+8 by default. Using Eclipse Temurin 11.0.16 from nixpkgs also works fine. Changes to reproduce: diff --git a/core/.bazelrc b/core/.bazelrc
index 1f1bbc4..c238ef0 100644
--- a/core/.bazelrc
+++ b/core/.bazelrc
@@ -7,9 +7,9 @@ build --crosstool_top=@nixpkgs_config_cc//:toolchain
# recommended for `nixpkgs_cc_configure_hermetic`.
# build --incompatible_enable_cc_toolchain_resolution
-build --java_runtime_version=nixpkgs_java_11
+build --java_runtime_version=nixpkgs_temurin
build --java_language_version=11
-build --tool_java_runtime_version=nixpkgs_java_11
+build --tool_java_runtime_version=nixpkgs_temurin
build --tool_java_language_version=11
# User Configuration
diff --git a/toolchains/java/WORKSPACE b/toolchains/java/WORKSPACE
index b1a7cbc..ae62076 100644
--- a/toolchains/java/WORKSPACE
+++ b/toolchains/java/WORKSPACE
@@ -14,6 +14,16 @@ load("@io_tweag_rules_nixpkgs//nixpkgs:repositories.bzl", "rules_nixpkgs_depende
rules_nixpkgs_dependencies(toolchains = ['cc', 'posix'])
+load("//:java.bzl", "nixpkgs_java_configure")
+
+nixpkgs_java_configure(
+ attribute_path = "temurin-bin-11.home",
+ repository = "@nixpkgs",
+ toolchain = True,
+ toolchain_name = "nixpkgs_temurin",
+ toolchain_version = "11",
+)
+
load("@rules_nixpkgs_core//docs:dependencies_1.bzl", "docs_dependencies_1")
docs_dependencies_1() BTW, this is not only a problem when switching to Bazel 6, it also fails with Bazel 5 as can be observed by the warning here for the changes in PR #273 . |
This causes a warning instead of an error for strict Java dependencies on MacOS. This is a temporary workaround for #299 and should be removed as soon as that issue is resolved.
The JRE we get from nixpkgs is now recent enough and strict deps checking works properly. Fixes #299
Describe the bug
In #273 there are a bunch of changes to the Java toolchain to support using rules_nixpkgs with Bazel 6.
This fixes the main issues, but there is a failure in CI on MacOS while running the Java tests, with an error about needing to explicitly declare a dependency on
@bazel_tools//tools/jdk:TestRunner
, with error message recommending runningbuildozer 'add deps @bazel_tools//tools/jdk:TestRunner' //tests:java-test
. Explicitly adding the dependency does not solve the problem and results in the same issue.The temporary workaround for now is to setting the flag
--experimental_strict_java_deps=warn
, but we would like to remove this flag and have the Java tests work.To Reproduce
In
flake.nix
, use nixpkgs version 22.11, and switchbazel_5
tobazel_6
in the build inputs.In
.bazelrc
, remove the linebuild --experimental_strict_java_deps=warn
.Run the Java toolchain tests on MacOS 11:
Expected behavior
We should be able to remove the flag
--experimental_strict_java_deps=warn
, run the Java toolchain tests, and not have any failuresEnvironment
Additional context
My guess is that this is related to how Bazel 6 is packaged in nixpkgs, where there are some particular patches to the the Java toolchain.
The text was updated successfully, but these errors were encountered: