bazel-central-registry
bazel-central-registry copied to clipboard
wanted: com_google_protobuf
Module location
https://github.com/protocolbuffers/protobuf
Link to bzlmod issue in the module's repository
No response
Any other context to provide?
@yannic says this is the next step to unblocking rules_proto usage in bzlmod.
Fund our work
- [ ] Sponsor our community's open source work by donating a feature bounty
Actually I'm working on this. What's missing is rules_kotlin.
@comius Do we also have someone from the protobuf team looking into supporting Bzlmod?
I'm actually also working on this but I'm facing the following error:
ERROR: error loading package 'java/kotlin': at /private/var/tmp/_bazel_clement/5892ceef4629d9b2aad305f593ba52a0/external/rules_jvm_external.4.5/kt_defs.bzl:19:6: at /private/var/tmp/_bazel_clement/5892ceef4629d9b2aad305f593ba52a0/external/rules_jvm_external.4.5/private/rules/kt_jvm_export.bzl:1:6: at /private/var/tmp/_bazel_clement/5892ceef4629d9b2aad305f593ba52a0/external/rules_jvm_external.4.5.non_module_deps.io_bazel_rules_kotlin/kotlin/jvm.bzl:9:5: at /private/var/tmp/_bazel_clement/5892ceef4629d9b2aad305f593ba52a0/external/rules_jvm_external.4.5.non_module_deps.io_bazel_rules_kotlin/kotlin/internal/opts.bzl:22:5: Unable to find package for @io_bazel_rules_kotlin_configured//jvm:opts.bzl: The repository '@io_bazel_rules_kotlin_configured' could not be resolved: Repository '@io_bazel_rules_kotlin_configured' is not visible from repository '@rules_jvm_external.4.5.non_module_deps.io_bazel_rules_kotlin'.
I tried to add the following in my WORKSPACE.bzlmod:
rules_kotlin_version = "1.6.0"
rules_kotlin_sha = "a57591404423a52bd6b18ebba7979e8cd2243534736c5c94d35c89718ea38f94"
http_archive(
name = "io_bazel_rules_kotlin",
urls = ["https://github.com/bazelbuild/rules_kotlin/releases/download/v%s/rules_kotlin_release.tgz" % rules_kotlin_version],
sha256 = rules_kotlin_sha,
)
load("@io_bazel_rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories")
kotlin_repositories()
load("@io_bazel_rules_kotlin//kotlin:core.bzl", "kt_register_toolchains")
kt_register_toolchains()
but so far it doesn't work.
That seems to be related to https://github.com/bazelbuild/rules_kotlin/issues/597 and this https://github.com/bazelbuild/rules_kotlin/issues/602 but I'm not sure right now about how to solve this. If anyone has any idea, i would be interested.
rules_jvm_external.4.5
It looks like you are using an old version of Bazel, can you try again with the latest 6.0 rc? If it still doesn't work, please try to file an issue to https://github.com/bazelbuild/rules_jvm_external and provide a reproducible case.
@meteorcloudy 4.5 seems to be the version available on: Bazel Central Register and on Github, isn't it ?
Anyway, I moved to bazelisk and version 6.0.0rc4 and I have another error:
ERROR: Traceback (most recent call last):
File "/Users/clement/Git/protobuf/WORKSPACE.bzlmod", line 12, column 20, in <toplevel>
kotlin_repositories()
File "/private/var/tmp/_bazel_clement/5892ceef4629d9b2aad305f593ba52a0/external/io_bazel_rules_kotlin/src/main/starlark/core/repositories/initialize.bzl", line 96, column 21, in kotlin_repositories
rules_repository(
Error in repository_rule: invalid user-provided repo name '': valid names may contain only A-Z, a-z, 0-9, '-', '_', '.', and must start with a letter
ERROR: Error computing the main repository mapping: at /private/var/tmp/_bazel_clement/5892ceef4629d9b2aad305f593ba52a0/external/io_bazel_rules_kotlin/kotlin/core.bzl:2:5: at /private/var/tmp/_bazel_clement/5892ceef4629d9b2aad305f593ba52a0/external/io_bazel_rules_kotlin/kotlin/internal/opts.bzl:22:5: Encountered error while reading extension file 'jvm/opts.bzl': no such package '@io_bazel_rules_kotlin_configured//jvm': error loading package 'external': Could not load //external package
I opened an issue on the rules_kotlin repository (issue)
4.5 seems to be the version available on: Bazel Central Register and on Github, isn't it ?
Yes, that's the latest rules_jvm_external version. You'll also need to the latest bazel version ;)
With Bzlmod, we have stricter repository name validation, probably some repo name needs to be fixed in rules_kotlin.
But can you remove the rules_kotlin dependencies in WORKSPACE.bzlmod, I don't see why fixing protobuf needs rules_kotlin to work.
When I remove the rules_kotlin, I have this error:
ERROR: Skipping '//...': error loading package under directory '': error loading package 'java/kotlin-lite': Unable to find package for @[unknown repo 'io_bazel_rules_kotlin' requested from @]//kotlin:jvm.bzl: The repository '@[unknown repo 'io_bazel_rules_kotlin' requested from @]' could not be resolved: No repository visible as '@io_bazel_rules_kotlin' from main repository.
WARNING: Target pattern parsing failed.
ERROR: error loading package under directory '': error loading package 'java/kotlin-lite': Unable to find package for @[unknown repo 'io_bazel_rules_kotlin' requested from @]//kotlin:jvm.bzl: The repository '@[unknown repo 'io_bazel_rules_kotlin' requested from @]' could not be resolved: No repository visible as '@io_bazel_rules_kotlin' from main repository.
we actually need rules_kotlin because in the java/kotlin and kotlin-lite directory we use the kt_jvm_library
rule (here).
I see, then this probably has to wait for https://github.com/bazelbuild/rules_kotlin/pull/878
I added more info on what needs to happen on rules_kotlin in https://github.com/bazelbuild/rules_kotlin/issues/660
Do we also have someone from the protobuf team looking into supporting Bzlmod?
Not anybody in particular, but I've heard they are interested.
Looks like the protobuf team currently doesn't have bandwidth for https://github.com/protocolbuffers/protobuf/issues/12184
@meteorcloudy Still on this. I have the following error now:
No repository visible as '@io_bazel_rules_kotlin_configured' from repository '@rules_jvm_external~5.2~non_module_deps~io_bazel_rules_kotlin'.
We seem to have a problem with either koltin or jvm external rule.
If anyone wants to check here is the repo: https://github.com/Clement-Jean/protobuf/tree/bzlmod
I'm able to run the following commands:
bazel build --enable_bzlmod //:protobuf
bazel build --enable_bzlmod //:protoc
bazel build --enable_bzlmod //:protobuf_lite
bazel build --enable_bzlmod //:protobuf_python
but not:
bazel test --enable_bzlmod //java:tests
Turns out rules_python and rules_jvm_external are not compatible yet. Protobuf relies on [email protected] which is broken in the registry and [email protected] gives the kotlin error shown in the previous comment.
However, I have temporarily added them into the WORKSPACE.bzlmod. It seems that it is working, how could I test this further?
Relevant upstream issue: https://github.com/protocolbuffers/protobuf/issues/13618
It looks like things are beginning to move! Thank you to everyone involved ❤️
Anyone have a status?
bump ive been running into issues with gazelle here by using bazel module
protobuf
is now maintained by the protobuf team from Google.