Skip to content
2 changes: 1 addition & 1 deletion src/google/protobuf/compiler/cpp/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ load("//build_defs:cpp_opts.bzl", "COPTS")
cc_binary(
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?

deps = [
":cpp",
"//src/google/protobuf/compiler:plugin",
Expand Down
10 changes: 10 additions & 0 deletions src/google/protobuf/compiler/csharp/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix")
load("//build_defs:cpp_opts.bzl", "COPTS")

cc_binary(
name = "protoc-gen-csharp",
srcs = ["main.cc"],
visibility = ["//visibility:public"],
deps = [
":csharp",
"//src/google/protobuf/compiler:plugin",
],
)

cc_library(
name = "names",
srcs = ["names.cc"],
Expand Down
14 changes: 14 additions & 0 deletions src/google/protobuf/compiler/csharp/main.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd

#include "google/protobuf/compiler/csharp/csharp_generator.h"
#include "google/protobuf/compiler/plugin.h"

int main(int argc, char *argv[]) {
google::protobuf::compiler::csharp::Generator generator;
return google::protobuf::compiler::PluginMain(argc, argv, &generator);
}
10 changes: 10 additions & 0 deletions src/google/protobuf/compiler/java/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ package(
],
)

cc_binary(
name = "protoc-gen-java",
srcs = ["plugin_main.cc"],
visibility = ["//visibility:public"],
deps = [
":java",
"//src/google/protobuf/compiler:plugin",
],
)

cc_library(
name = "names",
hdrs = ["names.h"],
Expand Down
10 changes: 10 additions & 0 deletions src/google/protobuf/compiler/kotlin/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
load("//build_defs:cpp_opts.bzl", "COPTS")

cc_binary(
name = "protoc-gen-kotlin",
srcs = ["main.cc"],
visibility = ["//visibility:public"],
deps = [
":kotlin",
"//src/google/protobuf/compiler:plugin",
],
)

cc_library(
name = "generator_headers",
hdrs = ["generator.h"],
Expand Down
14 changes: 14 additions & 0 deletions src/google/protobuf/compiler/kotlin/main.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd

#include "google/protobuf/compiler/kotlin/generator.h"
#include "google/protobuf/compiler/plugin.h"

int main(int argc, char *argv[]) {
google::protobuf::compiler::kotlin::KotlinGenerator generator;
return google::protobuf::compiler::PluginMain(argc, argv, &generator);
}
10 changes: 10 additions & 0 deletions src/google/protobuf/compiler/objectivec/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix")
load("//build_defs:cpp_opts.bzl", "COPTS")

cc_binary(
name = "protoc-gen-objectivec",
srcs = ["main.cc"],
visibility = ["//visibility:public"],
deps = [
":objectivec",
"//src/google/protobuf/compiler:plugin",
],
)

cc_library(
name = "names",
hdrs = ["names.h"],
Expand Down
14 changes: 14 additions & 0 deletions src/google/protobuf/compiler/objectivec/main.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd

#include "google/protobuf/compiler/objectivec/generator.h"
#include "google/protobuf/compiler/plugin.h"

int main(int argc, char *argv[]) {
google::protobuf::compiler::objectivec::ObjectiveCGenerator generator;
return google::protobuf::compiler::PluginMain(argc, argv, &generator);
}
10 changes: 10 additions & 0 deletions src/google/protobuf/compiler/php/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ load("@rules_cc//cc:defs.bzl", "cc_library")
load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix")
load("//build_defs:cpp_opts.bzl", "COPTS")

cc_binary(
name = "protoc-gen-php",
srcs = ["main.cc"],
visibility = ["//visibility:public"],
deps = [
":php",
"//src/google/protobuf/compiler:plugin",
],
)

cc_library(
name = "names",
srcs = ["names.cc"],
Expand Down
14 changes: 14 additions & 0 deletions src/google/protobuf/compiler/php/main.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd

#include "google/protobuf/compiler/php/php_generator.h"
#include "google/protobuf/compiler/plugin.h"

int main(int argc, char *argv[]) {
google::protobuf::compiler::php::Generator generator;
return google::protobuf::compiler::PluginMain(argc, argv, &generator);
}
20 changes: 20 additions & 0 deletions src/google/protobuf/compiler/python/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,26 @@ load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix")
load("//build_defs:cpp_opts.bzl", "COPTS")

cc_binary(
name = "protoc-gen-python",
srcs = ["plugin_main.cc"],
visibility = ["//visibility:public"],
deps = [
":python",
"//src/google/protobuf/compiler:plugin",
],
)

cc_binary(
name = "protoc-gen-pyi",
srcs = ["pyi_main.cc"],
visibility = ["//visibility:public"],
deps = [
":python",
"//src/google/protobuf/compiler:plugin",
],
)

cc_library(
name = "generator_headers",
hdrs = [
Expand Down
14 changes: 14 additions & 0 deletions src/google/protobuf/compiler/python/pyi_main.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd

#include "google/protobuf/compiler/plugin.h"
#include "google/protobuf/compiler/python/pyi_generator.h"

int main(int argc, char *argv[]) {
google::protobuf::compiler::python::PyiGenerator generator;
return google::protobuf::compiler::PluginMain(argc, argv, &generator);
}
10 changes: 10 additions & 0 deletions src/google/protobuf/compiler/ruby/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix")
load("//build_defs:cpp_opts.bzl", "COPTS")

cc_binary(
name = "protoc-gen-ruby",
srcs = ["main.cc"],
visibility = ["//visibility:public"],
deps = [
":ruby",
"//src/google/protobuf/compiler:plugin",
],
)

cc_library(
name = "generator_headers",
hdrs = ["ruby_generator.h"],
Expand Down
14 changes: 14 additions & 0 deletions src/google/protobuf/compiler/ruby/main.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd

#include "google/protobuf/compiler/plugin.h"
#include "google/protobuf/compiler/ruby/ruby_generator.h"

int main(int argc, char *argv[]) {
google::protobuf::compiler::ruby::Generator generator;
return google::protobuf::compiler::PluginMain(argc, argv, &generator);
}
2 changes: 1 addition & 1 deletion src/google/protobuf/compiler/rust/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ load(
cc_binary(
name = "protoc-gen-rust",
srcs = ["main.cc"],
visibility = ["//rust:__pkg__"],
visibility = ["//visibility:public"],
deps = [
":rust",
"//src/google/protobuf/compiler:plugin",
Expand Down
Loading