Skip to content

Commit de4a036

Browse files
authored
Add protoc v29.0 plugins (#1608)
Fixes #1606.
1 parent 13ea084 commit de4a036

File tree

64 files changed

+606
-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.

64 files changed

+606
-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: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# syntax=docker/dockerfile:1.10
2+
FROM debian:bookworm-20241111 AS build
3+
4+
ARG TARGETARCH
5+
ARG BAZEL_OPTS="--host_jvm_args=-Djava.net.preferIPv4Stack=true"
6+
7+
RUN apt-get update \
8+
&& apt-get install -y curl git cmake build-essential autoconf clang libc++-dev libtool pkg-config unzip zip
9+
RUN curl -fsSL -o /usr/local/bin/bazelisk https://github.com/bazelbuild/bazelisk/releases/download/v1.24.1/bazelisk-linux-${TARGETARCH} \
10+
&& chmod +x /usr/local/bin/bazelisk \
11+
&& mkdir /build \
12+
&& chown nobody:nogroup /build \
13+
&& usermod --home /build nobody
14+
15+
USER nobody
16+
WORKDIR /build
17+
RUN curl -fsSL -o protoc.tar.gz https://github.com/protocolbuffers/protobuf/releases/download/v29.0/protobuf-29.0.tar.gz \
18+
&& tar --strip-components=1 -zxf protoc.tar.gz \
19+
&& rm protoc.tar.gz
20+
RUN bazelisk ${BAZEL_OPTS} build '//:protoc_lib'
21+
COPY --link BUILD cpp.cc plugins/
22+
RUN bazelisk ${BAZEL_OPTS} build '//plugins:protoc-gen-cpp.stripped'
23+
24+
FROM gcr.io/distroless/cc-debian12:latest@sha256:f913198471738d9eedcd00c0ca812bf663e8959eebff3a3cbadb027ed9da0c38 AS base
25+
26+
FROM scratch
27+
COPY --from=base --link / /
28+
COPY --from=build --link --chmod=0755 /build/bazel-bin/plugins/protoc-gen-cpp .
29+
USER nobody
30+
ENTRYPOINT ["/protoc-gen-cpp"]
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: v1
2+
name: buf.build/protocolbuffers/cpp
3+
plugin_version: v29.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/v29.0/LICENSE
10+
registry:
11+
cmake: {}
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: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*
2+
!BUILD
3+
!csharp.cc
4+
!Dockerfile
5+
!build.csproj
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: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# syntax=docker/dockerfile:1.10
2+
FROM debian:bookworm-20241111 AS build
3+
4+
ARG TARGETARCH
5+
ARG BAZEL_OPTS="--host_jvm_args=-Djava.net.preferIPv4Stack=true"
6+
7+
RUN apt-get update \
8+
&& apt-get install -y curl git cmake build-essential autoconf clang libc++-dev libtool pkg-config unzip zip
9+
RUN curl -fsSL -o /usr/local/bin/bazelisk https://github.com/bazelbuild/bazelisk/releases/download/v1.24.1/bazelisk-linux-${TARGETARCH} \
10+
&& chmod +x /usr/local/bin/bazelisk \
11+
&& mkdir /build \
12+
&& chown nobody:nogroup /build \
13+
&& usermod --home /build nobody
14+
15+
USER nobody
16+
WORKDIR /build
17+
RUN curl -fsSL -o protoc.tar.gz https://github.com/protocolbuffers/protobuf/releases/download/v29.0/protobuf-29.0.tar.gz \
18+
&& tar --strip-components=1 -zxf protoc.tar.gz \
19+
&& rm protoc.tar.gz
20+
RUN bazelisk ${BAZEL_OPTS} build '//:protoc_lib'
21+
COPY --link BUILD csharp.cc plugins/
22+
RUN bazelisk ${BAZEL_OPTS} build '//plugins:protoc-gen-csharp.stripped'
23+
24+
FROM mcr.microsoft.com/dotnet/sdk:8.0.404-bookworm-slim@sha256:f91f9181d68b5ed2c8dea199dbbd2f6d172e60bdc43f8a67878b1ad140cf8d6b AS dotnetrestore
25+
WORKDIR /build
26+
COPY --link ./build.csproj /build/build.csproj
27+
RUN mkdir /nuget && dotnet restore --packages /nuget
28+
29+
FROM gcr.io/distroless/cc-debian12:latest@sha256:f913198471738d9eedcd00c0ca812bf663e8959eebff3a3cbadb027ed9da0c38 AS base
30+
31+
FROM scratch
32+
COPY --from=base --link / /
33+
COPY --link --from=dotnetrestore /nuget /nuget
34+
COPY --from=build --link --chmod=0755 /build/bazel-bin/plugins/protoc-gen-csharp .
35+
USER nobody
36+
ENTRYPOINT ["/protoc-gen-csharp"]
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: v1
2+
name: buf.build/protocolbuffers/csharp
3+
plugin_version: v29.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/v29.0/LICENSE
10+
registry:
11+
opts:
12+
- base_namespace=
13+
nuget:
14+
target_frameworks:
15+
- netstandard2.0
16+
deps:
17+
- name: Google.Protobuf
18+
version: 3.29.0
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<TargetFramework>netstandard2.0</TargetFramework>
4+
</PropertyGroup>
5+
<ItemGroup>
6+
<PackageReference Include="Google.Protobuf" Version="3.29.0" />
7+
</ItemGroup>
8+
</Project>

0 commit comments

Comments
 (0)