Skip to content

Commit 98678cf

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

File tree

61 files changed

+470
-0
lines changed

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
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*
2+
!BUILD
3+
!cpp.cc
4+
!Dockerfile
Lines changed: 7 additions & 0 deletions
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+
)
Lines changed: 23 additions & 0 deletions
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"]
Lines changed: 9 additions & 0 deletions
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
Lines changed: 7 additions & 0 deletions
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+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*
2+
!BUILD
3+
!csharp.cc
4+
!Dockerfile
Lines changed: 7 additions & 0 deletions
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+
)
Lines changed: 23 additions & 0 deletions
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"]
Lines changed: 9 additions & 0 deletions
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
Lines changed: 7 additions & 0 deletions
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+
}

0 commit comments

Comments
 (0)