Skip to content

Add bazel targets for standalone plugin binaries#23919

Closed
bufdev wants to merge 10 commits into
protocolbuffers:mainfrom
bufdev:standalone-plugins
Closed

Add bazel targets for standalone plugin binaries#23919
bufdev wants to merge 10 commits into
protocolbuffers:mainfrom
bufdev:standalone-plugins

Conversation

@bufdev

@bufdev bufdev commented Oct 10, 2025

Copy link
Copy Markdown
Contributor

Follow-up to #23736 and #13308 but with only Bazel targets added per feedback.

This PR adds targets to build protoc plugins for all the built-in plugins. This will result in the following binaries being available:

  • protoc-gen-cpp
  • protoc-gen-csharp
  • protoc-gen-java
  • protoc-gen-kotlin
  • protoc-gen-objectivec
  • protoc-gen-php
  • protoc-gen-python
  • protoc-gen-pyi
  • protoc-gen-ruby
  • protoc-gen-rust

@bufdev bufdev requested review from a team as code owners October 10, 2025 17:50
@bufdev bufdev requested review from JasonLunn, ericsalo, jskeet, shaod2 and thomasvl and removed request for a team October 10, 2025 17:50
srikrsna-buf and others added 2 commits October 10, 2025 23:55
Signed-off-by: Sri Krishna <skrishna@buf.build>
@thomasvl thomasvl removed their request for review October 10, 2025 19:13
@zhangskz zhangskz added the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Oct 15, 2025
@github-actions github-actions Bot removed the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Oct 15, 2025
name = "protoc-gen-cpp",
srcs = ["main.cc"],
visibility = ["//:__pkg__"],
visibility = ["//visibility:public"],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you mark these all as //visibility:private for now? While we may want to officially support and release standalone binaries for these plugins at some point in the future, we would likely need to add corresponding supporte policies and / or poison pills to ensure protoc and plugin are used with supported version combinations first. Currently defacto with the built-in generators is that protoc + plugins are necessarily at the same version by default.

Keeping these private for now may help a bit with accidental mis-use in the interim, until we can get guardrails in place.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, making these private would pretty much defeat the goal of this PR - making these usable by others is the whole point :-)

Re: poison pills, do you just mean something like https://github.com/bufbuild/buf/blob/d500877026294fa52819fb20b98101d2c2c70fe3/private/gen/proto/go/buf/alpha/image/v1/image.pb.go#L33 or do you mean something more extensive? If this, we're happy to do this in this PR. If something more extensive, I'd question the need or desire - the rest of the Protobuf plugin ecosystem functions just fine without these type of block FWIW, and I think that's appropriate.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I was referring to some sort of version check enforcing only compatible versions are used!

Discussed with the team and it should be ok to accept these as public targets. Note though that we don't have guarantees for these in our support matrix yet for how these targets would be expected to behave yet esp when versions are mixed, so I do err on preffering some guardrails here (but followup should be fine for that).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK great to hear. Other than the failing tests below (which I think are unrelated, I'll merge the latest from main) is there anything else you'd like us to do in this PR?

@@ -0,0 +1,14 @@
// Protocol Buffers - Google's data interchange format

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you rename these to plugin_main.cc instead of main.cc for consistency?

Looks like we use main.cc for c++ and rust today, and plugin_main.cc for java and python. I think plugin_main.cc is better here, and we should rename c++ and rust to follow that convention as well.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

srikrsna-buf and others added 2 commits October 16, 2025 00:23
Signed-off-by: Sri Krishna <skrishna@buf.build>
@zhangskz zhangskz added the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Nov 12, 2025
@bufdev

bufdev commented May 16, 2026

Copy link
Copy Markdown
Contributor Author

Done! I think you need to re-tag it for tests, but should be good to go otherwise!

@JasonLunn JasonLunn added 🅰️ safe for tests Mark a commit as safe to run presubmits over and removed untriaged auto added to all issues by default when created. labels May 16, 2026
@github-actions github-actions Bot removed the 🅰️ safe for tests Mark a commit as safe to run presubmits over label May 16, 2026
@JasonLunn

Copy link
Copy Markdown
Member

@bufdev - Please take a look at the failing tests from the last run.

@JasonLunn JasonLunn added the keep open keep inactive issues open for janitor label May 17, 2026
@bufdev

bufdev commented May 17, 2026

Copy link
Copy Markdown
Contributor Author

@JasonLunn I can only see the current test run, and the reason it is failing is the lack of maintainer approval for the tests to run:

I can't see other test jobs than those. If there's some other failure, I'm unable to see it as a contributor, let me know.

@bufdev

bufdev commented May 17, 2026

Copy link
Copy Markdown
Contributor Author

How did you find that? That's not surfaced to me here or in the Actions view in something I can list. Regardless, I'll look into these failures, thanks.

@bufdev

bufdev commented May 17, 2026

Copy link
Copy Markdown
Contributor Author

Hopefully fixed now? I think it was a bad merge issue. Any chance you can run it again? Apologies for the back and forth.

@JasonLunn JasonLunn added 🅰️ safe for tests Mark a commit as safe to run presubmits over and removed wait for user action labels May 17, 2026
@github-actions github-actions Bot removed the 🅰️ safe for tests Mark a commit as safe to run presubmits over label May 17, 2026
@JasonLunn

JasonLunn commented May 17, 2026

Copy link
Copy Markdown
Member

@bufdev - I’m going to hold off re-labeling in case that’s what obscures the links to the test runs for you

@JasonLunn JasonLunn added the 🅰️ safe for tests Mark a commit as safe to run presubmits over label May 17, 2026
@github-actions github-actions Bot removed the 🅰️ safe for tests Mark a commit as safe to run presubmits over label May 17, 2026
@bufdev

bufdev commented May 17, 2026

Copy link
Copy Markdown
Contributor Author

Phew!

@JasonLunn JasonLunn added the 🅰️ safe for tests Mark a commit as safe to run presubmits over label May 18, 2026
@github-actions github-actions Bot removed the 🅰️ safe for tests Mark a commit as safe to run presubmits over label May 18, 2026
copybara-service Bot pushed a commit that referenced this pull request Jun 18, 2026
This is a bit cheeky, but when looking at #23919, I realized we had never added Buf's OSS tools to the third-party list! And by any objective measure, in each category in this PR, they're the most widely-used third-party tools in 2026, so I figured I'd put this up.

Closes #27435

COPYBARA_INTEGRATE_REVIEW=#27435 from bufdev:third-party-buf 1eee151
PiperOrigin-RevId: 934577706
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bazel keep open keep inactive issues open for janitor protoc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants