-
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
Separate toolchains/java tests and run with bzlmod enabled #320
Conversation
`native.register_toolchains` can no longer be used in repository macros under bzlmod. Instead, toolchain registration has to occur in the MODULE.bazel file.
Configures a nixpkgs provided Java toolchain in both WORKSPACE and bzlmod mode. In bzlmod mode we need to import a range of transitive dependencies, like rules_java, platforms, or even remote_java_tools, because the Java toolchain is defined in an ad-hoc local module extension. These should no longer be needed at the use-site once nixpkgs_java_configure is a module extension in rules_nixpkgs_java.
The correct configuration for dpulls is to have this PR based on the dependency branch. However, due to the CI configuration this doesn't run CI. So I'm switch the base branch back to master. Perhaps we should change the CI configuration to allow CI on all PRs. |
🎉 All dependencies have been resolved ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍
Depends on #319
Creates a new module in
testing/java
and moves the tests fromtoolchains/java
into this module following the motivation from tweag/rules_sh#41.Makes the Java toolchain registration optional, as the corresponding
native.register_toolchains
cannot be called in a repository macro under bzlmod.Building
toolchains/java
with bzlmod enabled raised a problem: The module depends onrules_nixpkgs_core
, but cannot find it in the Bazel Central Registry. The obvious solution,local_path_override
does not work, because that is only allowed in the main module, butrules_nixpkgs_java
is a library module. The next best solution--override_module
is awkward, because that flag requires an absolute path, does not support%workspace%
expansion, and must not be set for the module it is overriding.The solution chosen in this PR is to use a local Bazel registry. The corresponding configuration flag
--registry
does support%workspace%
expansion and is therefore easier to configure.