Skip to content

Commit 98678cf

Browse files
authored
Add protoc v22.0 plugins (#373)
1 parent 8451372 commit 98678cf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+470
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*
2+
!BUILD
3+
!cpp.cc
4+
!Dockerfile
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
cc_binary(
2+
name = "protoc-gen-cpp",
3+
srcs = ["cpp.cc"],
4+
deps = [
5+
"//:protoc_lib",
6+
],
7+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# syntax=docker/dockerfile:1.4
2+
FROM debian:bullseye-20230208 AS build
3+
4+
ARG TARGETARCH
5+
6+
RUN apt-get update \
7+
&& apt-get install -y curl git cmake build-essential g++ unzip zip
8+
RUN arch=${TARGETARCH}; \
9+
if [ "${arch}" = "amd64" ]; then arch="x86_64"; fi; \
10+
curl -fsSL -o /usr/local/bin/bazel https://github.com/bazelbuild/bazel/releases/download/6.0.0/bazel-6.0.0-linux-${arch} \
11+
&& chmod +x /usr/local/bin/bazel
12+
13+
WORKDIR /build
14+
RUN git clone https://github.com/protocolbuffers/protobuf --depth 1 --branch v22.0 --recursive
15+
WORKDIR /build/protobuf/
16+
RUN bazel build '//:protoc_lib'
17+
COPY --link BUILD cpp.cc plugins/
18+
RUN bazel build '//plugins:protoc-gen-cpp.stripped'
19+
20+
FROM gcr.io/distroless/cc-debian11
21+
COPY --from=build --link --chmod=0755 /build/protobuf/bazel-bin/plugins/protoc-gen-cpp .
22+
USER nobody
23+
ENTRYPOINT ["/protoc-gen-cpp"]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
version: v1
2+
name: buf.build/protocolbuffers/cpp
3+
plugin_version: v22.0
4+
source_url: https://github.com/protocolbuffers/protobuf
5+
description: Base types for C++. Generates message and enum types.
6+
output_languages:
7+
- cpp
8+
spdx_license_id: BSD-3-Clause
9+
license_url: https://github.com/protocolbuffers/protobuf/blob/v22.0/LICENSE
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include <google/protobuf/compiler/cpp/generator.h>
2+
#include <google/protobuf/compiler/plugin.h>
3+
4+
int main(int argc, char *argv[]) {
5+
google::protobuf::compiler::cpp::CppGenerator generator;
6+
return google::protobuf::compiler::PluginMain(argc, argv, &generator);
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*
2+
!BUILD
3+
!csharp.cc
4+
!Dockerfile
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
cc_binary(
2+
name = "protoc-gen-csharp",
3+
srcs = ["csharp.cc"],
4+
deps = [
5+
"//:protoc_lib",
6+
],
7+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# syntax=docker/dockerfile:1.4
2+
FROM debian:bullseye-20230208 AS build
3+
4+
ARG TARGETARCH
5+
6+
RUN apt-get update \
7+
&& apt-get install -y curl git cmake build-essential g++ unzip zip
8+
RUN arch=${TARGETARCH}; \
9+
if [ "${arch}" = "amd64" ]; then arch="x86_64"; fi; \
10+
curl -fsSL -o /usr/local/bin/bazel https://github.com/bazelbuild/bazel/releases/download/6.0.0/bazel-6.0.0-linux-${arch} \
11+
&& chmod +x /usr/local/bin/bazel
12+
13+
WORKDIR /build
14+
RUN git clone https://github.com/protocolbuffers/protobuf --depth 1 --branch v22.0 --recursive
15+
WORKDIR /build/protobuf/
16+
RUN bazel build '//:protoc_lib'
17+
COPY --link BUILD csharp.cc plugins/
18+
RUN bazel build '//plugins:protoc-gen-csharp.stripped'
19+
20+
FROM gcr.io/distroless/cc-debian11
21+
COPY --from=build --link --chmod=0755 /build/protobuf/bazel-bin/plugins/protoc-gen-csharp .
22+
USER nobody
23+
ENTRYPOINT ["/protoc-gen-csharp"]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
version: v1
2+
name: buf.build/protocolbuffers/csharp
3+
plugin_version: v22.0
4+
source_url: https://github.com/protocolbuffers/protobuf
5+
description: Base types for C#. Generates message and enum types.
6+
output_languages:
7+
- csharp
8+
spdx_license_id: BSD-3-Clause
9+
license_url: https://github.com/protocolbuffers/protobuf/blob/v22.0/LICENSE
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include <google/protobuf/compiler/csharp/csharp_generator.h>
2+
#include <google/protobuf/compiler/plugin.h>
3+
4+
int main(int argc, char *argv[]) {
5+
google::protobuf::compiler::csharp::Generator generator;
6+
return google::protobuf::compiler::PluginMain(argc, argv, &generator);
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*
2+
!BUILD
3+
!Dockerfile
4+
!java.cc
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
cc_binary(
2+
name = "protoc-gen-java",
3+
srcs = ["java.cc"],
4+
deps = [
5+
"//:protoc_lib",
6+
],
7+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# syntax=docker/dockerfile:1.4
2+
FROM debian:bullseye-20230208 AS build
3+
4+
ARG TARGETARCH
5+
6+
RUN apt-get update \
7+
&& apt-get install -y curl git cmake build-essential g++ unzip zip
8+
RUN arch=${TARGETARCH}; \
9+
if [ "${arch}" = "amd64" ]; then arch="x86_64"; fi; \
10+
curl -fsSL -o /usr/local/bin/bazel https://github.com/bazelbuild/bazel/releases/download/6.0.0/bazel-6.0.0-linux-${arch} \
11+
&& chmod +x /usr/local/bin/bazel
12+
13+
WORKDIR /build
14+
RUN git clone https://github.com/protocolbuffers/protobuf --depth 1 --branch v22.0 --recursive
15+
WORKDIR /build/protobuf/
16+
RUN bazel build '//:protoc_lib'
17+
COPY --link BUILD java.cc plugins/
18+
RUN bazel build '//plugins:protoc-gen-java.stripped'
19+
20+
FROM gcr.io/distroless/cc-debian11
21+
COPY --from=build --link --chmod=0755 /build/protobuf/bazel-bin/plugins/protoc-gen-java .
22+
USER nobody
23+
ENTRYPOINT ["/protoc-gen-java"]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
version: v1
2+
name: buf.build/protocolbuffers/java
3+
plugin_version: v22.0
4+
source_url: https://github.com/protocolbuffers/protobuf
5+
description: Base types for Java. Generates message and enum types.
6+
output_languages:
7+
- java
8+
spdx_license_id: BSD-3-Clause
9+
license_url: https://github.com/protocolbuffers/protobuf/blob/v22.0/LICENSE
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include <google/protobuf/compiler/java/generator.h>
2+
#include <google/protobuf/compiler/plugin.h>
3+
4+
int main(int argc, char *argv[]) {
5+
google::protobuf::compiler::java::JavaGenerator generator;
6+
return google::protobuf::compiler::PluginMain(argc, argv, &generator);
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*
2+
!BUILD
3+
!Dockerfile
4+
!kotlin.cc
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
cc_binary(
2+
name = "protoc-gen-kotlin",
3+
srcs = ["kotlin.cc"],
4+
deps = [
5+
"//:protoc_lib",
6+
],
7+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# syntax=docker/dockerfile:1.4
2+
FROM debian:bullseye-20230208 AS build
3+
4+
ARG TARGETARCH
5+
6+
RUN apt-get update \
7+
&& apt-get install -y curl git cmake build-essential g++ unzip zip
8+
RUN arch=${TARGETARCH}; \
9+
if [ "${arch}" = "amd64" ]; then arch="x86_64"; fi; \
10+
curl -fsSL -o /usr/local/bin/bazel https://github.com/bazelbuild/bazel/releases/download/6.0.0/bazel-6.0.0-linux-${arch} \
11+
&& chmod +x /usr/local/bin/bazel
12+
13+
WORKDIR /build
14+
RUN git clone https://github.com/protocolbuffers/protobuf --depth 1 --branch v22.0 --recursive
15+
WORKDIR /build/protobuf/
16+
RUN bazel build '//:protoc_lib'
17+
COPY --link BUILD kotlin.cc plugins/
18+
RUN bazel build '//plugins:protoc-gen-kotlin.stripped'
19+
20+
FROM gcr.io/distroless/cc-debian11
21+
COPY --from=build --link --chmod=0755 /build/protobuf/bazel-bin/plugins/protoc-gen-kotlin .
22+
USER nobody
23+
ENTRYPOINT ["/protoc-gen-kotlin"]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
version: v1
2+
name: buf.build/protocolbuffers/kotlin
3+
plugin_version: v22.0
4+
source_url: https://github.com/protocolbuffers/protobuf
5+
description: Base types for Kotlin. Generates message and enum types.
6+
output_languages:
7+
- kotlin
8+
spdx_license_id: BSD-3-Clause
9+
license_url: https://github.com/protocolbuffers/protobuf/blob/v22.0/LICENSE
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include <google/protobuf/compiler/java/kotlin_generator.h>
2+
#include <google/protobuf/compiler/plugin.h>
3+
4+
int main(int argc, char *argv[]) {
5+
google::protobuf::compiler::java::KotlinGenerator generator;
6+
return google::protobuf::compiler::PluginMain(argc, argv, &generator);
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*
2+
!BUILD
3+
!Dockerfile
4+
!objectivec.cc
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
cc_binary(
2+
name = "protoc-gen-objectivec",
3+
srcs = ["objectivec.cc"],
4+
deps = [
5+
"//:protoc_lib",
6+
],
7+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# syntax=docker/dockerfile:1.4
2+
FROM debian:bullseye-20230208 AS build
3+
4+
ARG TARGETARCH
5+
6+
RUN apt-get update \
7+
&& apt-get install -y curl git cmake build-essential g++ unzip zip
8+
RUN arch=${TARGETARCH}; \
9+
if [ "${arch}" = "amd64" ]; then arch="x86_64"; fi; \
10+
curl -fsSL -o /usr/local/bin/bazel https://github.com/bazelbuild/bazel/releases/download/6.0.0/bazel-6.0.0-linux-${arch} \
11+
&& chmod +x /usr/local/bin/bazel
12+
13+
WORKDIR /build
14+
RUN git clone https://github.com/protocolbuffers/protobuf --depth 1 --branch v22.0 --recursive
15+
WORKDIR /build/protobuf/
16+
RUN bazel build '//:protoc_lib'
17+
COPY --link BUILD objectivec.cc plugins/
18+
RUN bazel build '//plugins:protoc-gen-objectivec.stripped'
19+
20+
FROM gcr.io/distroless/cc-debian11
21+
COPY --from=build --link --chmod=0755 /build/protobuf/bazel-bin/plugins/protoc-gen-objectivec .
22+
USER nobody
23+
ENTRYPOINT ["/protoc-gen-objectivec"]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
version: v1
2+
name: buf.build/protocolbuffers/objc
3+
plugin_version: v22.0
4+
source_url: https://github.com/protocolbuffers/protobuf
5+
description: Base types for Objective-C. Generates message and enum types.
6+
output_languages:
7+
- objective_c
8+
spdx_license_id: BSD-3-Clause
9+
license_url: https://github.com/protocolbuffers/protobuf/blob/v22.0/LICENSE
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include <google/protobuf/compiler/objectivec/generator.h>
2+
#include <google/protobuf/compiler/plugin.h>
3+
4+
int main(int argc, char *argv[]) {
5+
google::protobuf::compiler::objectivec::ObjectiveCGenerator generator;
6+
return google::protobuf::compiler::PluginMain(argc, argv, &generator);
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*
2+
!BUILD
3+
!Dockerfile
4+
!php.cc
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
cc_binary(
2+
name = "protoc-gen-php",
3+
srcs = ["php.cc"],
4+
deps = [
5+
"//:protoc_lib",
6+
],
7+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# syntax=docker/dockerfile:1.4
2+
FROM debian:bullseye-20230208 AS build
3+
4+
ARG TARGETARCH
5+
6+
RUN apt-get update \
7+
&& apt-get install -y curl git cmake build-essential g++ unzip zip
8+
RUN arch=${TARGETARCH}; \
9+
if [ "${arch}" = "amd64" ]; then arch="x86_64"; fi; \
10+
curl -fsSL -o /usr/local/bin/bazel https://github.com/bazelbuild/bazel/releases/download/6.0.0/bazel-6.0.0-linux-${arch} \
11+
&& chmod +x /usr/local/bin/bazel
12+
13+
WORKDIR /build
14+
RUN git clone https://github.com/protocolbuffers/protobuf --depth 1 --branch v22.0 --recursive
15+
WORKDIR /build/protobuf/
16+
RUN bazel build '//:protoc_lib'
17+
COPY --link BUILD php.cc plugins/
18+
RUN bazel build '//plugins:protoc-gen-php.stripped'
19+
20+
FROM gcr.io/distroless/cc-debian11
21+
COPY --from=build --link --chmod=0755 /build/protobuf/bazel-bin/plugins/protoc-gen-php .
22+
USER nobody
23+
ENTRYPOINT ["/protoc-gen-php"]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
version: v1
2+
name: buf.build/protocolbuffers/php
3+
plugin_version: v22.0
4+
source_url: https://github.com/protocolbuffers/protobuf
5+
description: Base types for PHP. Generates message and enum types.
6+
output_languages:
7+
- php
8+
spdx_license_id: BSD-3-Clause
9+
license_url: https://github.com/protocolbuffers/protobuf/blob/v22.0/LICENSE
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include <google/protobuf/compiler/php/php_generator.h>
2+
#include <google/protobuf/compiler/plugin.h>
3+
4+
int main(int argc, char *argv[]) {
5+
google::protobuf::compiler::php::Generator generator;
6+
return google::protobuf::compiler::PluginMain(argc, argv, &generator);
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!Dockerfile
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# syntax=docker/dockerfile:1.4
2+
FROM debian:bullseye-20230208 AS build
3+
4+
ARG TARGETARCH
5+
6+
RUN apt-get update \
7+
&& apt-get install -y curl git cmake build-essential g++ unzip zip
8+
RUN arch=${TARGETARCH}; \
9+
if [ "${arch}" = "amd64" ]; then arch="x86_64"; fi; \
10+
curl -fsSL -o /usr/local/bin/bazel https://github.com/bazelbuild/bazel/releases/download/6.0.0/bazel-6.0.0-linux-${arch} \
11+
&& chmod +x /usr/local/bin/bazel
12+
13+
WORKDIR /build
14+
RUN git clone https://github.com/protocolbuffers/protobuf --depth 1 --branch v22.0 --recursive
15+
WORKDIR /build/protobuf/
16+
RUN bazel build '//:protoc_lib'
17+
RUN mkdir -p plugins/pyi/
18+
COPY <<'EOF' /build/protobuf/plugins/pyi/pyi.cc
19+
#include <google/protobuf/compiler/python/pyi_generator.h>
20+
#include <google/protobuf/compiler/plugin.h>
21+
22+
int main(int argc, char *argv[]) {
23+
google::protobuf::compiler::python::PyiGenerator generator;
24+
return google::protobuf::compiler::PluginMain(argc, argv, &generator);
25+
}
26+
EOF
27+
COPY <<'EOF' /build/protobuf/plugins/pyi/BUILD
28+
cc_binary(
29+
name = "protoc-gen-pyi",
30+
srcs = ["pyi.cc"],
31+
deps = [
32+
"//:protoc_lib",
33+
],
34+
)
35+
EOF
36+
RUN bazel build '//plugins/pyi:protoc-gen-pyi.stripped'
37+
38+
FROM gcr.io/distroless/cc-debian11
39+
COPY --from=build --link --chmod=0755 /build/protobuf/bazel-bin/plugins/pyi/protoc-gen-pyi .
40+
USER nobody
41+
ENTRYPOINT ["/protoc-gen-pyi"]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
version: v1
2+
name: buf.build/protocolbuffers/pyi
3+
plugin_version: v22.0
4+
source_url: https://github.com/protocolbuffers/protobuf
5+
description: Base types for Python Stubs. Generates stub files for message and enum types.
6+
output_languages:
7+
- python
8+
spdx_license_id: BSD-3-Clause
9+
license_url: https://github.com/protocolbuffers/protobuf/blob/v22.0/LICENSE
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*
2+
!BUILD
3+
!Dockerfile
4+
!python.cc
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
cc_binary(
2+
name = "protoc-gen-python",
3+
srcs = ["python.cc"],
4+
deps = [
5+
"//:protoc_lib",
6+
],
7+
)

0 commit comments

Comments
 (0)