rules_scala icon indicating copy to clipboard operation
rules_scala copied to clipboard

Support Bzlmod and add rules_scala to bazel-central-registry

Open sfc-gh-pbennes opened this issue 2 years ago • 21 comments
trafficstars

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

sfc-gh-pbennes avatar Mar 16 '23 23:03 sfc-gh-pbennes

Just a note to anyone that starts the work native.register_toolchains is not supported when using bzlmod.

chrislovecnm avatar Jul 11 '23 15:07 chrislovecnm

@chrislovecnm it's still available here no? https://bazel.build/rules/lib/globals/module#register_toolchains

sluongng avatar Jul 11 '23 15:07 sluongng

@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

chrislovecnm avatar Jul 11 '23 15:07 chrislovecnm

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. 👍

sluongng avatar Jul 11 '23 15:07 sluongng

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_VERSION will 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 avatar Jan 24 '24 08:01 mateuszkuta256

@mateuszkuta256 thanks for getting this started! Any progress updates or blockers?

pcj avatar Jun 30 '24 17:06 pcj

@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

mateuszkuta256 avatar Jul 01 '24 08:07 mateuszkuta256