Open keith opened 1 month ago
The coursier
dependency is a production dependency, and needs to be included.
My experience with bzlmod
is that it behaves sufficiently differently between Bazel 6 and 7 that I'd rather not invest effort in attempting to support bzlmod
with Bazel 6. For people doing the migration to bzlmod
, the smoother path (IME) has been to use --noenable_bzlmod
and update to Bazel 7 first, and then update to using bzlmod
afterwards.
It is also possible to use a module extension which is already available in Bazel 6:
# MODULE:bazel
non_module_deps = use_extension("//bazel:non_module_deps.bzl", "non_module_deps")
use_repo(non_module_deps, "coursier_cli"")
# non_module_deps.bzl
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file")
def _non_module_deps_impl(ctx):
http_file(
name = "coursier_cli",
sha256 = COURSIER_CLI_SHA256,
urls = [COURSIER_CLI_GITHUB_ASSET_URL],
)
non_module_deps_ext = module_extension(implementation = _non_module_deps_impl)
As far as I can tell all the uses of http_file in the MODULE.bazel are dev dependencies, therefore they're easy to move to the WORKSPACE.bzlmod to avoid using the bazel 7.x only API. I submitted this despite the conversation in the linked issue because rules_jvm_external is sa transitive dependency of tons of repos which are still pinning bazel 6.x. This stems from the fact that protobuf and grpc have this as a dependency.
Fixes https://github.com/bazelbuild/rules_jvm_external/issues/1055