From 10567faf861685064bf461bb977067d8fd6fbcf0 Mon Sep 17 00:00:00 2001 From: Stefan VanBuren Date: Tue, 16 Dec 2025 11:13:32 -0500 Subject: [PATCH 1/2] Add grpc/swift-protobuf v2.1.2 Needed an update to the dependencies (related to #1941). For context, the steps were (from the plugin's directory): ``` $ git clone --depth 1 --branch 2.1.2 https://github.com/grpc/grpc-swift-protobuf --recursive $ cd grpc-swift-protobuf $ swift package resolve $ mv Package.resolved ../ ``` Probably a good reason to look to automate this now. Fixes #2160. --- .../grpc/swift-protobuf/v2.1.2/.dockerignore | 3 ++ plugins/grpc/swift-protobuf/v2.1.2/Dockerfile | 18 ++++++++++ .../swift-protobuf/v2.1.2/Package.resolved | 33 +++++++++++++++++++ .../swift-protobuf/v2.1.2/buf.plugin.yaml | 31 +++++++++++++++++ .../swift-protobuf/v2.1.2/eliza/plugin.sum | 1 + .../swift-protobuf/v2.1.2/petapis/plugin.sum | 1 + 6 files changed, 87 insertions(+) create mode 100644 plugins/grpc/swift-protobuf/v2.1.2/.dockerignore create mode 100644 plugins/grpc/swift-protobuf/v2.1.2/Dockerfile create mode 100644 plugins/grpc/swift-protobuf/v2.1.2/Package.resolved create mode 100644 plugins/grpc/swift-protobuf/v2.1.2/buf.plugin.yaml create mode 100644 tests/testdata/buf.build/grpc/swift-protobuf/v2.1.2/eliza/plugin.sum create mode 100644 tests/testdata/buf.build/grpc/swift-protobuf/v2.1.2/petapis/plugin.sum diff --git a/plugins/grpc/swift-protobuf/v2.1.2/.dockerignore b/plugins/grpc/swift-protobuf/v2.1.2/.dockerignore new file mode 100644 index 000000000..2b3157b59 --- /dev/null +++ b/plugins/grpc/swift-protobuf/v2.1.2/.dockerignore @@ -0,0 +1,3 @@ +* +!Dockerfile +!Package.resolved diff --git a/plugins/grpc/swift-protobuf/v2.1.2/Dockerfile b/plugins/grpc/swift-protobuf/v2.1.2/Dockerfile new file mode 100644 index 000000000..c707f86d3 --- /dev/null +++ b/plugins/grpc/swift-protobuf/v2.1.2/Dockerfile @@ -0,0 +1,18 @@ +# syntax=docker/dockerfile:1.19 +FROM swift:6.2.3-bookworm AS build + +RUN apt-get update \ + && apt-get install -y unzip +WORKDIR /app +RUN git clone --depth 1 --branch 2.1.2 https://github.com/grpc/grpc-swift-protobuf --recursive +WORKDIR /app/grpc-swift-protobuf +COPY --link Package.resolved . +RUN swift build -c release --static-swift-stdlib --product protoc-gen-grpc-swift-2 -Xlinker -s --force-resolved-versions + +FROM gcr.io/distroless/cc-debian12:latest@sha256:0c8eac8ea42a167255d03c3ba6dfad2989c15427ed93d16c53ef9706ea4691df AS base + +FROM scratch +COPY --link --from=base / / +COPY --link --from=build /app/grpc-swift-protobuf/.build/release/protoc-gen-grpc-swift-2 . +USER nobody +ENTRYPOINT [ "/protoc-gen-grpc-swift-2" ] diff --git a/plugins/grpc/swift-protobuf/v2.1.2/Package.resolved b/plugins/grpc/swift-protobuf/v2.1.2/Package.resolved new file mode 100644 index 000000000..b5c98877f --- /dev/null +++ b/plugins/grpc/swift-protobuf/v2.1.2/Package.resolved @@ -0,0 +1,33 @@ +{ + "originHash" : "405f1b136bba244f838487f7511cabeb00efe492de4f30605c56321b8bb98bff", + "pins" : [ + { + "identity" : "grpc-swift-2", + "kind" : "remoteSourceControl", + "location" : "https://github.com/grpc/grpc-swift-2.git", + "state" : { + "revision" : "531924b28fde0cf7585123c781c6f55cc35ef7fc", + "version" : "2.2.1" + } + }, + { + "identity" : "swift-collections", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-collections.git", + "state" : { + "revision" : "7b847a3b7008b2dc2f47ca3110d8c782fb2e5c7e", + "version" : "1.3.0" + } + }, + { + "identity" : "swift-protobuf", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-protobuf.git", + "state" : { + "revision" : "c169a5744230951031770e27e475ff6eefe51f9d", + "version" : "1.33.3" + } + } + ], + "version" : 3 +} diff --git a/plugins/grpc/swift-protobuf/v2.1.2/buf.plugin.yaml b/plugins/grpc/swift-protobuf/v2.1.2/buf.plugin.yaml new file mode 100644 index 000000000..573ccf6cf --- /dev/null +++ b/plugins/grpc/swift-protobuf/v2.1.2/buf.plugin.yaml @@ -0,0 +1,31 @@ +version: v1 +name: buf.build/grpc/swift-protobuf +plugin_version: v2.1.2 +source_url: https://github.com/grpc/grpc-swift-protobuf +integration_guide_url: https://swiftpackageindex.com/grpc/grpc-swift-protobuf/2.1.2/documentation/grpcprotobuf +description: Generates Swift client and server stubs for the gRPC framework. +deps: + - plugin: buf.build/apple/swift:v1.31.0 +output_languages: + - swift +registry: + swift: + deps: + - source: https://github.com/grpc/grpc-swift-protobuf.git + package: grpc-swift-protobuf + # https://github.com/grpc/grpc-swift-protobuf/blob/2.1.2/Package.swift#L22 + products: [ GRPCProtobuf ] + version: 2.1.2 + # https://github.com/grpc/grpc-swift-protobuf/blob/2.1.2/Package.swift#L65 + swift_versions: [ ".v6" ] + # https://github.com/grpc/grpc-swift-protobuf/blob/2.1.2/Package.swift#L58 + platforms: + macos: v15 + ios: v18 + tvos: v18 + watchos: v11 + opts: + - Visibility=Public + - FileNaming=PathToUnderscores +spdx_license_id: Apache-2.0 +license_url: https://github.com/grpc/grpc-swift-protobuf/blob/2.1.2/LICENSE diff --git a/tests/testdata/buf.build/grpc/swift-protobuf/v2.1.2/eliza/plugin.sum b/tests/testdata/buf.build/grpc/swift-protobuf/v2.1.2/eliza/plugin.sum new file mode 100644 index 000000000..104561e7d --- /dev/null +++ b/tests/testdata/buf.build/grpc/swift-protobuf/v2.1.2/eliza/plugin.sum @@ -0,0 +1 @@ +h1:t5ycbVWI4y9Z5KuSJqQ4bQPdpHrWwVbMjESFbawChEE= diff --git a/tests/testdata/buf.build/grpc/swift-protobuf/v2.1.2/petapis/plugin.sum b/tests/testdata/buf.build/grpc/swift-protobuf/v2.1.2/petapis/plugin.sum new file mode 100644 index 000000000..80263ca73 --- /dev/null +++ b/tests/testdata/buf.build/grpc/swift-protobuf/v2.1.2/petapis/plugin.sum @@ -0,0 +1 @@ +h1:icvJdhaYuOrR7ZCJZXU4y9CqvP1LJnJ+T7nvYk7SFuo= From 2db173e55cb84a96f0632b132bb58232917be46b Mon Sep 17 00:00:00 2001 From: Stefan VanBuren Date: Tue, 16 Dec 2025 11:17:15 -0500 Subject: [PATCH 2/2] Apply suggestions from code review --- plugins/grpc/swift-protobuf/v2.1.2/buf.plugin.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/grpc/swift-protobuf/v2.1.2/buf.plugin.yaml b/plugins/grpc/swift-protobuf/v2.1.2/buf.plugin.yaml index 573ccf6cf..fa6ac88ea 100644 --- a/plugins/grpc/swift-protobuf/v2.1.2/buf.plugin.yaml +++ b/plugins/grpc/swift-protobuf/v2.1.2/buf.plugin.yaml @@ -5,7 +5,7 @@ source_url: https://github.com/grpc/grpc-swift-protobuf integration_guide_url: https://swiftpackageindex.com/grpc/grpc-swift-protobuf/2.1.2/documentation/grpcprotobuf description: Generates Swift client and server stubs for the gRPC framework. deps: - - plugin: buf.build/apple/swift:v1.31.0 + - plugin: buf.build/apple/swift:v1.33.3 output_languages: - swift registry: