From 7d946ae6a00f354f33fde3bb583fe61b5b7f0814 Mon Sep 17 00:00:00 2001 From: darronschall Date: Fri, 22 Nov 2024 12:16:13 -0500 Subject: [PATCH 1/8] Rename gradle projects from twirp-kmm to twirp-kmp --- settings.gradle.kts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/settings.gradle.kts b/settings.gradle.kts index 13a64c7..a281edb 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -6,10 +6,10 @@ pluginManagement { } } -rootProject.name = "twirp-kmm" +rootProject.name = "twirp-kmp" -include("generator") -project(":generator").name = "twirp-kmm-generator" +include(":generator") +project(":generator").name = "twirp-kmp-generator" include(":runtime") -project(":runtime").name = "twirp-kmm-runtime" +project(":runtime").name = "twirp-kmp-runtime" From 034968df9279c497c39bae072c0f0de259cc7e4a Mon Sep 17 00:00:00 2001 From: darronschall Date: Fri, 22 Nov 2024 12:26:05 -0500 Subject: [PATCH 2/8] Update iOS framework base name --- runtime/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/build.gradle.kts b/runtime/build.gradle.kts index 5d1d2a9..7ab53de 100644 --- a/runtime/build.gradle.kts +++ b/runtime/build.gradle.kts @@ -55,7 +55,7 @@ kotlin { iosSimulatorArm64(), ).forEach { it.binaries.framework { - baseName = "twirp-kmm-runtime" + baseName = "twirp-kmp-runtime" } } From 3b09e68e08c94815a6d2cc66cfa5c5d0ba131bda Mon Sep 17 00:00:00 2001 From: darronschall Date: Fri, 22 Nov 2024 12:27:21 -0500 Subject: [PATCH 3/8] Update twirp-kmm references in docs --- README.md | 12 ++++++------ RELEASING.md | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 73fdb5b..9c48d7f 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ There are two parts to this project - the [generator](./generator) itself, and t ## Generator -In general, follow [PBandK Usage](https://github.com/streem/pbandk#usage) instructions, but supply the `twirp-kmm-generator` as the `kotlin_service_gen` option as described in [PBandK's Service Code Generation documentation](https://github.com/streem/pbandk#service-code-generation). +In general, follow [PBandK Usage](https://github.com/streem/pbandk#usage) instructions, but supply the `twirp-kmp-generator` as the `kotlin_service_gen` option as described in [PBandK's Service Code Generation documentation](https://github.com/streem/pbandk#service-code-generation). ### Usage @@ -17,7 +17,7 @@ Download the latest release, currently `0.4.0`, and pass it to `protoc` via `pba ```bash # Download the library to ~ cd ~/ -curl -OL https://github.com/collectiveidea/twirp-kmm/releases/download/0.4.0/twirp-kmm-generator-0.4.0.jar +curl -OL https://github.com/collectiveidea/twirp-kmp/releases/download/0.4.0/twirp-kmp-generator-0.4.0.jar ``` @@ -25,7 +25,7 @@ Pass the jar and generator class name as the `kotlin_service_gen` option to `pba ```bash cd ~/exampleProject -protoc --pbandk_out=kotlin_service_gen='~/twirp-kmm-generator-0.4.0.jar|com.collectiveidea.twirp.Generator',kotlin_package=com.example.api:src/main/kotlin src/main/proto/example.proto +protoc --pbandk_out=kotlin_service_gen='~/twirp-kmp-generator-0.4.0.jar|com.collectiveidea.twirp.Generator',kotlin_package=com.example.api:src/main/kotlin src/main/proto/example.proto ``` ### Build @@ -36,12 +36,12 @@ To build the library locally, run: ./gradlew build ``` -This creates the versioned `.jar` file, e.g. `generator/build/libs/twirp-kmm-generator-0.4.0-SNAPSHOT.jar` +This creates the versioned `.jar` file, e.g. `generator/build/libs/twirp-kmp-generator-0.4.0-SNAPSHOT.jar` Then, the built version can be used, instead of the latest release, by supplying the path to the built `.jar`, e.g.: ```bash -protoc --pbandk_out=kotlin_service_gen='/Users/darron/Development/twirp-kmm/generator/build/libs/twirp-kmm-generator-0.4.0-SNAPSHOT.jar|com.collectiveidea.twirp.Generator',kotlin_package=com.example.api:shared/src/commonMain/kotlin shared/src/commonMain/proto/example.proto +protoc --pbandk_out=kotlin_service_gen='/Users/darron/Development/twirp-kmp/generator/build/libs/twirp-kmp-generator-0.4.0-SNAPSHOT.jar|com.collectiveidea.twirp.Generator',kotlin_package=com.example.api:shared/src/commonMain/kotlin shared/src/commonMain/proto/example.proto ``` ## Runtime @@ -51,7 +51,7 @@ The runtime provides an [`installTwirp`](./runtime/src/commonMain/kotlin/com/col First, add the runtime as a dependency: ``` -implementation "com.collectiveidea.twirp:twirp-kmm-runtime:0.4.0" +implementation "com.collectiveidea.twirp:twirp-kmp-runtime:0.4.0" ``` Then, configure the HttpClient and pass the client into the generated service constructor: diff --git a/RELEASING.md b/RELEASING.md index 9927df3..d3edcf2 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -31,9 +31,9 @@ ``` 8. Create GitHub Release - 1. Visit the [New Releases](https://github.com/collectiveidea/twirp-kmm/releases/new) page. + 1. Visit the [New Releases](https://github.com/collectiveidea/twirp-kmp/releases/new) page. 2. Supply release version and changelog - 3. Upload `generator/build/libs/twirp-kmm-generator-X.Y.Z.jar` artifact. + 3. Upload `generator/build/libs/twirp-kmp-generator-X.Y.Z.jar` artifact. 9. Publish (runtime) @@ -41,4 +41,4 @@ $ ./gradlew publish ``` -10. Visit [Sonatype Nexus](https://s01.oss.sonatype.org) and promote the artifact. \ No newline at end of file +10. Visit [Sonatype Nexus](https://s01.oss.sonatype.org) and promote the artifact. From 52eb75fd2bf3f393be4624cb831eaaf7c42d1aa7 Mon Sep 17 00:00:00 2001 From: darronschall Date: Fri, 22 Nov 2024 12:28:26 -0500 Subject: [PATCH 4/8] Update project names in actions --- .github/workflows/build-and-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 85e0183..f108e68 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -37,10 +37,10 @@ jobs: java-version: 21 - name: Build (Generator) - run: ./gradlew twirp-kmm-generator:build + run: ./gradlew twirp-kmp-generator:build - name: Test (Runtime) - run: ./gradlew twirp-kmm-runtime:testReleaseUnitTest + run: ./gradlew twirp-kmp-runtime:testReleaseUnitTest - name: Archive Runtime Test Report if: success() || failure() # Allow canceling per https://stackoverflow.com/a/73015952 From 2b72f8668e7ee760b9f7362d691750cee3ab7244 Mon Sep 17 00:00:00 2001 From: darronschall Date: Fri, 22 Nov 2024 12:30:12 -0500 Subject: [PATCH 5/8] Update project name for publishing --- buildSrc/src/main/kotlin/MavenPublicationExtensions.kt | 10 +++++----- generator/build.gradle.kts | 2 +- runtime/build.gradle.kts | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/buildSrc/src/main/kotlin/MavenPublicationExtensions.kt b/buildSrc/src/main/kotlin/MavenPublicationExtensions.kt index 350a240..a0ba3d5 100644 --- a/buildSrc/src/main/kotlin/MavenPublicationExtensions.kt +++ b/buildSrc/src/main/kotlin/MavenPublicationExtensions.kt @@ -1,6 +1,6 @@ import org.gradle.api.publish.maven.MavenPublication -fun MavenPublication.configureTwirpKmmPOM(pomDescription: String) { +fun MavenPublication.configureTwirpKmpPOM(pomDescription: String) { val pomName = artifactId pom { @@ -14,16 +14,16 @@ fun MavenPublication.configureTwirpKmmPOM(pomDescription: String) { } } - url.set("https://github.com/collectiveidea/twirp-kmm") + url.set("https://github.com/collectiveidea/twirp-kmp") issueManagement { system.set("Github") - url.set("https://github.com/collectiveidea/twirp-kmm/issues") + url.set("https://github.com/collectiveidea/twirp-kmp/issues") } scm { - connection.set("https://github.com/collectiveidea/twirp-kmm.git") - url.set("https://github.com/collectiveidea/twirp-kmm") + connection.set("https://github.com/collectiveidea/twirp-kmp.git") + url.set("https://github.com/collectiveidea/twirp-kmp") } developers { diff --git a/generator/build.gradle.kts b/generator/build.gradle.kts index 0338146..5f4a00c 100644 --- a/generator/build.gradle.kts +++ b/generator/build.gradle.kts @@ -52,6 +52,6 @@ publishing { publications.withType { artifact(javadocJar.get()) - configureTwirpKmmPOM(project.description!!) + configureTwirpKmpPOM(project.description!!) } } diff --git a/runtime/build.gradle.kts b/runtime/build.gradle.kts index 7ab53de..184b87f 100644 --- a/runtime/build.gradle.kts +++ b/runtime/build.gradle.kts @@ -104,7 +104,7 @@ publishing { publications.withType { artifact(javadocJar.get()) - configureTwirpKmmPOM(project.description!!) + configureTwirpKmpPOM(project.description!!) } } From ccb9ea200270865d88f7d11a768c2ae170ce4737 Mon Sep 17 00:00:00 2001 From: darronschall Date: Fri, 22 Nov 2024 12:37:36 -0500 Subject: [PATCH 6/8] Add CHANGELOG entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc56118..254e25f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [Unreleased] + * **BREAKING** Rename project from twirp-kmm to twirp-kmp. See [#16](https://github.com/collectiveidea/twirp-kmm/pull/16) * Generator - Ensure generator .jar artifact is built for Java 8. See [#15](https://github.com/collectiveidea/twirp-kmm/pull/15). ## [0.4.0] - 2024-09-03 From 6309c7cf8fe5adb5adbc37a866ff245dd18b1ca9 Mon Sep 17 00:00:00 2001 From: darronschall Date: Fri, 22 Nov 2024 12:39:41 -0500 Subject: [PATCH 7/8] Update old link in the README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9c48d7f..e2650c9 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ # PBandK Service Generator and Runtime for Twirp KMM -This project is a [service generator plugin](https://github.com/streem/pbandk#service-code-generation) for [PBandK](https://github.com/streem/pbandk) that generates Kotlin client integration for [Twirp](https://github.com/twitchtv/twirp) services. The generated client code leverages [PBandK](https://github.com/streem/pbandk) for protobuf messages, [kotlinx.serialization](https://github.com/Kotlin/kotlinx.serialization) for [JSON handling of Twirp service errors](https://twitchtv.github.io/twirp/docs/errors.html), and [Ktor](https://github.com/ktorio/ktor) for HTTP. All of these choices enable the generated client code to be leveraged in [Kotlin Multiplatform Mobile](https://kotlinlang.org/lp/mobile/) projects, sharing the network integration layer with both iOS and Android native apps. +This project is a [service generator plugin](https://github.com/streem/pbandk#service-code-generation) for [PBandK](https://github.com/streem/pbandk) that generates Kotlin client integration for [Twirp](https://github.com/twitchtv/twirp) services. The generated client code leverages [PBandK](https://github.com/streem/pbandk) for protobuf messages, [kotlinx.serialization](https://github.com/Kotlin/kotlinx.serialization) for [JSON handling of Twirp service errors](https://twitchtv.github.io/twirp/docs/errors.html), and [Ktor](https://github.com/ktorio/ktor) for HTTP. All of these choices enable the generated client code to be leveraged in [Kotlin Multiplatform](https://kotlinlang.org/docs/multiplatform.html) projects, sharing the network integration layer with compatible platform targets. There are two parts to this project - the [generator](./generator) itself, and the supporting [runtime](./runtime) for leveraging the generated service code. From fc1c63233793b6999756b8aa0cc82d464c0a66ae Mon Sep 17 00:00:00 2001 From: darronschall Date: Fri, 22 Nov 2024 12:49:34 -0500 Subject: [PATCH 8/8] Use a better Android namespace --- runtime/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/build.gradle.kts b/runtime/build.gradle.kts index 184b87f..c8de3ea 100644 --- a/runtime/build.gradle.kts +++ b/runtime/build.gradle.kts @@ -89,7 +89,7 @@ android { targetCompatibility = JavaVersion.VERSION_1_8 } - namespace = "com.collectiveidea" + namespace = "com.collectiveidea.twirp" } tasks.withType().configureEach {