Skip to content

Commit 2f7f96e

Browse files
Update apple and grpc (#2560)
### apple - swift: v1.38.0 → v1.38.1 ### grpc - java: v1.82.0 → v1.82.1 - swift-protobuf: v2.4.0 → v2.4.1 Co-authored-by: app-token-plugins[bot] <app-token-plugins[bot]@users.noreply.github.com>
1 parent 1f3f4c5 commit 2f7f96e

18 files changed

Lines changed: 302 additions & 0 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*
2+
!Dockerfile
3+
!extramoduleimports.patch
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# syntax=docker/dockerfile:1.24
2+
FROM swift:6.3.2-bookworm@sha256:30d471336eefd13ae5adfab40966a923cb79a32ca0f10974a43b50438a1f9329 AS build
3+
4+
RUN apt-get update \
5+
&& apt-get install -y libstdc++-12-dev unzip
6+
COPY --link extramoduleimports.patch /app/extramoduleimports.patch
7+
WORKDIR /app
8+
RUN git clone --depth 1 --branch 1.38.1 https://github.com/apple/swift-protobuf --recursive
9+
WORKDIR /app/swift-protobuf
10+
RUN git apply /app/extramoduleimports.patch
11+
RUN swift build -c release --static-swift-stdlib -Xlinker -s
12+
13+
FROM gcr.io/distroless/cc-debian13:latest@sha256:a017e74bd2a12d98342dbecd33d121d2b160415ed777573dc1808969e989d94d AS base
14+
15+
FROM scratch
16+
COPY --link --from=base / /
17+
COPY --link --from=build /app/swift-protobuf/.build/release/protoc-gen-swift .
18+
USER nobody
19+
ENTRYPOINT [ "/protoc-gen-swift" ]
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
version: v1
2+
name: buf.build/apple/swift
3+
plugin_version: v1.38.1
4+
source_url: https://github.com/apple/swift-protobuf
5+
integration_guide_url: https://github.com/apple/swift-protobuf#getting-started
6+
description: Base types for Swift. Generates message and enum types.
7+
output_languages:
8+
- swift
9+
registry:
10+
swift:
11+
deps:
12+
- source: https://github.com/apple/swift-protobuf.git
13+
package: swift-protobuf
14+
swift_versions: [ ".v6" ]
15+
products: [ SwiftProtobuf ]
16+
version: 1.38.1
17+
opts:
18+
- Visibility=Public
19+
- FileNaming=PathToUnderscores
20+
spdx_license_id: Apache-2.0
21+
license_url: https://github.com/apple/swift-protobuf/blob/1.38.1/LICENSE.txt
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
diff --git a/Sources/protoc-gen-swift/FileGenerator.swift b/Sources/protoc-gen-swift/FileGenerator.swift
2+
index d370e25..cea7bd2 100644
3+
--- a/Sources/protoc-gen-swift/FileGenerator.swift
4+
+++ b/Sources/protoc-gen-swift/FileGenerator.swift
5+
@@ -161,6 +161,14 @@ class FileGenerator {
6+
return
7+
}
8+
9+
+ let neededCustomImports = generatorOptions.extraModuleImports
10+
+ if !neededCustomImports.isEmpty {
11+
+ p.print()
12+
+ for i in neededCustomImports {
13+
+ p.print("import \(i)\n")
14+
+ }
15+
+ }
16+
+
17+
p.print()
18+
generateVersionCheck(printer: &p)
19+
20+
diff --git a/Sources/protoc-gen-swift/GeneratorOptions.swift b/Sources/protoc-gen-swift/GeneratorOptions.swift
21+
index 159e621..a8f631e 100644
22+
--- a/Sources/protoc-gen-swift/GeneratorOptions.swift
23+
+++ b/Sources/protoc-gen-swift/GeneratorOptions.swift
24+
@@ -115,6 +115,7 @@ package class GeneratorOptions {
25+
}
26+
}
27+
28+
+ let extraModuleImports: [String]
29+
let outputNaming: OutputNaming
30+
let enumGeneration: EnumGeneration
31+
let protoToModuleMappings: ProtoFileToModuleMappings
32+
@@ -146,6 +147,7 @@ package class GeneratorOptions {
33+
}
34+
35+
package init(parameter: any CodeGeneratorParameter) throws {
36+
+ var externalModuleImports: [String] = []
37+
var outputNaming: OutputNaming = .fullPath
38+
var enumGeneration: EnumGeneration = .none
39+
var moduleMapPath: String?
40+
@@ -238,6 +240,15 @@ package class GeneratorOptions {
41+
value: pair.value
42+
)
43+
}
44+
+ case "ExtraModuleImports":
45+
+ if !pair.value.isEmpty {
46+
+ externalModuleImports.append(pair.value)
47+
+ } else {
48+
+ throw GenerationError.invalidParameterValue(
49+
+ name: pair.key,
50+
+ value: pair.value
51+
+ )
52+
+ }
53+
default:
54+
throw GenerationError.unknownParameter(name: pair.key)
55+
}
56+
@@ -272,6 +283,7 @@ package class GeneratorOptions {
57+
visibilitySourceSnippet = "package "
58+
}
59+
60+
+ self.extraModuleImports = externalModuleImports
61+
self.experimentalStripNonfunctionalCodegen = experimentalStripNonfunctionalCodegen
62+
self.experimentalHiddenNames = experimentalHiddenNames
63+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*
2+
!Dockerfile
3+
!pom.xml
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# syntax=docker/dockerfile:1.24
2+
FROM debian:trixie-20260623@sha256:d07d1b51c39f51188e60be9b64e6bf769fa94e187f092bc32b91305cfa34ba5a AS build
3+
4+
ARG TARGETARCH
5+
6+
WORKDIR /build
7+
RUN apt-get update \
8+
&& apt-get install -y curl
9+
RUN arch=${TARGETARCH}; \
10+
if [ "${arch}" = "arm64" ]; then\
11+
arch="aarch_64"; \
12+
elif [ "${arch}" = "amd64" ]; then\
13+
arch="x86_64"; \
14+
fi; \
15+
echo "${arch}"; \
16+
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
17+
18+
FROM gcr.io/distroless/cc-debian13:latest@sha256:a017e74bd2a12d98342dbecd33d121d2b160415ed777573dc1808969e989d94d AS base
19+
20+
FROM maven:3.9.11-eclipse-temurin-21 AS maven-deps
21+
COPY pom.xml /tmp/pom.xml
22+
RUN cd /tmp && mvn -f pom.xml dependency:go-offline
23+
24+
FROM scratch
25+
COPY --link --from=base / /
26+
COPY --link --from=build --chmod=0755 --chown=root:root /build/protoc-gen-grpc-java .
27+
COPY --from=maven-deps /root/.m2/repository /maven-repository
28+
USER nobody
29+
ENTRYPOINT [ "/protoc-gen-grpc-java" ]
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
version: v1
2+
name: buf.build/grpc/java
3+
plugin_version: v1.82.1
4+
source_url: https://github.com/grpc/grpc-java
5+
integration_guide_url: https://grpc.io/docs/languages/java/quickstart
6+
description: Generates Java client and server stubs for the gRPC framework.
7+
deps:
8+
- plugin: buf.build/protocolbuffers/java:v35.1
9+
output_languages:
10+
- java
11+
spdx_license_id: Apache-2.0
12+
license_url: https://github.com/grpc/grpc-java/blob/v1.82.1/LICENSE
13+
registry:
14+
maven:
15+
deps:
16+
- io.grpc:grpc-core:1.82.1
17+
- io.grpc:grpc-protobuf:1.82.1
18+
- io.grpc:grpc-stub:1.82.1
19+
# Add direct dependency on newer protobuf as gRPC is still on 3.25.8
20+
- com.google.protobuf:protobuf-java:4.35.1
21+
additional_runtimes:
22+
- name: lite
23+
deps:
24+
- io.grpc:grpc-core:1.82.1
25+
- io.grpc:grpc-protobuf-lite:1.82.1
26+
- io.grpc:grpc-stub:1.82.1
27+
# Add direct dependency on newer protobuf as gRPC is still on 3.25.8
28+
- com.google.protobuf:protobuf-javalite:4.35.1
29+
- build.buf:protobuf-javalite:4.35.1
30+
opts: [lite]

plugins/grpc/java/v1.82.1/pom.xml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<project>
2+
<modelVersion>4.0.0</modelVersion>
3+
<groupId>temp</groupId>
4+
<artifactId>temp</artifactId>
5+
<version>1.0</version>
6+
<dependencies>
7+
<dependency>
8+
<groupId>io.grpc</groupId>
9+
<artifactId>grpc-core</artifactId>
10+
<version>1.82.1</version>
11+
</dependency>
12+
<dependency>
13+
<groupId>io.grpc</groupId>
14+
<artifactId>grpc-protobuf</artifactId>
15+
<version>1.82.1</version>
16+
</dependency>
17+
<dependency>
18+
<groupId>io.grpc</groupId>
19+
<artifactId>grpc-stub</artifactId>
20+
<version>1.82.1</version>
21+
</dependency>
22+
<dependency>
23+
<groupId>com.google.protobuf</groupId>
24+
<artifactId>protobuf-java</artifactId>
25+
<version>4.35.1</version>
26+
</dependency>
27+
<!-- lite -->
28+
<dependency>
29+
<groupId>io.grpc</groupId>
30+
<artifactId>grpc-protobuf-lite</artifactId>
31+
<version>1.82.1</version>
32+
</dependency>
33+
<dependency>
34+
<groupId>com.google.protobuf</groupId>
35+
<artifactId>protobuf-javalite</artifactId>
36+
<version>4.35.1</version>
37+
</dependency>
38+
<dependency>
39+
<groupId>build.buf</groupId>
40+
<artifactId>protobuf-javalite</artifactId>
41+
<version>4.35.1</version>
42+
</dependency>
43+
</dependencies>
44+
</project>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*
2+
!Dockerfile
3+
!Package.resolved
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# syntax=docker/dockerfile:1.24
2+
FROM swift:6.3.2-bookworm@sha256:30d471336eefd13ae5adfab40966a923cb79a32ca0f10974a43b50438a1f9329 AS build
3+
4+
RUN apt-get update \
5+
&& apt-get install -y unzip
6+
WORKDIR /app
7+
RUN git clone --depth 1 --branch 2.4.1 https://github.com/grpc/grpc-swift-protobuf --recursive
8+
WORKDIR /app/grpc-swift-protobuf
9+
COPY --link Package.resolved .
10+
RUN swift build -c release --static-swift-stdlib --product protoc-gen-grpc-swift-2 -Xlinker -s --force-resolved-versions
11+
12+
FROM gcr.io/distroless/cc-debian13:latest@sha256:a017e74bd2a12d98342dbecd33d121d2b160415ed777573dc1808969e989d94d AS base
13+
14+
FROM scratch
15+
COPY --link --from=base / /
16+
COPY --link --from=build /app/grpc-swift-protobuf/.build/release/protoc-gen-grpc-swift-2 .
17+
USER nobody
18+
ENTRYPOINT [ "/protoc-gen-grpc-swift-2" ]

0 commit comments

Comments
 (0)