Skip to content
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

Merged
merged 11 commits into from
Feb 13, 2023
Merged

Conversation

aherrmann
Copy link
Member

@aherrmann aherrmann commented Feb 9, 2023

Depends on #319

Creates a new module in testing/java and moves the tests from toolchains/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 on rules_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, but rules_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.

`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.
@aherrmann
Copy link
Member Author

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.

@aherrmann aherrmann changed the base branch from bzlmod-core to master February 9, 2023 17:13
@aherrmann aherrmann changed the base branch from master to bzlmod-core February 10, 2023 14:44
@aherrmann aherrmann marked this pull request as ready for review February 10, 2023 14:46
Base automatically changed from bzlmod-core to master February 10, 2023 15:36
@dpulls
Copy link

dpulls bot commented Feb 10, 2023

🎉 All dependencies have been resolved !

Copy link
Member

@benradf benradf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

registry/README.md Outdated Show resolved Hide resolved
@aherrmann aherrmann added the merge-queue merge on green CI label Feb 13, 2023
@mergify mergify bot merged commit 69346fe into master Feb 13, 2023
@mergify mergify bot deleted the bzlmod-java branch February 13, 2023 16:56
@mergify mergify bot removed the merge-queue merge on green CI label Feb 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants