Skip to content

Commit

Permalink
Update to protoc v27.4 plugins (#1458)
Browse files Browse the repository at this point in the history
Update to protoc v27.4 plugins, update the latest gRPC releases to use
27.4, and fix the fetch versions workflow to automatically update
build.csproj files.

Fixes #1457.
  • Loading branch information
pkwarren authored Aug 28, 2024
1 parent 9940983 commit cbf66c8
Show file tree
Hide file tree
Showing 72 changed files with 587 additions and 8 deletions.
2 changes: 1 addition & 1 deletion internal/cmd/fetcher/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ func copyFile(
}()
filename := filepath.Base(dest)
switch filename {
case "Dockerfile", "Dockerfile.wasm", "buf.plugin.yaml", "package.json":
case "Dockerfile", "Dockerfile.wasm", "buf.plugin.yaml", "build.csproj", "package.json":
// We want to update these with the new version
default:
// Everything else just copy as-is
Expand Down
2 changes: 1 addition & 1 deletion plugins/grpc/cpp/v1.66.1/buf.plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugin_version: v1.66.1
source_url: https://github.com/grpc/grpc
description: Generates C++ client and server stubs for the gRPC framework.
deps:
- plugin: buf.build/protocolbuffers/cpp:v27.3
- plugin: buf.build/protocolbuffers/cpp:v27.4
output_languages:
- cpp
spdx_license_id: Apache-2.0
Expand Down
2 changes: 1 addition & 1 deletion plugins/grpc/csharp/v1.66.1/buf.plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugin_version: v1.66.1
source_url: https://github.com/grpc/grpc
description: Generates C# client and server stubs for the gRPC framework.
deps:
- plugin: buf.build/protocolbuffers/csharp:v27.3
- plugin: buf.build/protocolbuffers/csharp:v27.4
output_languages:
- csharp
spdx_license_id: Apache-2.0
Expand Down
2 changes: 1 addition & 1 deletion plugins/grpc/csharp/v1.66.1/build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Grpc.Net.Common" Version="2.65.0" />
<PackageReference Include="Google.Protobuf" Version="3.27.3" />
<PackageReference Include="Google.Protobuf" Version="3.27.4" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion plugins/grpc/objc/v1.66.1/buf.plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugin_version: v1.66.1
source_url: https://github.com/grpc/grpc
description: Generates Objective-C client and server stubs for the gRPC framework.
deps:
- plugin: buf.build/protocolbuffers/objc:v27.3
- plugin: buf.build/protocolbuffers/objc:v27.4
output_languages:
- objective_c
spdx_license_id: Apache-2.0
Expand Down
2 changes: 1 addition & 1 deletion plugins/grpc/php/v1.66.1/buf.plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugin_version: v1.66.1
source_url: https://github.com/grpc/grpc
description: Generates PHP client and server stubs for the gRPC framework.
deps:
- plugin: buf.build/protocolbuffers/php:v27.3
- plugin: buf.build/protocolbuffers/php:v27.4
output_languages:
- php
spdx_license_id: Apache-2.0
Expand Down
2 changes: 1 addition & 1 deletion plugins/grpc/python/v1.66.1/buf.plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugin_version: v1.66.1
source_url: https://github.com/grpc/grpc
description: Generates Python client and server stubs for the gRPC framework.
deps:
- plugin: buf.build/protocolbuffers/python:v27.3
- plugin: buf.build/protocolbuffers/python:v27.4
output_languages:
- python
spdx_license_id: Apache-2.0
Expand Down
2 changes: 1 addition & 1 deletion plugins/grpc/ruby/v1.66.1/buf.plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugin_version: v1.66.1
source_url: https://github.com/grpc/grpc
description: Generates Ruby client and server stubs for the gRPC framework.
deps:
- plugin: buf.build/protocolbuffers/ruby:v27.3
- plugin: buf.build/protocolbuffers/ruby:v27.4
output_languages:
- ruby
spdx_license_id: Apache-2.0
Expand Down
4 changes: 4 additions & 0 deletions plugins/protocolbuffers/cpp/v27.4/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*
!BUILD
!cpp.cc
!Dockerfile
7 changes: 7 additions & 0 deletions plugins/protocolbuffers/cpp/v27.4/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cc_binary(
name = "protoc-gen-cpp",
srcs = ["cpp.cc"],
deps = [
"//:protoc_lib",
],
)
27 changes: 27 additions & 0 deletions plugins/protocolbuffers/cpp/v27.4/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# syntax=docker/dockerfile:1.9
FROM debian:bookworm-20240812 AS build

ARG TARGETARCH

RUN apt-get update \
&& apt-get install -y curl git cmake build-essential g++ unzip zip
RUN arch=${TARGETARCH}; \
if [ "${arch}" = "amd64" ]; then arch="x86_64"; fi; \
curl -fsSL -o /usr/local/bin/bazel https://github.com/bazelbuild/bazel/releases/download/7.3.1/bazel-7.3.1-linux-${arch} \
&& chmod +x /usr/local/bin/bazel

WORKDIR /build
RUN curl -fsSL -o protoc.tar.gz https://github.com/protocolbuffers/protobuf/releases/download/v27.4/protobuf-27.4.tar.gz \
&& tar --strip-components=1 -zxf protoc.tar.gz \
&& rm protoc.tar.gz
RUN bazel build '//:protoc_lib'
COPY --link BUILD cpp.cc plugins/
RUN bazel build '//plugins:protoc-gen-cpp.stripped'

FROM gcr.io/distroless/cc-debian12:latest@sha256:3b75fdd33932d16e53a461277becf57c4f815c6cee5f6bc8f52457c095e004c8 AS base

FROM scratch
COPY --from=base --link / /
COPY --from=build --link --chmod=0755 /build/bazel-bin/plugins/protoc-gen-cpp .
USER nobody
ENTRYPOINT ["/protoc-gen-cpp"]
11 changes: 11 additions & 0 deletions plugins/protocolbuffers/cpp/v27.4/buf.plugin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: v1
name: buf.build/protocolbuffers/cpp
plugin_version: v27.4
source_url: https://github.com/protocolbuffers/protobuf
description: Base types for C++. Generates message and enum types.
output_languages:
- cpp
spdx_license_id: BSD-3-Clause
license_url: https://github.com/protocolbuffers/protobuf/blob/v27.4/LICENSE
registry:
cmake: {}
7 changes: 7 additions & 0 deletions plugins/protocolbuffers/cpp/v27.4/cpp.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <google/protobuf/compiler/cpp/generator.h>
#include <google/protobuf/compiler/plugin.h>

int main(int argc, char *argv[]) {
google::protobuf::compiler::cpp::CppGenerator generator;
return google::protobuf::compiler::PluginMain(argc, argv, &generator);
}
5 changes: 5 additions & 0 deletions plugins/protocolbuffers/csharp/v27.4/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*
!BUILD
!csharp.cc
!Dockerfile
!build.csproj
7 changes: 7 additions & 0 deletions plugins/protocolbuffers/csharp/v27.4/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cc_binary(
name = "protoc-gen-csharp",
srcs = ["csharp.cc"],
deps = [
"//:protoc_lib",
],
)
33 changes: 33 additions & 0 deletions plugins/protocolbuffers/csharp/v27.4/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# syntax=docker/dockerfile:1.9
FROM debian:bookworm-20240812 AS build

ARG TARGETARCH

RUN apt-get update \
&& apt-get install -y curl git cmake build-essential g++ unzip zip
RUN arch=${TARGETARCH}; \
if [ "${arch}" = "amd64" ]; then arch="x86_64"; fi; \
curl -fsSL -o /usr/local/bin/bazel https://github.com/bazelbuild/bazel/releases/download/7.3.1/bazel-7.3.1-linux-${arch} \
&& chmod +x /usr/local/bin/bazel

WORKDIR /build
RUN curl -fsSL -o protoc.tar.gz https://github.com/protocolbuffers/protobuf/releases/download/v27.4/protobuf-27.4.tar.gz \
&& tar --strip-components=1 -zxf protoc.tar.gz \
&& rm protoc.tar.gz
RUN bazel build '//:protoc_lib'
COPY --link BUILD csharp.cc plugins/
RUN bazel build '//plugins:protoc-gen-csharp.stripped'

FROM mcr.microsoft.com/dotnet/sdk:8.0.401-bookworm-slim@sha256:8c6beed050a602970c3d275756ed3c19065e42ce6ca0809f5a6fcbf5d36fd305 AS dotnetrestore
WORKDIR /build
COPY --link ./build.csproj /build/build.csproj
RUN mkdir /nuget && dotnet restore --packages /nuget

FROM gcr.io/distroless/cc-debian12:latest@sha256:3b75fdd33932d16e53a461277becf57c4f815c6cee5f6bc8f52457c095e004c8 AS base

FROM scratch
COPY --from=base --link / /
COPY --link --from=dotnetrestore /nuget /nuget
COPY --from=build --link --chmod=0755 /build/bazel-bin/plugins/protoc-gen-csharp .
USER nobody
ENTRYPOINT ["/protoc-gen-csharp"]
18 changes: 18 additions & 0 deletions plugins/protocolbuffers/csharp/v27.4/buf.plugin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: v1
name: buf.build/protocolbuffers/csharp
plugin_version: v27.4
source_url: https://github.com/protocolbuffers/protobuf
description: Base types for C#. Generates message and enum types.
output_languages:
- csharp
spdx_license_id: BSD-3-Clause
license_url: https://github.com/protocolbuffers/protobuf/blob/v27.4/LICENSE
registry:
opts:
- base_namespace=
nuget:
target_frameworks:
- netstandard1.1
deps:
- name: Google.Protobuf
version: 3.27.4
8 changes: 8 additions & 0 deletions plugins/protocolbuffers/csharp/v27.4/build.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard1.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.27.4" />
</ItemGroup>
</Project>
7 changes: 7 additions & 0 deletions plugins/protocolbuffers/csharp/v27.4/csharp.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#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);
}
4 changes: 4 additions & 0 deletions plugins/protocolbuffers/java/v27.4/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*
!BUILD
!Dockerfile
!java.cc
7 changes: 7 additions & 0 deletions plugins/protocolbuffers/java/v27.4/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cc_binary(
name = "protoc-gen-java",
srcs = ["java.cc"],
deps = [
"//:protoc_lib",
],
)
27 changes: 27 additions & 0 deletions plugins/protocolbuffers/java/v27.4/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# syntax=docker/dockerfile:1.9
FROM debian:bookworm-20240812 AS build

ARG TARGETARCH

RUN apt-get update \
&& apt-get install -y curl git cmake build-essential g++ unzip zip
RUN arch=${TARGETARCH}; \
if [ "${arch}" = "amd64" ]; then arch="x86_64"; fi; \
curl -fsSL -o /usr/local/bin/bazel https://github.com/bazelbuild/bazel/releases/download/7.3.1/bazel-7.3.1-linux-${arch} \
&& chmod +x /usr/local/bin/bazel

WORKDIR /build
RUN curl -fsSL -o protoc.tar.gz https://github.com/protocolbuffers/protobuf/releases/download/v27.4/protobuf-27.4.tar.gz \
&& tar --strip-components=1 -zxf protoc.tar.gz \
&& rm protoc.tar.gz
RUN bazel build '//:protoc_lib'
COPY --link BUILD java.cc plugins/
RUN bazel build '//plugins:protoc-gen-java.stripped'

FROM gcr.io/distroless/cc-debian12:latest@sha256:3b75fdd33932d16e53a461277becf57c4f815c6cee5f6bc8f52457c095e004c8 AS base

FROM scratch
COPY --from=base --link / /
COPY --from=build --link --chmod=0755 /build/bazel-bin/plugins/protoc-gen-java .
USER nobody
ENTRYPOINT ["/protoc-gen-java"]
19 changes: 19 additions & 0 deletions plugins/protocolbuffers/java/v27.4/buf.plugin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: v1
name: buf.build/protocolbuffers/java
plugin_version: v27.4
source_url: https://github.com/protocolbuffers/protobuf
description: Base types for Java. Generates message and enum types.
output_languages:
- java
spdx_license_id: BSD-3-Clause
license_url: https://github.com/protocolbuffers/protobuf/blob/v27.4/LICENSE
registry:
maven:
deps:
- com.google.protobuf:protobuf-java:4.27.4
additional_runtimes:
- name: lite
deps:
- com.google.protobuf:protobuf-javalite:4.27.4
- build.buf:protobuf-javalite:4.27.4
opts: [lite]
7 changes: 7 additions & 0 deletions plugins/protocolbuffers/java/v27.4/java.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <google/protobuf/compiler/java/generator.h>
#include <google/protobuf/compiler/plugin.h>

int main(int argc, char *argv[]) {
google::protobuf::compiler::java::JavaGenerator generator;
return google::protobuf::compiler::PluginMain(argc, argv, &generator);
}
4 changes: 4 additions & 0 deletions plugins/protocolbuffers/kotlin/v27.4/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*
!BUILD
!Dockerfile
!kotlin.cc
7 changes: 7 additions & 0 deletions plugins/protocolbuffers/kotlin/v27.4/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cc_binary(
name = "protoc-gen-kotlin",
srcs = ["kotlin.cc"],
deps = [
"//:protoc_lib",
],
)
27 changes: 27 additions & 0 deletions plugins/protocolbuffers/kotlin/v27.4/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# syntax=docker/dockerfile:1.9
FROM debian:bookworm-20240812 AS build

ARG TARGETARCH

RUN apt-get update \
&& apt-get install -y curl git cmake build-essential g++ unzip zip
RUN arch=${TARGETARCH}; \
if [ "${arch}" = "amd64" ]; then arch="x86_64"; fi; \
curl -fsSL -o /usr/local/bin/bazel https://github.com/bazelbuild/bazel/releases/download/7.3.1/bazel-7.3.1-linux-${arch} \
&& chmod +x /usr/local/bin/bazel

WORKDIR /build
RUN curl -fsSL -o protoc.tar.gz https://github.com/protocolbuffers/protobuf/releases/download/v27.4/protobuf-27.4.tar.gz \
&& tar --strip-components=1 -zxf protoc.tar.gz \
&& rm protoc.tar.gz
RUN bazel build '//:protoc_lib'
COPY --link BUILD kotlin.cc plugins/
RUN bazel build '//plugins:protoc-gen-kotlin.stripped'

FROM gcr.io/distroless/cc-debian12:latest@sha256:3b75fdd33932d16e53a461277becf57c4f815c6cee5f6bc8f52457c095e004c8 AS base

FROM scratch
COPY --from=base --link / /
COPY --from=build --link --chmod=0755 /build/bazel-bin/plugins/protoc-gen-kotlin .
USER nobody
ENTRYPOINT ["/protoc-gen-kotlin"]
27 changes: 27 additions & 0 deletions plugins/protocolbuffers/kotlin/v27.4/buf.plugin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
version: v1
name: buf.build/protocolbuffers/kotlin
plugin_version: v27.4
source_url: https://github.com/protocolbuffers/protobuf
integration_guide_url: https://protobuf.dev/getting-started/kotlintutorial
description: Base types for Kotlin. Generates message and enum types.
deps:
- plugin: buf.build/protocolbuffers/java:v27.4
output_languages:
- kotlin
spdx_license_id: BSD-3-Clause
license_url: https://github.com/protocolbuffers/protobuf/blob/v27.4/LICENSE
registry:
maven:
compiler:
kotlin:
version: 1.8.22
deps:
- com.google.protobuf:protobuf-kotlin:4.27.4
- org.jetbrains.kotlin:kotlin-stdlib:1.8.22
- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22
additional_runtimes:
- name: lite
deps:
- com.google.protobuf:protobuf-kotlin-lite:4.27.4
- org.jetbrains.kotlin:kotlin-stdlib:1.8.22
opts: [lite]
7 changes: 7 additions & 0 deletions plugins/protocolbuffers/kotlin/v27.4/kotlin.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <google/protobuf/compiler/java/kotlin_generator.h>
#include <google/protobuf/compiler/plugin.h>

int main(int argc, char *argv[]) {
google::protobuf::compiler::java::KotlinGenerator generator;
return google::protobuf::compiler::PluginMain(argc, argv, &generator);
}
4 changes: 4 additions & 0 deletions plugins/protocolbuffers/objc/v27.4/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*
!BUILD
!Dockerfile
!objectivec.cc
7 changes: 7 additions & 0 deletions plugins/protocolbuffers/objc/v27.4/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cc_binary(
name = "protoc-gen-objectivec",
srcs = ["objectivec.cc"],
deps = [
"//:protoc_lib",
],
)
Loading

0 comments on commit cbf66c8

Please sign in to comment.