rules_scala
rules_scala copied to clipboard
Support Bzlmod and add rules_scala to bazel-central-registry
Greetings!
It looks like rules_scala isn't part of the Bzlmod effort or added to bazel-central-registry yet. I've opened an issue both here and in https://github.com/bazelbuild/bazel-central-registry to request it: https://github.com/bazelbuild/bazel-central-registry/issues/522
Just a note to anyone that starts the work native.register_toolchains is not supported when using bzlmod.
@chrislovecnm it's still available here no? https://bazel.build/rules/lib/globals/module#register_toolchains
@sluongng When I last tried it, it did not work when using it inside an extension. In rules_python we are skipping the native call:
https://github.com/bazelbuild/rules_python/blob/36082079b514529d4009a2b104475fde1cdd5b30/python/repositories.bzl#L569
And build the toolchains here:
https://github.com/bazelbuild/rules_python/blob/36082079b514529d4009a2b104475fde1cdd5b30/python/extensions/private/pythons_hub.bzl#L56
We build the toolchains and use the following:
https://github.com/bazelbuild/rules_python/blob/36082079b514529d4009a2b104475fde1cdd5b30/MODULE.bazel#L49
Yeah you would only want to prepare the toolchain (as a new repository) inside the extension I think. Registering it must be called from the MODULE.bazel file.
So native.register_toolchains call from the extension's starlark does not work, but having the extension create @pythons_hub//:all and then MODULE.bazel calling register_toolchains("@pythons_hub//:all") worked. 👍
I prepared a minimal bzlmod support here and gonna split it into a few PRs TODOs after merging it:
- write documentation on how to use rules_scala with bzlmod (some properties like
SCALA_VERSIONwill probably be configurable via repo-env) - prepare release notes
- contribute repo to the Bazel Central Registry
- add tests that the project builds using both WORKSPACE and MODULE.bazel
- migrate test/external workspaces to blzmod too
@mateuszkuta256 thanks for getting this started! Any progress updates or blockers?
@mateuszkuta256 thanks for getting this started! Any progress updates or blockers?
hi, unfortunately I'm working on other things now and won't continue with this PR in the foreseeable future I remember this migration was on hold because interfered with 'cross compilation support' It looks like great progress was done it this area, so maybe someone can already take over the PR