Skip to content

WIP: bzlmod reprise #382

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open

WIP: bzlmod reprise #382

wants to merge 16 commits into from

Conversation

pcj
Copy link
Member

@pcj pcj commented Jan 20, 2025

No description provided.

@brianchesko
Copy link

brianchesko commented Feb 19, 2025

In case it helps anyone, I've also been interested in this project and when I saw more activity here I attempted to upgrade my project's WORKSPACE dependency of this repo to the current bzlmod latest in this branch (62a16a3 as of writing)

I ended up having some issues with the javascript and grpc_web deps, but was able to resolve for my use case by making this patch (also forked here) and specifying the same protobuf_javascript override in my repo:

bazel_dep(name = "build_stack_rules_proto")
git_override(
    module_name = "build_stack_rules_proto",
    remote = "https://github.com/stackb/rules_proto.git",
    commit = "62a16a36c1e1092a0c55767de6c5c574a5ebf13e",  # WIP upstream bzlmod branch pcj/bzlmod-wip
    # patch upstream to fix protobuf_javascript and grpc_web deps
    # see also: https://github.com/stackb/rules_proto/pull/382#issuecomment-2669653947
    patches = ["//:patches/stackb.patch"],
    patch_strip = 1,
)

# overriding build_stack_rules_proto~protobuf_javascript
git_override(
    module_name = "protobuf_javascript",
    commit = "5d939dbc8fd5245c4316d52c203a1bff24bac5c4",  # https://github.com/protocolbuffers/protobuf-javascript/commit/05560593d93e7207e84829b3ab6a80c08078e389
    remote = "https://github.com/protocolbuffers/protobuf-javascript",
)

Obviously not ideal compared to having stackb/rules_proto declare all of its plugin dependencies directly, but I also tried modifying this branches MODULE to pull in com_google_protobuf_javascript as a module extension and it was failing to resolve something from my repo (maybe com_google_protobuf)

Interestingly, I also had to comment out common --incompatible_enable_proto_toolchain_resolution in my .bazelrc or I would error out with
"Protobuf C++ gencode is built with an incompatible version of Protobuf C++ headers/runtime. See https://protobuf.dev/support/cross-version-runtime-guarantee/#cpp" in my build logs -- I'm not sure if that's due to github_com_grpc_grpc_web being a WORKSPACE-style module extension, but something there isn't playing nice with the hermetic toolchains_protoc toolchain I suppose

Bonus patch for a dangling reference to @io_bazel_rules_go if you're using proto_gazelle: https://gist.github.com/brianchesko/5fdfff1be99f14422c6e013f30b55a75

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants