-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update plugins #1342
Merged
Merged
Update plugins #1342
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
5336666
Update plugins
mfridman 75a012c
Update plugins/apple/swift/v1.27.0/Dockerfile
mfridman 1fca468
Update plugins/connectrpc/kotlin/v0.7.0/Dockerfile
mfridman ee31c75
Update plugins/connectrpc/kotlin/v0.7.0/buf.plugin.yaml
mfridman 1ea0fb8
reduce number of layers in connectrpc/kotlin:v0.7.0
mfridman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
* | ||
!Dockerfile | ||
!extramoduleimports.patch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# syntax=docker/dockerfile:1.8 | ||
FROM swift:5.10.1-bookworm AS build | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y libstdc++-12-dev | ||
COPY --link extramoduleimports.patch /app/extramoduleimports.patch | ||
WORKDIR /app | ||
RUN git clone --depth 1 --branch 1.27.0 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-debian12:latest@sha256:3b75fdd33932d16e53a461277becf57c4f815c6cee5f6bc8f52457c095e004c8 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" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
version: v1 | ||
name: buf.build/apple/swift | ||
plugin_version: v1.27.0 | ||
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: [ ".v5" ] | ||
products: [ SwiftProtobuf ] | ||
version: 1.27.0 | ||
opts: | ||
- Visibility=Public | ||
- FileNaming=PathToUnderscores | ||
spdx_license_id: Apache-2.0 | ||
license_url: https://github.com/apple/swift-protobuf/blob/1.27.0/LICENSE.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
diff --git a/Sources/protoc-gen-swift/FileGenerator.swift b/Sources/protoc-gen-swift/FileGenerator.swift | ||
index ebbbdca6..0e21fa95 100644 | ||
--- a/Sources/protoc-gen-swift/FileGenerator.swift | ||
+++ b/Sources/protoc-gen-swift/FileGenerator.swift | ||
@@ -113,6 +113,14 @@ class FileGenerator { | ||
p.print(neededImports) | ||
} | ||
|
||
+ 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 2635cb8d..58a75681 100644 | ||
--- a/Sources/protoc-gen-swift/GeneratorOptions.swift | ||
+++ b/Sources/protoc-gen-swift/GeneratorOptions.swift | ||
@@ -49,6 +49,7 @@ class GeneratorOptions { | ||
} | ||
} | ||
|
||
+ let extraModuleImports: [String] | ||
let outputNaming: OutputNaming | ||
let protoToModuleMappings: ProtoFileToModuleMappings | ||
let visibility: Visibility | ||
@@ -59,6 +60,7 @@ class GeneratorOptions { | ||
let visibilitySourceSnippet: String | ||
|
||
init(parameter: any CodeGeneratorParameter) throws { | ||
+ var externalModuleImports: [String] = [] | ||
var outputNaming: OutputNaming = .fullPath | ||
var moduleMapPath: String? | ||
var visibility: Visibility = .internal | ||
@@ -111,6 +113,12 @@ class GeneratorOptions { | ||
throw GenerationError.invalidParameterValue(name: pair.key, | ||
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) | ||
} | ||
@@ -140,6 +148,7 @@ class GeneratorOptions { | ||
visibilitySourceSnippet = "package " | ||
} | ||
|
||
+ self.extraModuleImports = externalModuleImports | ||
self.implementationOnlyImports = implementationOnlyImports | ||
self.experimentalStripNonfunctionalCodegen = experimentalStripNonfunctionalCodegen | ||
|
2 changes: 2 additions & 0 deletions
2
plugins/community/mercari-grpc-federation/v1.0.3/.dockerignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* | ||
!Dockerfile |
16 changes: 16 additions & 0 deletions
16
plugins/community/mercari-grpc-federation/v1.0.3/Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# syntax=docker/dockerfile:1.8 | ||
FROM --platform=$BUILDPLATFORM golang:1.22.5-bookworm AS build | ||
|
||
ARG TARGETOS TARGETARCH | ||
ENV CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH | ||
|
||
RUN --mount=type=cache,target=/go/pkg/mod \ | ||
go install -ldflags="-s -w" -trimpath github.com/mercari/grpc-federation/cmd/protoc-gen-grpc-federation@v1.0.3 \ | ||
&& mv /go/bin/${GOOS}_${GOARCH}/protoc-gen-grpc-federation /go/bin/protoc-gen-grpc-federation || true | ||
|
||
FROM scratch | ||
COPY --from=build --link --chown=root:root /etc/passwd /etc/passwd | ||
COPY --from=build --link --chown=root:root /go/bin/protoc-gen-grpc-federation . | ||
ENV GOROOT / | ||
USER nobody | ||
ENTRYPOINT [ "/protoc-gen-grpc-federation" ] |
10 changes: 10 additions & 0 deletions
10
plugins/community/mercari-grpc-federation/v1.0.3/buf.plugin.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
version: v1 | ||
name: buf.build/community/mercari-grpc-federation | ||
plugin_version: v1.0.3 | ||
source_url: https://github.com/mercari/grpc-federation | ||
integration_guide_url: https://github.com/mercari/grpc-federation/blob/main/docs/getting_started.md | ||
description: Generates a gRPC server by writing a custom option in Protocol Buffers | ||
output_languages: | ||
- go | ||
spdx_license_id: MIT | ||
license_url: https://github.com/mercari/grpc-federation/blob/v1.0.3/LICENSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* | ||
!Dockerfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# syntax=docker/dockerfile:1.8 | ||
FROM debian:bookworm-20240701 AS build | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y curl | ||
WORKDIR /app | ||
RUN curl -fsSL -o /app/protoc-gen-connect-kotlin.jar https://repo1.maven.org/maven2/com/connectrpc/protoc-gen-connect-kotlin/0.7.0/protoc-gen-connect-kotlin-0.7.0.jar | ||
|
||
FROM gcr.io/distroless/java17-debian12:latest@sha256:c8c2c236c63d7652b707a05b02d0259db91d5feb357e9dc53942f73c2e001088 as base | ||
|
||
FROM scratch | ||
COPY --from=base --link / / | ||
COPY --from=build --link --chmod=0755 --chown=root:root /app/protoc-gen-connect-kotlin.jar . | ||
USER nobody | ||
ENTRYPOINT [ "/usr/bin/java", "-jar", "/protoc-gen-connect-kotlin.jar"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
version: v1 | ||
name: buf.build/connectrpc/kotlin | ||
plugin_version: v0.7.0 | ||
source_url: https://github.com/connectrpc/connect-kotlin | ||
integration_guide_url: https://connectrpc.com/docs/kotlin/getting-started | ||
description: Idiomatic gRPC & Connect RPCs for Kotlin. | ||
deps: | ||
- plugin: buf.build/protocolbuffers/kotlin:v27.2 | ||
output_languages: | ||
- kotlin | ||
spdx_license_id: Apache-2.0 | ||
license_url: https://github.com/connectrpc/connect-kotlin/blob/v0.7.0/LICENSE | ||
registry: | ||
opts: | ||
- generateCallbackMethods=true | ||
maven: | ||
compiler: | ||
kotlin: | ||
version: 1.8.22 | ||
deps: | ||
- com.connectrpc:connect-kotlin:0.7.0 | ||
- com.connectrpc:connect-kotlin-google-java-ext:0.7.0 | ||
- com.connectrpc:connect-kotlin-okhttp:0.7.0 | ||
additional_runtimes: | ||
- name: lite | ||
deps: | ||
- com.connectrpc:connect-kotlin:0.7.0 | ||
- com.connectrpc:connect-kotlin-google-javalite-ext:0.7.0 | ||
- com.connectrpc:connect-kotlin-okhttp:0.7.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
h1:Ak7QlCoz/kgH0BQspvvNhmzAQDFa/xqV47s+RXhwz3I= |
1 change: 1 addition & 0 deletions
1
tests/testdata/buf.build/apple/swift/v1.27.0/petapis/plugin.sum
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
h1:Gpr6hUuB0MnlCoC1csxyv4R4dtr4JJGteNYR+la1Txs= |
1 change: 1 addition & 0 deletions
1
tests/testdata/buf.build/community/mercari-grpc-federation/v1.0.3/eliza/plugin.sum
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
h1:47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU= |
1 change: 1 addition & 0 deletions
1
...ata/buf.build/community/mercari-grpc-federation/v1.0.3/grpc-federation-v0.13.6/plugin.sum
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
h1:3OpebhxJaaoWGtZnxNZXCFQ3ocC/YwKEPKdr7+WiklY= |
1 change: 1 addition & 0 deletions
1
tests/testdata/buf.build/community/mercari-grpc-federation/v1.0.3/petapis/plugin.sum
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
h1:47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU= |
1 change: 1 addition & 0 deletions
1
tests/testdata/buf.build/connectrpc/kotlin/v0.7.0/eliza/plugin.sum
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
h1:MvGcwJYJzh9kN8sb8qq6ClUH/2UCMP/xYWONtovu9+Y= |
1 change: 1 addition & 0 deletions
1
tests/testdata/buf.build/connectrpc/kotlin/v0.7.0/petapis/plugin.sum
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
h1:Lu/IDJuTxgy5MwtXMbmK2Fvg40Gh13mYPTg+PUAbx8s= |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved some of the constants and variables towards the "top" to minimize conflicts.