Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions plugins/apple/swift/v1.38.1/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*
!Dockerfile
!extramoduleimports.patch
19 changes: 19 additions & 0 deletions plugins/apple/swift/v1.38.1/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# syntax=docker/dockerfile:1.24
FROM swift:6.3.2-bookworm@sha256:30d471336eefd13ae5adfab40966a923cb79a32ca0f10974a43b50438a1f9329 AS build

RUN apt-get update \
&& apt-get install -y libstdc++-12-dev unzip
COPY --link extramoduleimports.patch /app/extramoduleimports.patch
WORKDIR /app
RUN git clone --depth 1 --branch 1.38.1 https://github.com/apple/swift-protobuf --recursive
WORKDIR /app/swift-protobuf
RUN git apply /app/extramoduleimports.patch
RUN swift build -c release --static-swift-stdlib -Xlinker -s

FROM gcr.io/distroless/cc-debian13:latest@sha256:a017e74bd2a12d98342dbecd33d121d2b160415ed777573dc1808969e989d94d AS base

FROM scratch
COPY --link --from=base / /
COPY --link --from=build /app/swift-protobuf/.build/release/protoc-gen-swift .
USER nobody
ENTRYPOINT [ "/protoc-gen-swift" ]
21 changes: 21 additions & 0 deletions plugins/apple/swift/v1.38.1/buf.plugin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: v1
name: buf.build/apple/swift
plugin_version: v1.38.1
source_url: https://github.com/apple/swift-protobuf
integration_guide_url: https://github.com/apple/swift-protobuf#getting-started
description: Base types for Swift. Generates message and enum types.
output_languages:
- swift
registry:
swift:
deps:
- source: https://github.com/apple/swift-protobuf.git
package: swift-protobuf
swift_versions: [ ".v6" ]
products: [ SwiftProtobuf ]
version: 1.38.1
opts:
- Visibility=Public
- FileNaming=PathToUnderscores
spdx_license_id: Apache-2.0
license_url: https://github.com/apple/swift-protobuf/blob/1.38.1/LICENSE.txt
63 changes: 63 additions & 0 deletions plugins/apple/swift/v1.38.1/extramoduleimports.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
diff --git a/Sources/protoc-gen-swift/FileGenerator.swift b/Sources/protoc-gen-swift/FileGenerator.swift
index d370e25..cea7bd2 100644
--- a/Sources/protoc-gen-swift/FileGenerator.swift
+++ b/Sources/protoc-gen-swift/FileGenerator.swift
@@ -161,6 +161,14 @@ class FileGenerator {
return
}

+ let neededCustomImports = generatorOptions.extraModuleImports
+ if !neededCustomImports.isEmpty {
+ p.print()
+ for i in neededCustomImports {
+ p.print("import \(i)\n")
+ }
+ }
+
p.print()
generateVersionCheck(printer: &p)

diff --git a/Sources/protoc-gen-swift/GeneratorOptions.swift b/Sources/protoc-gen-swift/GeneratorOptions.swift
index 159e621..a8f631e 100644
--- a/Sources/protoc-gen-swift/GeneratorOptions.swift
+++ b/Sources/protoc-gen-swift/GeneratorOptions.swift
@@ -115,6 +115,7 @@ package class GeneratorOptions {
}
}

+ let extraModuleImports: [String]
let outputNaming: OutputNaming
let enumGeneration: EnumGeneration
let protoToModuleMappings: ProtoFileToModuleMappings
@@ -146,6 +147,7 @@ package class GeneratorOptions {
}

package init(parameter: any CodeGeneratorParameter) throws {
+ var externalModuleImports: [String] = []
var outputNaming: OutputNaming = .fullPath
var enumGeneration: EnumGeneration = .none
var moduleMapPath: String?
@@ -238,6 +240,15 @@ package class GeneratorOptions {
value: pair.value
)
}
+ case "ExtraModuleImports":
+ if !pair.value.isEmpty {
+ externalModuleImports.append(pair.value)
+ } else {
+ throw GenerationError.invalidParameterValue(
+ name: pair.key,
+ value: pair.value
+ )
+ }
default:
throw GenerationError.unknownParameter(name: pair.key)
}
@@ -272,6 +283,7 @@ package class GeneratorOptions {
visibilitySourceSnippet = "package "
}

+ self.extraModuleImports = externalModuleImports
self.experimentalStripNonfunctionalCodegen = experimentalStripNonfunctionalCodegen
self.experimentalHiddenNames = experimentalHiddenNames

3 changes: 3 additions & 0 deletions plugins/grpc/java/v1.82.1/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*
!Dockerfile
!pom.xml
29 changes: 29 additions & 0 deletions plugins/grpc/java/v1.82.1/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# syntax=docker/dockerfile:1.24
FROM debian:trixie-20260623@sha256:d07d1b51c39f51188e60be9b64e6bf769fa94e187f092bc32b91305cfa34ba5a AS build

ARG TARGETARCH

WORKDIR /build
RUN apt-get update \
&& apt-get install -y curl
RUN arch=${TARGETARCH}; \
if [ "${arch}" = "arm64" ]; then\
arch="aarch_64"; \
elif [ "${arch}" = "amd64" ]; then\
arch="x86_64"; \
fi; \
echo "${arch}"; \
curl -fsSL -o protoc-gen-grpc-java https://repo1.maven.org/maven2/io/grpc/protoc-gen-grpc-java/1.82.1/protoc-gen-grpc-java-1.82.1-linux-${arch}.exe

FROM gcr.io/distroless/cc-debian13:latest@sha256:a017e74bd2a12d98342dbecd33d121d2b160415ed777573dc1808969e989d94d AS base

FROM maven:3.9.11-eclipse-temurin-21 AS maven-deps
COPY pom.xml /tmp/pom.xml
RUN cd /tmp && mvn -f pom.xml dependency:go-offline

FROM scratch
COPY --link --from=base / /
COPY --link --from=build --chmod=0755 --chown=root:root /build/protoc-gen-grpc-java .
COPY --from=maven-deps /root/.m2/repository /maven-repository
USER nobody
ENTRYPOINT [ "/protoc-gen-grpc-java" ]
30 changes: 30 additions & 0 deletions plugins/grpc/java/v1.82.1/buf.plugin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: v1
name: buf.build/grpc/java
plugin_version: v1.82.1
source_url: https://github.com/grpc/grpc-java
integration_guide_url: https://grpc.io/docs/languages/java/quickstart
description: Generates Java client and server stubs for the gRPC framework.
deps:
- plugin: buf.build/protocolbuffers/java:v35.1
output_languages:
- java
spdx_license_id: Apache-2.0
license_url: https://github.com/grpc/grpc-java/blob/v1.82.1/LICENSE
registry:
maven:
deps:
- io.grpc:grpc-core:1.82.1
- io.grpc:grpc-protobuf:1.82.1
- io.grpc:grpc-stub:1.82.1
# Add direct dependency on newer protobuf as gRPC is still on 3.25.8
- com.google.protobuf:protobuf-java:4.35.1
additional_runtimes:
- name: lite
deps:
- io.grpc:grpc-core:1.82.1
- io.grpc:grpc-protobuf-lite:1.82.1
- io.grpc:grpc-stub:1.82.1
# Add direct dependency on newer protobuf as gRPC is still on 3.25.8
- com.google.protobuf:protobuf-javalite:4.35.1
- build.buf:protobuf-javalite:4.35.1
opts: [lite]
44 changes: 44 additions & 0 deletions plugins/grpc/java/v1.82.1/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>temp</groupId>
<artifactId>temp</artifactId>
<version>1.0</version>
<dependencies>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-core</artifactId>
<version>1.82.1</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-protobuf</artifactId>
<version>1.82.1</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-stub</artifactId>
<version>1.82.1</version>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>4.35.1</version>
</dependency>
<!-- lite -->
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-protobuf-lite</artifactId>
<version>1.82.1</version>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-javalite</artifactId>
<version>4.35.1</version>
</dependency>
<dependency>
<groupId>build.buf</groupId>
<artifactId>protobuf-javalite</artifactId>
<version>4.35.1</version>
</dependency>
</dependencies>
</project>
3 changes: 3 additions & 0 deletions plugins/grpc/swift-protobuf/v2.4.1/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*
!Dockerfile
!Package.resolved
18 changes: 18 additions & 0 deletions plugins/grpc/swift-protobuf/v2.4.1/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# syntax=docker/dockerfile:1.24
FROM swift:6.3.2-bookworm@sha256:30d471336eefd13ae5adfab40966a923cb79a32ca0f10974a43b50438a1f9329 AS build

RUN apt-get update \
&& apt-get install -y unzip
WORKDIR /app
RUN git clone --depth 1 --branch 2.4.1 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-debian13:latest@sha256:a017e74bd2a12d98342dbecd33d121d2b160415ed777573dc1808969e989d94d 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" ]
33 changes: 33 additions & 0 deletions plugins/grpc/swift-protobuf/v2.4.1/Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions plugins/grpc/swift-protobuf/v2.4.1/buf.plugin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: v1
name: buf.build/grpc/swift-protobuf
plugin_version: v2.4.1
source_url: https://github.com/grpc/grpc-swift-protobuf
description: Generates Swift client and server stubs for the gRPC framework.
deps:
- plugin: buf.build/apple/swift:v1.38.1
output_languages:
- swift
registry:
swift:
deps:
- source: https://github.com/grpc/grpc-swift-protobuf.git
package: grpc-swift-protobuf
version: 2.4.1
products:
- GRPCProtobuf
platforms:
macos: v15
ios: v18
tvos: v18
watchos: v11
swift_versions:
- .v6
opts:
- Visibility=Public
- FileNaming=PathToUnderscores
spdx_license_id: Apache-2.0
license_url: https://github.com/grpc/grpc-swift-protobuf/blob/2.4.1/LICENSE
integration_guide_url: https://swiftpackageindex.com/grpc/grpc-swift-protobuf/2.4.1/documentation/grpcprotobuf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
h1:qeyF/DAfv+fz8bCazdKuLL5Bjrrp1/xTp7aS3oCwqeI=
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
h1:3NaCKHGNbSrmK831WmWSaoWMEVq5dt45Fok8MEgOcgU=
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
h1:abVqnZfKuwUcrLQyb+Lu2QqyVxyEnfIosZqrc8Lv/f0=
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
h1:LtrVq0lTE5qfsjeZj2BqKoPibzJpnzDsSY/jO/SrmoY=
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
h1:H1L2+dsAzxe/ws+/A+IrA6i90XNPvCUzQ2XzLsRGfWI=
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
h1:0NpEEqxBXr2NItKYA/fHLsnwN1eqJFEVakuZ2Wao9Yk=
Loading