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

wanted: com_google_protobuf #320

Closed
1 task
alexeagle opened this issue Dec 12, 2022 · 17 comments
Closed
1 task

wanted: com_google_protobuf #320

alexeagle opened this issue Dec 12, 2022 · 17 comments
Assignees
Labels
bounty-1000USD Bug Bounty: A contributor who completes this can be paid by the Rules Authors SIG module wanted Users want a certain module to be available in the BCR, contributions are welcome!

Comments

@alexeagle
Copy link
Contributor

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
@alexeagle alexeagle added bounty-1000USD Bug Bounty: A contributor who completes this can be paid by the Rules Authors SIG module wanted Users want a certain module to be available in the BCR, contributions are welcome! labels Dec 12, 2022
@comius comius self-assigned this Dec 12, 2022
@comius
Copy link
Contributor

comius commented Dec 12, 2022

Actually I'm working on this. What's missing is rules_kotlin.

@meteorcloudy
Copy link
Member

@comius Do we also have someone from the protobuf team looking into supporting Bzlmod?

@Clement-Jean
Copy link

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 bazelbuild/rules_kotlin#597 and this bazelbuild/rules_kotlin#602 but I'm not sure right now about how to solve this. If anyone has any idea, i would be interested.

@meteorcloudy
Copy link
Member

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.

@Clement-Jean
Copy link

@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)

@meteorcloudy
Copy link
Member

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.

@meteorcloudy
Copy link
Member

But can you remove the rules_kotlin dependencies in WORKSPACE.bzlmod, I don't see why fixing protobuf needs rules_kotlin to work.

@Clement-Jean
Copy link

Clement-Jean commented Dec 14, 2022

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

@meteorcloudy
Copy link
Member

I see, then this probably has to wait for bazelbuild/rules_kotlin#878

@comius
Copy link
Contributor

comius commented Dec 20, 2022

I added more info on what needs to happen on rules_kotlin in bazelbuild/rules_kotlin#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.

@meteorcloudy
Copy link
Member

Looks like the protobuf team currently doesn't have bandwidth for protocolbuffers/protobuf#12184

@Clement-Jean
Copy link

Clement-Jean commented May 22, 2023

@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

@Clement-Jean
Copy link

Turns out rules_python and rules_jvm_external are not compatible yet. Protobuf relies on rules_python@0.14.0 which is broken in the registry and rules_jvm_external@5.2 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?

@malt3
Copy link

malt3 commented Aug 31, 2023

Relevant upstream issue: protocolbuffers/protobuf#13618

It looks like things are beginning to move! Thank you to everyone involved ❤️

@chrislovecnm
Copy link

Anyone have a status?

@bgdnvk
Copy link

bgdnvk commented Dec 6, 2023

bump
ive been running into issues with gazelle here by using bazel module

@Wyverald
Copy link
Member

protobuf is now maintained by the protobuf team from Google.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bounty-1000USD Bug Bounty: A contributor who completes this can be paid by the Rules Authors SIG module wanted Users want a certain module to be available in the BCR, contributions are welcome!
Projects
None yet
Development

No branches or pull requests

8 participants