Skip to content

Commit ff0b429

Browse files
Update connectrpc/kotlin (#2341)
### connectrpc - kotlin: v0.7.4 → v0.8.0
1 parent d79e1a7 commit ff0b429

7 files changed

Lines changed: 165 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+
!pom.xml
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# syntax=docker/dockerfile:1.22
2+
FROM debian:bookworm-20260316 AS build
3+
4+
RUN apt-get update \
5+
&& apt-get install -y curl
6+
WORKDIR /app
7+
RUN curl -fsSL -o /app/protoc-gen-connect-kotlin.jar https://repo1.maven.org/maven2/com/connectrpc/protoc-gen-connect-kotlin/0.8.0/protoc-gen-connect-kotlin-0.8.0.jar
8+
9+
FROM gcr.io/distroless/java21-debian12:latest@sha256:f34fd3e4e2d7a246d764d0614f5e6ffb3a735930723fac4cfc25a72798950262 as base
10+
11+
FROM maven:3.9.11-eclipse-temurin-21 AS maven-deps
12+
COPY pom.xml /tmp/pom.xml
13+
RUN cd /tmp && mvn -f pom.xml dependency:go-offline
14+
15+
FROM scratch
16+
COPY --from=base --link / /
17+
COPY --from=build --link --chmod=0755 --chown=root:root /app/protoc-gen-connect-kotlin.jar .
18+
COPY --from=maven-deps /root/.m2/repository /maven-repository
19+
USER nobody
20+
ENTRYPOINT [ "/usr/bin/java", "-jar", "/protoc-gen-connect-kotlin.jar"]
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/connectrpc/kotlin
3+
plugin_version: v0.8.0
4+
source_url: https://github.com/connectrpc/connect-kotlin
5+
integration_guide_url: https://connectrpc.com/docs/kotlin/getting-started
6+
description: Idiomatic gRPC & Connect RPCs for Kotlin.
7+
deps:
8+
- plugin: buf.build/protocolbuffers/kotlin:v34.0
9+
output_languages:
10+
- kotlin
11+
spdx_license_id: Apache-2.0
12+
license_url: https://github.com/connectrpc/connect-kotlin/blob/v0.8.0/LICENSE
13+
registry:
14+
opts:
15+
- generateCallbackMethods=true
16+
maven:
17+
compiler:
18+
kotlin:
19+
api_version: "2.1"
20+
version: "2.2.21"
21+
deps:
22+
- com.connectrpc:connect-kotlin:0.8.0
23+
- com.connectrpc:connect-kotlin-google-java-ext:0.8.0
24+
- com.connectrpc:connect-kotlin-okhttp:0.8.0
25+
additional_runtimes:
26+
- name: lite
27+
deps:
28+
- com.connectrpc:connect-kotlin:0.8.0
29+
- com.connectrpc:connect-kotlin-google-javalite-ext:0.8.0
30+
- com.connectrpc:connect-kotlin-okhttp:0.8.0
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
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>com.connectrpc</groupId>
9+
<artifactId>connect-kotlin</artifactId>
10+
<version>0.8.0</version>
11+
</dependency>
12+
<dependency>
13+
<groupId>com.connectrpc</groupId>
14+
<artifactId>connect-kotlin-google-java-ext</artifactId>
15+
<version>0.8.0</version>
16+
</dependency>
17+
<dependency>
18+
<groupId>com.connectrpc</groupId>
19+
<artifactId>connect-kotlin-okhttp</artifactId>
20+
<version>0.8.0</version>
21+
</dependency>
22+
<dependency>
23+
<groupId>com.google.protobuf</groupId>
24+
<artifactId>protobuf-kotlin</artifactId>
25+
<version>4.34.0</version>
26+
</dependency>
27+
<dependency>
28+
<groupId>org.jetbrains.kotlin</groupId>
29+
<artifactId>kotlin-stdlib</artifactId>
30+
<version>1.8.22</version>
31+
</dependency>
32+
<dependency>
33+
<groupId>org.jetbrains.kotlin</groupId>
34+
<artifactId>kotlin-stdlib-jdk8</artifactId>
35+
<version>1.8.22</version>
36+
</dependency>
37+
<dependency>
38+
<groupId>com.google.protobuf</groupId>
39+
<artifactId>protobuf-java</artifactId>
40+
<version>4.34.0</version>
41+
</dependency>
42+
<!-- lite -->
43+
<dependency>
44+
<groupId>com.connectrpc</groupId>
45+
<artifactId>connect-kotlin-google-javalite-ext</artifactId>
46+
<version>0.8.0</version>
47+
</dependency>
48+
<dependency>
49+
<groupId>com.google.protobuf</groupId>
50+
<artifactId>protobuf-kotlin-lite</artifactId>
51+
<version>4.34.0</version>
52+
</dependency>
53+
<dependency>
54+
<groupId>com.google.protobuf</groupId>
55+
<artifactId>protobuf-javalite</artifactId>
56+
<version>4.34.0</version>
57+
</dependency>
58+
<dependency>
59+
<groupId>build.buf</groupId>
60+
<artifactId>protobuf-javalite</artifactId>
61+
<version>4.34.0</version>
62+
</dependency>
63+
</dependencies>
64+
<build>
65+
<plugins>
66+
<plugin>
67+
<groupId>org.jetbrains.kotlin</groupId>
68+
<artifactId>kotlin-maven-plugin</artifactId>
69+
<version>2.2.21</version>
70+
<configuration>
71+
<apiVersion>2.1</apiVersion>
72+
</configuration>
73+
</plugin>
74+
</plugins>
75+
</build>
76+
</project>

tests/plugins_test.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"cmp"
77
"context"
88
"encoding/xml"
9+
"errors"
910
"fmt"
1011
"io"
1112
"io/fs"
@@ -25,6 +26,7 @@ import (
2526
"golang.org/x/mod/semver"
2627
"golang.org/x/mod/sumdb/dirhash"
2728

29+
"github.com/bufbuild/plugins/internal/maven"
2830
"github.com/bufbuild/plugins/internal/plugin"
2931
"github.com/bufbuild/plugins/internal/source"
3032
)
@@ -326,6 +328,38 @@ func TestMavenDependencies(t *testing.T) {
326328
}
327329
}
328330

331+
func TestMavenPOMInSync(t *testing.T) {
332+
t.Parallel()
333+
plugins := loadFilteredPlugins(t)
334+
pluginsDir, err := filepath.Abs(filepath.Join("..", "plugins"))
335+
require.NoError(t, err)
336+
for _, p := range plugins {
337+
if p.Registry.Maven == nil {
338+
continue
339+
}
340+
pomPath := filepath.Join(filepath.Dir(p.Path), "pom.xml")
341+
if _, err := os.Stat(pomPath); err != nil {
342+
if errors.Is(err, fs.ErrNotExist) {
343+
continue
344+
}
345+
require.NoError(t, err)
346+
}
347+
t.Run(fmt.Sprintf("%s/%s@%s", p.Identity.Owner(), p.Identity.Plugin(), p.PluginVersion), func(t *testing.T) {
348+
t.Parallel()
349+
pluginVersionDir := filepath.Dir(p.Path)
350+
pluginConfig, err := bufremotepluginconfig.ParseConfig(p.Path)
351+
require.NoError(t, err)
352+
require.NoError(t, maven.MergeTransitiveDeps(pluginConfig, pluginsDir))
353+
require.NoError(t, maven.DeduplicateAllDeps(pluginConfig.Registry.Maven))
354+
expectedPOM, err := maven.RenderPOM(pluginConfig)
355+
require.NoError(t, err)
356+
actualPOM, err := os.ReadFile(filepath.Join(pluginVersionDir, "pom.xml"))
357+
require.NoError(t, err)
358+
assert.Equal(t, expectedPOM, string(actualPOM), "pom.xml is out of sync with buf.plugin.yaml")
359+
})
360+
}
361+
}
362+
329363
func TestNugetDependencies(t *testing.T) {
330364
t.Parallel()
331365

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
h1:jZozX+zN6UUwiUu38R4IG3BD2PFi7novwzYovV5V5mY=
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
h1:qI/BZM1TvMxo1xA+W5Y+h5jGfuIHe2aFsVRriNpB/3M=

0 commit comments

Comments
 (0)