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

Fix java toolchain config to allow for use with Bazel 6 #273

Merged
merged 2 commits into from
Jan 6, 2023

Conversation

tshaynik
Copy link
Contributor

@tshaynik tshaynik commented Oct 14, 2022

Resolves #272

This change allows for using rules_nixpkgs with Bazel 6, by fixing an issue caused by changes in how java toolchains are configured.

This works by pulling in versions of local_java_repository.bzl and default_java_toolchain.bzl from a newer version of Bazel, and reapplying the the changes necessary to enforce the constraint that nix be present.

TODO before merging:

  • Get Bump nix version for testing to 2.7  #270 merged first
  • investigate MacOS failure on Bazel 6 from nixpkgs-unstable
  • discuss our strategy for managing the two vendored java toolchains files (PR made to Bazel is orthogonal)
  • Revert to nixpkgs-22.05 and Bazel 5 before merging!!! Rebase and clean up commits

@tshaynik tshaynik force-pushed the bazel6-java-toolchain branch 5 times, most recently from 871a9a7 to 9f0230a Compare October 24, 2022 16:44
@tshaynik
Copy link
Contributor Author

The java tests failure on MacOS seems to be resolved by setting --strict_java_deps=warn. I'm not sure if that's something that we want to add to the .bazelrc permanently, and still not sure what has changed that would have made this error start appearing.

default_java_toolchain.bzl and local_java_repository.bzl are
included from Bazel commit 3d5c5d746b286c840ba5cfd437d93d8d11995e02
and modified to add support for nix constraints.

Closes #272
@tshaynik
Copy link
Contributor Author

This is rebased, tested with Bazel 6, and now reset to Bazel 5, and ready for review.

I've created #299 to track the lingering Java test dependency issue on MacOS, and plan for the removal of the --experimental_strict_java_deps=warn workaround.

@tshaynik tshaynik marked this pull request as ready for review December 22, 2022 16:00
@tshaynik tshaynik changed the title WIP: Fix java toolchain config to allow for use with Bazel 6 Fix java toolchain config to allow for use with Bazel 6 Dec 22, 2022
core/.bazelrc Outdated Show resolved Hide resolved
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.
@tshaynik
Copy link
Contributor Author

tshaynik commented Jan 5, 2023

@avdv I just wanted to follow up about this PR! Is there anything else this needs before it can be merged?

Copy link
Member

@avdv avdv left a comment

Choose a reason for hiding this comment

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

Thanks for reminding me @tshaynik 😄 , looks good!

@tshaynik tshaynik merged commit 51d83a3 into master Jan 6, 2023
@tshaynik tshaynik deleted the bazel6-java-toolchain branch January 6, 2023 14:52
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.

rules_nixpkgs does not work with Bazel 6
2 participants