From c4d1a00ab9fd81e178f8de3c41ad814845f031f7 Mon Sep 17 00:00:00 2001 From: Alexander Sysoev Date: Tue, 24 Sep 2024 11:52:44 +0200 Subject: [PATCH 1/7] Update version to 0.3.0 --- .github/workflows/docs.yml | 2 +- README.md | 8 ++++---- docs/pages/kotlinx-rpc/help-versions.json | 2 +- docs/pages/kotlinx-rpc/v.list | 2 +- docs/pages/kotlinx-rpc/writerside.cfg | 4 ++-- versions-root/libs.versions.toml | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 5b32cfe4..382e1a04 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -20,7 +20,7 @@ env: ALGOLIA_INDEX_NAME: 'prod_kotlin_rpc' ALGOLIA_KEY: '${{ secrets.ALGOLIA_KEY }}' CONFIG_JSON_PRODUCT: 'kotlinx-rpc' - CONFIG_JSON_VERSION: '0.2.4' + CONFIG_JSON_VERSION: '0.3.0' jobs: build: diff --git a/README.md b/README.md index eb044679..fc95c9d1 100644 --- a/README.md +++ b/README.md @@ -92,7 +92,7 @@ Example of plugins setup in a project's `build.gradle.kts`: plugins { kotlin("jvm") version "2.0.10" kotlin("plugin.serialization") version "2.0.10" - id("org.jetbrains.kotlinx.rpc.plugin") version "0.2.4" + id("org.jetbrains.kotlinx.rpc.plugin") version "0.3.0" } ``` @@ -106,7 +106,7 @@ plugins { kotlin("jvm") version "1.9.25" kotlin("plugin.serialization") version "1.9.25" id("com.google.devtools.ksp") version "1.9.25-1.0.20" - id("org.jetbrains.kotlinx.rpc.plugin") version "0.2.4" + id("org.jetbrains.kotlinx.rpc.plugin") version "0.3.0" } ``` ### Runtime dependencies @@ -166,11 +166,11 @@ based on the project's Kotlin version: ```kotlin plugins { kotlin("jvm") version "2.0.10" - id("org.jetbrains.kotlinx.rpc.plugin") version "0.2.4" + id("org.jetbrains.kotlinx.rpc.plugin") version "0.3.0" } dependencies { - // version 0.2.4 is set by the Gradle plugin + // version 0.3.0 is set by the Gradle plugin implementation("org.jetbrains.kotlinx:kotlinx-rpc-core") } ``` diff --git a/docs/pages/kotlinx-rpc/help-versions.json b/docs/pages/kotlinx-rpc/help-versions.json index 0d021e7f..aefc80e9 100644 --- a/docs/pages/kotlinx-rpc/help-versions.json +++ b/docs/pages/kotlinx-rpc/help-versions.json @@ -1,3 +1,3 @@ [ - {"version":"0.2.4","url":"/kotlinx-rpc/0.2.4/","isCurrent":true} + {"version":"0.3.0","url":"/kotlinx-rpc/0.3.0/","isCurrent":true} ] diff --git a/docs/pages/kotlinx-rpc/v.list b/docs/pages/kotlinx-rpc/v.list index 77e277ce..1897ccfc 100644 --- a/docs/pages/kotlinx-rpc/v.list +++ b/docs/pages/kotlinx-rpc/v.list @@ -14,7 +14,7 @@ - + diff --git a/docs/pages/kotlinx-rpc/writerside.cfg b/docs/pages/kotlinx-rpc/writerside.cfg index 6469bf23..2fc05fd8 100644 --- a/docs/pages/kotlinx-rpc/writerside.cfg +++ b/docs/pages/kotlinx-rpc/writerside.cfg @@ -12,5 +12,5 @@ - - \ No newline at end of file + + diff --git a/versions-root/libs.versions.toml b/versions-root/libs.versions.toml index 8abb4749..098995e1 100644 --- a/versions-root/libs.versions.toml +++ b/versions-root/libs.versions.toml @@ -1,6 +1,6 @@ [versions] # core library version -kotlinx-rpc = "0.3.0-SNAPSHOT" +kotlinx-rpc = "0.3.0" # kotlin kotlin-lang = "2.0.10" From b4a1dd137c86d8dd5bdff854d7b56241de70a79f Mon Sep 17 00:00:00 2001 From: Alexander Sysoev Date: Wed, 25 Sep 2024 13:57:33 +0200 Subject: [PATCH 2/7] Updated samples to use 0.3.0 --- .gitignore | 2 ++ .../ktor-all-platforms-app/build.gradle.kts | 11 +++++++ .../composeApp/build.gradle.kts | 31 ++++++++++++++++++- .../composeApp/src/commonMain/kotlin/App.kt | 10 +++--- .../src/wasmJsMain/kotlin/App.wasmJs.kt | 1 + .../composeApp/src/wasmJsMain/kotlin/main.kt | 11 +++++++ .../src/wasmJsMain/resources/index.html | 12 +++++++ .../src/wasmJsMain/resources/styles.css | 7 +++++ .../gradle/libs.versions.toml | 17 +++++----- .../server/build.gradle.kts | 4 +-- .../kotlin/kotlinx/rpc/sample/Application.kt | 8 ++--- .../kotlinx/rpc/sample/ApplicationTest.kt | 10 +++--- .../shared/build.gradle.kts | 18 +++++++++++ .../src/wasmJsMain/kotlin/Platform.wasmJs.kt | 2 +- .../kotlin/kotlinx/rpc/sample/data/Client.kt | 9 +++--- .../kotlinx/rpc/sample/ui/AppViewModel.kt | 2 +- .../gradle/libs.versions.toml | 2 +- .../kotlin/kotlinx/rpc/sample/Application.kt | 4 +-- .../server/src/test/kotlin/ApplicationTest.kt | 11 +++---- .../ktor-web-app/frontend/build.gradle.kts | 8 ----- .../frontend/src/jsMain/kotlin/RPC.kt | 8 ++--- .../frontend/src/jsMain/kotlin/Welcome.kt | 3 +- .../ktor-web-app/gradle/libs.versions.toml | 2 +- .../server/src/main/kotlin/Application.kt | 6 ++-- .../server/src/test/kotlin/ApplicationTest.kt | 10 +++--- samples/simple-ktor-app/build.gradle.kts | 2 +- .../simple-ktor-app/src/main/kotlin/Client.kt | 8 ++--- .../simple-ktor-app/src/main/kotlin/Server.kt | 6 ++-- .../src/test/kotlin/ApplicationTest.kt | 10 +++--- 29 files changed, 158 insertions(+), 77 deletions(-) create mode 100644 samples/ktor-all-platforms-app/composeApp/src/wasmJsMain/kotlin/App.wasmJs.kt create mode 100644 samples/ktor-all-platforms-app/composeApp/src/wasmJsMain/kotlin/main.kt create mode 100644 samples/ktor-all-platforms-app/composeApp/src/wasmJsMain/resources/index.html create mode 100644 samples/ktor-all-platforms-app/composeApp/src/wasmJsMain/resources/styles.css diff --git a/.gitignore b/.gitignore index 5e1bc92b..348ab60e 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,8 @@ build !.idea/detekt.xml !.idea/kotlinTestDataPluginTestDataPaths.xml +samples/**/.idea/* + .DS_Store # Ignore generated Detekt reports diff --git a/samples/ktor-all-platforms-app/build.gradle.kts b/samples/ktor-all-platforms-app/build.gradle.kts index 1889de65..48b39e28 100644 --- a/samples/ktor-all-platforms-app/build.gradle.kts +++ b/samples/ktor-all-platforms-app/build.gradle.kts @@ -15,3 +15,14 @@ plugins { alias(libs.plugins.kotlinx.rpc.platform) apply false alias(libs.plugins.compose.compiler) apply false } + +allprojects { + configurations.all { + resolutionStrategy { + // Workaround for https://youtrack.jetbrains.com/issue/CMP-6658 + force(libs.kotlinx.serialization.core) + force(libs.kotlinx.serialization.json) + force(libs.kotlin.stdlib) + } + } +} diff --git a/samples/ktor-all-platforms-app/composeApp/build.gradle.kts b/samples/ktor-all-platforms-app/composeApp/build.gradle.kts index 154bd5e8..a30b2132 100644 --- a/samples/ktor-all-platforms-app/composeApp/build.gradle.kts +++ b/samples/ktor-all-platforms-app/composeApp/build.gradle.kts @@ -5,6 +5,8 @@ import org.jetbrains.compose.desktop.application.dsl.TargetFormat import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi import org.jetbrains.kotlin.gradle.dsl.JvmTarget +import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl +import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig plugins { alias(libs.plugins.kotlinMultiplatform) @@ -15,6 +17,24 @@ plugins { } kotlin { + @OptIn(ExperimentalWasmDsl::class) + wasmJs { + moduleName = "composeApp" + browser { + val projectDirPath = project.projectDir.path + commonWebpackConfig { + outputFileName = "composeApp.js" + devServer = (devServer ?: KotlinWebpackConfig.DevServer()).apply { + static = (static ?: mutableListOf()).apply { + // Serve sources to debug inside browser + add(projectDirPath) + } + } + } + } + binaries.executable() + } + androidTarget { @OptIn(ExperimentalKotlinGradlePluginApi::class) compilerOptions { @@ -53,12 +73,21 @@ kotlin { implementation(libs.kotlinx.rpc.krpc.client) implementation(libs.kotlinx.rpc.krpc.serialization.json) implementation(libs.kotlinx.rpc.krpc.ktor.client) - implementation(libs.ktor.client.cio) implementation(libs.ktor.client.core) implementation(libs.ktor.client.websockets) } desktopMain.dependencies { implementation(compose.desktop.currentOs) + implementation(libs.ktor.client.cio) + } + iosMain.dependencies { + implementation(libs.ktor.client.cio) + } + wasmJsMain.dependencies { + implementation(libs.ktor.client.js) + } + androidMain.dependencies { + implementation(libs.ktor.client.cio) } } } diff --git a/samples/ktor-all-platforms-app/composeApp/src/commonMain/kotlin/App.kt b/samples/ktor-all-platforms-app/composeApp/src/commonMain/kotlin/App.kt index b6da85c7..ef6420d6 100644 --- a/samples/ktor-all-platforms-app/composeApp/src/commonMain/kotlin/App.kt +++ b/samples/ktor-all-platforms-app/composeApp/src/commonMain/kotlin/App.kt @@ -14,12 +14,12 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import io.ktor.client.* import io.ktor.http.* +import kotlinx.rpc.krpc.ktor.client.installRPC +import kotlinx.rpc.krpc.ktor.client.rpc +import kotlinx.rpc.krpc.ktor.client.rpcConfig +import kotlinx.rpc.krpc.serialization.json.json +import kotlinx.rpc.krpc.streamScoped import kotlinx.rpc.withService -import kotlinx.rpc.serialization.json -import kotlinx.rpc.streamScoped -import kotlinx.rpc.transport.ktor.client.installRPC -import kotlinx.rpc.transport.ktor.client.rpc -import kotlinx.rpc.transport.ktor.client.rpcConfig import ktor_all_platforms_app.composeapp.generated.resources.Res import ktor_all_platforms_app.composeapp.generated.resources.compose_multiplatform import org.jetbrains.compose.resources.painterResource diff --git a/samples/ktor-all-platforms-app/composeApp/src/wasmJsMain/kotlin/App.wasmJs.kt b/samples/ktor-all-platforms-app/composeApp/src/wasmJsMain/kotlin/App.wasmJs.kt new file mode 100644 index 00000000..cda9c076 --- /dev/null +++ b/samples/ktor-all-platforms-app/composeApp/src/wasmJsMain/kotlin/App.wasmJs.kt @@ -0,0 +1 @@ +actual val DEV_SERVER_HOST: String = "127.0.0.1" diff --git a/samples/ktor-all-platforms-app/composeApp/src/wasmJsMain/kotlin/main.kt b/samples/ktor-all-platforms-app/composeApp/src/wasmJsMain/kotlin/main.kt new file mode 100644 index 00000000..299151d4 --- /dev/null +++ b/samples/ktor-all-platforms-app/composeApp/src/wasmJsMain/kotlin/main.kt @@ -0,0 +1,11 @@ +import App +import androidx.compose.ui.ExperimentalComposeUiApi +import androidx.compose.ui.window.ComposeViewport +import kotlinx.browser.document + +@OptIn(ExperimentalComposeUiApi::class) +fun main() { + ComposeViewport(document.body!!) { + App() + } +} diff --git a/samples/ktor-all-platforms-app/composeApp/src/wasmJsMain/resources/index.html b/samples/ktor-all-platforms-app/composeApp/src/wasmJsMain/resources/index.html new file mode 100644 index 00000000..22ed4af0 --- /dev/null +++ b/samples/ktor-all-platforms-app/composeApp/src/wasmJsMain/resources/index.html @@ -0,0 +1,12 @@ + + + + + + ktor-all-platforms-app + + + + + + diff --git a/samples/ktor-all-platforms-app/composeApp/src/wasmJsMain/resources/styles.css b/samples/ktor-all-platforms-app/composeApp/src/wasmJsMain/resources/styles.css new file mode 100644 index 00000000..0549b10f --- /dev/null +++ b/samples/ktor-all-platforms-app/composeApp/src/wasmJsMain/resources/styles.css @@ -0,0 +1,7 @@ +html, body { + width: 100%; + height: 100%; + margin: 0; + padding: 0; + overflow: hidden; +} \ No newline at end of file diff --git a/samples/ktor-all-platforms-app/gradle/libs.versions.toml b/samples/ktor-all-platforms-app/gradle/libs.versions.toml index ccc34eeb..6af85b4b 100644 --- a/samples/ktor-all-platforms-app/gradle/libs.versions.toml +++ b/samples/ktor-all-platforms-app/gradle/libs.versions.toml @@ -15,14 +15,15 @@ androidx-test-junit = "1.2.1" compose = "1.7.2" compose-plugin = "1.6.11" junit = "4.13.2" -ktor = "2.3.12" +ktor = "3.0.0-rc-1" logback = "1.5.8" -kotlinx-serialization-json = "1.7.1" -kotlinx-coroutines-core = "1.9.0" -kotlinx-rpc = "0.2.4" +serialization = "1.7.1" +coroutines = "1.9.0" +kotlinx-rpc = "0.3.0" [libraries] # kotlin +kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" } kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" } kotlin-test-junit = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlin" } @@ -40,14 +41,13 @@ compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "compose" } # kotlinx -kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx-serialization-json" } -kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines-core" } -kotlinx-coroutines-core-jvm = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm", version.ref = "kotlinx-coroutines-core" } +kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "serialization" } +kotlinx-serialization-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "serialization" } +kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" } # ktor ktor-server-core = { module = "io.ktor:ktor-server-core-jvm", version.ref = "ktor" } ktor-server-netty = { module = "io.ktor:ktor-server-netty-jvm", version.ref = "ktor" } -ktor-server-tests = { module = "io.ktor:ktor-server-tests-jvm", version.ref = "ktor" } ktor-server-cors-jvm = { module = "io.ktor:ktor-server-cors-jvm", version.ref = "ktor" } ktor-server-websockets-jvm = { module = "io.ktor:ktor-server-websockets-jvm", version.ref = "ktor" } ktor-server-host-common-jvm = { module = "io.ktor:ktor-server-host-common-jvm", version.ref = "ktor" } @@ -55,6 +55,7 @@ ktor-server-test-host = { module = "io.ktor:ktor-server-test-host", version.ref ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" } ktor-client-websockets = { module = "io.ktor:ktor-client-websockets", version.ref = "ktor" } ktor-client-cio = { module = "io.ktor:ktor-client-cio", version.ref = "ktor" } +ktor-client-js = { module = "io.ktor:ktor-client-js", version.ref = "ktor" } # kotlinx-rpc kotlinx-rpc-core = { module = "org.jetbrains.kotlinx:kotlinx-rpc-core" } diff --git a/samples/ktor-all-platforms-app/server/build.gradle.kts b/samples/ktor-all-platforms-app/server/build.gradle.kts index 36da35ac..21cace24 100644 --- a/samples/ktor-all-platforms-app/server/build.gradle.kts +++ b/samples/ktor-all-platforms-app/server/build.gradle.kts @@ -18,7 +18,7 @@ application { dependencies { implementation(projects.shared) - implementation(libs.kotlinx.coroutines.core.jvm) + implementation(libs.kotlinx.coroutines.core) implementation(libs.logback) implementation(libs.ktor.server.core) implementation(libs.ktor.server.netty) @@ -28,7 +28,7 @@ dependencies { implementation(libs.kotlinx.rpc.krpc.server) implementation(libs.kotlinx.rpc.krpc.serialization.json) implementation(libs.kotlinx.rpc.krpc.ktor.server) - testImplementation(libs.ktor.server.tests) + testImplementation(libs.ktor.server.test.host) testImplementation(libs.kotlinx.rpc.krpc.client) testImplementation(libs.kotlinx.rpc.krpc.ktor.client) testImplementation(libs.kotlin.test.junit) diff --git a/samples/ktor-all-platforms-app/server/src/main/kotlin/kotlinx/rpc/sample/Application.kt b/samples/ktor-all-platforms-app/server/src/main/kotlin/kotlinx/rpc/sample/Application.kt index e79fca66..9fb57c62 100644 --- a/samples/ktor-all-platforms-app/server/src/main/kotlin/kotlinx/rpc/sample/Application.kt +++ b/samples/ktor-all-platforms-app/server/src/main/kotlin/kotlinx/rpc/sample/Application.kt @@ -10,9 +10,9 @@ import io.ktor.server.application.* import io.ktor.server.netty.* import io.ktor.server.plugins.cors.routing.* import io.ktor.server.routing.* -import kotlinx.rpc.serialization.json -import kotlinx.rpc.transport.ktor.server.RPC -import kotlinx.rpc.transport.ktor.server.rpc +import kotlinx.rpc.krpc.ktor.server.RPC +import kotlinx.rpc.krpc.ktor.server.rpc +import kotlinx.rpc.krpc.serialization.json.json fun main(args: Array): Unit = EngineMain.main(args) @@ -49,7 +49,7 @@ fun Application.installCORS() { allowSameOrigin = true // webpack-dev-server and local development - val allowedHosts = listOf("localhost:3000", "localhost:8080", "127.0.0.1:8080") + val allowedHosts = listOf("localhost:3000", "localhost:8080", "localhost:8081", "127.0.0.1:8080") allowedHosts.forEach { host -> allowHost(host, listOf("http", "https", "ws", "wss")) } diff --git a/samples/ktor-all-platforms-app/server/src/test/kotlin/kotlinx/rpc/sample/ApplicationTest.kt b/samples/ktor-all-platforms-app/server/src/test/kotlin/kotlinx/rpc/sample/ApplicationTest.kt index 23107bef..7755a855 100644 --- a/samples/ktor-all-platforms-app/server/src/test/kotlin/kotlinx/rpc/sample/ApplicationTest.kt +++ b/samples/ktor-all-platforms-app/server/src/test/kotlin/kotlinx/rpc/sample/ApplicationTest.kt @@ -8,12 +8,12 @@ import UserData import UserService import io.ktor.server.testing.* import kotlinx.coroutines.flow.toList +import kotlinx.rpc.krpc.ktor.client.installRPC +import kotlinx.rpc.krpc.ktor.client.rpc +import kotlinx.rpc.krpc.ktor.client.rpcConfig +import kotlinx.rpc.krpc.serialization.json.json +import kotlinx.rpc.krpc.streamScoped import kotlinx.rpc.withService -import kotlinx.rpc.serialization.json -import kotlinx.rpc.streamScoped -import kotlinx.rpc.transport.ktor.client.installRPC -import kotlinx.rpc.transport.ktor.client.rpc -import kotlinx.rpc.transport.ktor.client.rpcConfig import kotlin.test.Test import kotlin.test.assertEquals diff --git a/samples/ktor-all-platforms-app/shared/build.gradle.kts b/samples/ktor-all-platforms-app/shared/build.gradle.kts index cdb6d1fa..5d99db48 100644 --- a/samples/ktor-all-platforms-app/shared/build.gradle.kts +++ b/samples/ktor-all-platforms-app/shared/build.gradle.kts @@ -4,6 +4,8 @@ import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi import org.jetbrains.kotlin.gradle.dsl.JvmTarget +import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl +import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig plugins { alias(libs.plugins.kotlinMultiplatform) @@ -13,6 +15,21 @@ plugins { } kotlin { + @OptIn(ExperimentalWasmDsl::class) + wasmJs { + browser { + val projectDirPath = project.projectDir.path + commonWebpackConfig { + devServer = (devServer ?: KotlinWebpackConfig.DevServer()).apply { + static = (static ?: mutableListOf()).apply { + // Serve sources to debug inside browser + add(projectDirPath) + } + } + } + } + } + androidTarget { @OptIn(ExperimentalKotlinGradlePluginApi::class) compilerOptions { @@ -31,6 +48,7 @@ kotlin { api(libs.kotlinx.coroutines.core) implementation(libs.kotlinx.rpc.core) + implementation(libs.kotlinx.serialization.core) implementation(libs.kotlinx.serialization.json) } } diff --git a/samples/ktor-all-platforms-app/shared/src/wasmJsMain/kotlin/Platform.wasmJs.kt b/samples/ktor-all-platforms-app/shared/src/wasmJsMain/kotlin/Platform.wasmJs.kt index 57b2e112..83cadf02 100644 --- a/samples/ktor-all-platforms-app/shared/src/wasmJsMain/kotlin/Platform.wasmJs.kt +++ b/samples/ktor-all-platforms-app/shared/src/wasmJsMain/kotlin/Platform.wasmJs.kt @@ -2,4 +2,4 @@ class WasmPlatform: Platform { override val name: String = "Web with Kotlin/Wasm" } -actual fun getPlatform(): Platform = WasmPlatform() \ No newline at end of file +actual fun getPlatform(): Platform = WasmPlatform() diff --git a/samples/ktor-android-app/app/src/main/kotlin/kotlinx/rpc/sample/data/Client.kt b/samples/ktor-android-app/app/src/main/kotlin/kotlinx/rpc/sample/data/Client.kt index 21ca0670..e6aeded9 100644 --- a/samples/ktor-android-app/app/src/main/kotlin/kotlinx/rpc/sample/data/Client.kt +++ b/samples/ktor-android-app/app/src/main/kotlin/kotlinx/rpc/sample/data/Client.kt @@ -6,13 +6,12 @@ package kotlinx.rpc.sample.data import io.ktor.client.HttpClient import io.ktor.client.engine.okhttp.OkHttp -import io.ktor.client.plugins.websocket.WebSockets import io.ktor.client.request.url import kotlinx.rpc.RPCClient -import kotlinx.rpc.serialization.json -import kotlinx.rpc.transport.ktor.client.rpc -import kotlinx.rpc.transport.ktor.client.rpcConfig -import kotlinx.rpc.transport.ktor.client.installRPC +import kotlinx.rpc.krpc.ktor.client.installRPC +import kotlinx.rpc.krpc.ktor.client.rpc +import kotlinx.rpc.krpc.ktor.client.rpcConfig +import kotlinx.rpc.krpc.serialization.json.json suspend fun createRpcClient(): RPCClient { return HttpClient(OkHttp) { diff --git a/samples/ktor-android-app/app/src/main/kotlin/kotlinx/rpc/sample/ui/AppViewModel.kt b/samples/ktor-android-app/app/src/main/kotlin/kotlinx/rpc/sample/ui/AppViewModel.kt index fe4de267..9eb7679d 100644 --- a/samples/ktor-android-app/app/src/main/kotlin/kotlinx/rpc/sample/ui/AppViewModel.kt +++ b/samples/ktor-android-app/app/src/main/kotlin/kotlinx/rpc/sample/ui/AppViewModel.kt @@ -15,7 +15,7 @@ import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.launch import kotlinx.rpc.RPCClient -import kotlinx.rpc.streamScoped +import kotlinx.rpc.krpc.streamScoped import kotlinx.rpc.withService import kotlinx.rpc.sample.MyService import kotlinx.rpc.sample.UserData diff --git a/samples/ktor-android-app/gradle/libs.versions.toml b/samples/ktor-android-app/gradle/libs.versions.toml index 44f67428..8a7e009a 100644 --- a/samples/ktor-android-app/gradle/libs.versions.toml +++ b/samples/ktor-android-app/gradle/libs.versions.toml @@ -15,7 +15,7 @@ ktor = "2.3.12" kotlinx-serialization-json = "1.7.3" kotlinx-coroutines-core = "1.9.0" logback = "1.5.8" -kotlinx-rpc = "0.2.4" +kotlinx-rpc = "0.3.0" [libraries] # kotlin diff --git a/samples/ktor-android-app/server/src/main/kotlin/kotlinx/rpc/sample/Application.kt b/samples/ktor-android-app/server/src/main/kotlin/kotlinx/rpc/sample/Application.kt index 33573b7c..d7a9370a 100644 --- a/samples/ktor-android-app/server/src/main/kotlin/kotlinx/rpc/sample/Application.kt +++ b/samples/ktor-android-app/server/src/main/kotlin/kotlinx/rpc/sample/Application.kt @@ -7,8 +7,8 @@ import io.ktor.server.application.* import io.ktor.server.cio.* import io.ktor.server.routing.* import io.ktor.server.websocket.* -import kotlinx.rpc.serialization.json -import kotlinx.rpc.transport.ktor.server.rpc +import kotlinx.rpc.krpc.ktor.server.rpc +import kotlinx.rpc.krpc.serialization.json.json fun main(args: Array): Unit = EngineMain.main(args) diff --git a/samples/ktor-android-app/server/src/test/kotlin/ApplicationTest.kt b/samples/ktor-android-app/server/src/test/kotlin/ApplicationTest.kt index aa0f4108..1c76842c 100644 --- a/samples/ktor-android-app/server/src/test/kotlin/ApplicationTest.kt +++ b/samples/ktor-android-app/server/src/test/kotlin/ApplicationTest.kt @@ -5,19 +5,18 @@ import io.ktor.client.request.* import io.ktor.client.statement.* import io.ktor.http.* -import io.ktor.server.application.* import io.ktor.server.response.* import io.ktor.server.routing.* import io.ktor.server.testing.* import kotlinx.coroutines.flow.toList +import kotlinx.rpc.krpc.ktor.client.installRPC +import kotlinx.rpc.krpc.ktor.client.rpc +import kotlinx.rpc.krpc.ktor.client.rpcConfig +import kotlinx.rpc.krpc.serialization.json.json +import kotlinx.rpc.krpc.streamScoped import kotlinx.rpc.withService import kotlinx.rpc.sample.MyService import kotlinx.rpc.sample.UserData -import kotlinx.rpc.serialization.json -import kotlinx.rpc.streamScoped -import kotlinx.rpc.transport.ktor.client.installRPC -import kotlinx.rpc.transport.ktor.client.rpc -import kotlinx.rpc.transport.ktor.client.rpcConfig import kotlin.test.Test import kotlin.test.assertEquals diff --git a/samples/ktor-web-app/frontend/build.gradle.kts b/samples/ktor-web-app/frontend/build.gradle.kts index 09d1ef5f..eb2d3281 100644 --- a/samples/ktor-web-app/frontend/build.gradle.kts +++ b/samples/ktor-web-app/frontend/build.gradle.kts @@ -17,14 +17,6 @@ kotlin { cssSupport { enabled.set(true) } - - val proxies = devServer?.proxy ?: mutableMapOf() - proxies["/api"] = "http://localhost:8080" - - devServer = devServer?.copy( - port = 3000, - proxy = proxies - ) } } } diff --git a/samples/ktor-web-app/frontend/src/jsMain/kotlin/RPC.kt b/samples/ktor-web-app/frontend/src/jsMain/kotlin/RPC.kt index af3a655c..3205500f 100644 --- a/samples/ktor-web-app/frontend/src/jsMain/kotlin/RPC.kt +++ b/samples/ktor-web-app/frontend/src/jsMain/kotlin/RPC.kt @@ -6,10 +6,10 @@ import io.ktor.client.* import io.ktor.client.engine.js.* import io.ktor.client.request.* import kotlinx.rpc.RPCClient -import kotlinx.rpc.serialization.json -import kotlinx.rpc.transport.ktor.client.installRPC -import kotlinx.rpc.transport.ktor.client.rpc -import kotlinx.rpc.transport.ktor.client.rpcConfig +import kotlinx.rpc.krpc.ktor.client.installRPC +import kotlinx.rpc.krpc.ktor.client.rpc +import kotlinx.rpc.krpc.ktor.client.rpcConfig +import kotlinx.rpc.krpc.serialization.json.json suspend fun initRpcClient(): RPCClient { return HttpClient(Js) { diff --git a/samples/ktor-web-app/frontend/src/jsMain/kotlin/Welcome.kt b/samples/ktor-web-app/frontend/src/jsMain/kotlin/Welcome.kt index 80f059d1..d16c59e7 100644 --- a/samples/ktor-web-app/frontend/src/jsMain/kotlin/Welcome.kt +++ b/samples/ktor-web-app/frontend/src/jsMain/kotlin/Welcome.kt @@ -3,8 +3,7 @@ */ import emotion.react.css -import kotlinx.coroutines.flow.Flow -import kotlinx.rpc.streamScoped +import kotlinx.rpc.krpc.streamScoped import react.FC import react.Props import react.dom.html.ReactHTML.div diff --git a/samples/ktor-web-app/gradle/libs.versions.toml b/samples/ktor-web-app/gradle/libs.versions.toml index 1769e99f..f9a9a7d2 100644 --- a/samples/ktor-web-app/gradle/libs.versions.toml +++ b/samples/ktor-web-app/gradle/libs.versions.toml @@ -5,7 +5,7 @@ ktor = "2.3.12" kotlinx-serialization-json = "1.7.3" kotlinx-coroutines-core = "1.9.0" logback = "1.5.8" -kotlinx-rpc = "0.2.4" +kotlinx-rpc = "0.3.0" [libraries] # kotlin diff --git a/samples/ktor-web-app/server/src/main/kotlin/Application.kt b/samples/ktor-web-app/server/src/main/kotlin/Application.kt index 536730da..7b859168 100644 --- a/samples/ktor-web-app/server/src/main/kotlin/Application.kt +++ b/samples/ktor-web-app/server/src/main/kotlin/Application.kt @@ -8,9 +8,9 @@ import io.ktor.server.cio.* import io.ktor.server.http.content.* import io.ktor.server.plugins.cors.routing.* import io.ktor.server.routing.* -import kotlinx.rpc.serialization.json -import kotlinx.rpc.transport.ktor.server.RPC -import kotlinx.rpc.transport.ktor.server.rpc +import kotlinx.rpc.krpc.ktor.server.RPC +import kotlinx.rpc.krpc.ktor.server.rpc +import kotlinx.rpc.krpc.serialization.json.json fun main(args: Array): Unit = EngineMain.main(args) diff --git a/samples/ktor-web-app/server/src/test/kotlin/ApplicationTest.kt b/samples/ktor-web-app/server/src/test/kotlin/ApplicationTest.kt index 3b54ea23..a5241cac 100644 --- a/samples/ktor-web-app/server/src/test/kotlin/ApplicationTest.kt +++ b/samples/ktor-web-app/server/src/test/kotlin/ApplicationTest.kt @@ -4,12 +4,12 @@ import io.ktor.server.testing.* import kotlinx.coroutines.flow.toList +import kotlinx.rpc.krpc.ktor.client.installRPC +import kotlinx.rpc.krpc.ktor.client.rpc +import kotlinx.rpc.krpc.ktor.client.rpcConfig +import kotlinx.rpc.krpc.serialization.json.json +import kotlinx.rpc.krpc.streamScoped import kotlinx.rpc.withService -import kotlinx.rpc.serialization.json -import kotlinx.rpc.streamScoped -import kotlinx.rpc.transport.ktor.client.installRPC -import kotlinx.rpc.transport.ktor.client.rpc -import kotlinx.rpc.transport.ktor.client.rpcConfig import kotlin.test.Test import kotlin.test.assertEquals diff --git a/samples/simple-ktor-app/build.gradle.kts b/samples/simple-ktor-app/build.gradle.kts index 8cf62cdf..cac2bbca 100644 --- a/samples/simple-ktor-app/build.gradle.kts +++ b/samples/simple-ktor-app/build.gradle.kts @@ -6,7 +6,7 @@ plugins { kotlin("jvm") version "2.0.10" kotlin("plugin.serialization") version "2.0.10" id("io.ktor.plugin") version "2.3.12" - id("org.jetbrains.kotlinx.rpc.plugin") version "0.2.4" + id("org.jetbrains.kotlinx.rpc.plugin") version "0.3.0" } group = "kotlinx.rpc.sample" diff --git a/samples/simple-ktor-app/src/main/kotlin/Client.kt b/samples/simple-ktor-app/src/main/kotlin/Client.kt index d8f3d0da..28484785 100644 --- a/samples/simple-ktor-app/src/main/kotlin/Client.kt +++ b/samples/simple-ktor-app/src/main/kotlin/Client.kt @@ -9,11 +9,11 @@ import kotlinx.coroutines.cancel import kotlinx.coroutines.flow.flow import kotlinx.coroutines.launch import kotlinx.coroutines.runBlocking +import kotlinx.rpc.krpc.ktor.client.rpc +import kotlinx.rpc.krpc.ktor.client.rpcConfig +import kotlinx.rpc.krpc.serialization.json.json +import kotlinx.rpc.krpc.streamScoped import kotlinx.rpc.withService -import kotlinx.rpc.serialization.json -import kotlinx.rpc.streamScoped -import kotlinx.rpc.transport.ktor.client.rpc -import kotlinx.rpc.transport.ktor.client.rpcConfig fun main() = runBlocking { val ktorClient = HttpClient { diff --git a/samples/simple-ktor-app/src/main/kotlin/Server.kt b/samples/simple-ktor-app/src/main/kotlin/Server.kt index c6c6adcd..c5fa1ae9 100644 --- a/samples/simple-ktor-app/src/main/kotlin/Server.kt +++ b/samples/simple-ktor-app/src/main/kotlin/Server.kt @@ -6,9 +6,9 @@ import io.ktor.server.application.* import io.ktor.server.engine.* import io.ktor.server.netty.* import io.ktor.server.routing.* -import kotlinx.rpc.serialization.json -import kotlinx.rpc.transport.ktor.server.RPC -import kotlinx.rpc.transport.ktor.server.rpc +import kotlinx.rpc.krpc.ktor.server.RPC +import kotlinx.rpc.krpc.ktor.server.rpc +import kotlinx.rpc.krpc.serialization.json.json fun main() { embeddedServer(Netty, port = 8080) { diff --git a/samples/simple-ktor-app/src/test/kotlin/ApplicationTest.kt b/samples/simple-ktor-app/src/test/kotlin/ApplicationTest.kt index f8117039..2b754f0a 100644 --- a/samples/simple-ktor-app/src/test/kotlin/ApplicationTest.kt +++ b/samples/simple-ktor-app/src/test/kotlin/ApplicationTest.kt @@ -7,12 +7,12 @@ import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.cancel import kotlinx.coroutines.launch -import kotlinx.rpc.client.awaitFieldInitialization +import kotlinx.rpc.awaitFieldInitialization +import kotlinx.rpc.krpc.ktor.client.installRPC +import kotlinx.rpc.krpc.ktor.client.rpc +import kotlinx.rpc.krpc.ktor.client.rpcConfig +import kotlinx.rpc.krpc.serialization.json.json import kotlinx.rpc.withService -import kotlinx.rpc.serialization.json -import kotlinx.rpc.transport.ktor.client.installRPC -import kotlinx.rpc.transport.ktor.client.rpc -import kotlinx.rpc.transport.ktor.client.rpcConfig import org.junit.Test import kotlin.test.assertContentEquals import kotlin.test.assertEquals From ee50949a5f5c3e6999d82412a5107aead01ebf07 Mon Sep 17 00:00:00 2001 From: Alexander Sysoev Date: Thu, 26 Sep 2024 12:54:07 +0200 Subject: [PATCH 3/7] Update CHANGELOG.md --- CHANGELOG.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a32aad9..35da2b30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,45 @@ +# 0.3.0 +> Published 27 September 2024 + +### Features ๐ŸŽ‰ +* Wasm Support by @Mr3zee in https://github.com/Kotlin/kotlinx-rpc/pull/190 + +### Breaking Changes ๐Ÿ”ด +* Move kRPC declarations from core by @Mr3zee in https://github.com/Kotlin/kotlinx-rpc/pull/186 + +### Bug fixes ๐Ÿ› +* Fix kotlin/js code and samples by @Mr3zee in https://github.com/Kotlin/kotlinx-rpc/pull/179 +* Fix regression of nested declarations in RPC interfaces by @Mr3zee in https://github.com/Kotlin/kotlinx-rpc/pull/181 + +### Documentation ๐Ÿ“— +* Wording fixes by @Mr3zee in https://github.com/Kotlin/kotlinx-rpc/pull/175 + +### Infra ๐Ÿšง +* Infra enhancements by @Mr3zee in https://github.com/Kotlin/kotlinx-rpc/pull/206 +* Fixed Wasm Publication by @Mr3zee in https://github.com/Kotlin/kotlinx-rpc/pull/208 +* Update renovate configs by @Mr3zee in https://github.com/Kotlin/kotlinx-rpc/pull/185 +* Configure JPMS checks by @Mr3zee in https://github.com/Kotlin/kotlinx-rpc/pull/187 +* Update some ide configs by @Mr3zee in https://github.com/Kotlin/kotlinx-rpc/pull/188 +* Added Gradle Doctor to the build by @Mr3zee in https://github.com/Kotlin/kotlinx-rpc/pull/189 +* Added build cache and develocity plugin by @Mr3zee in https://github.com/Kotlin/kotlinx-rpc/pull/192 +* Support variable Kotlin and project versions by @Mr3zee in https://github.com/Kotlin/kotlinx-rpc/pull/201 +* Update renovate and some deps by @Mr3zee in https://github.com/Kotlin/kotlinx-rpc/pull/198 + +### Other Changes ๐Ÿงน +* Bump version to 0.3.0-SNAPSHOT by @Mr3zee in https://github.com/Kotlin/kotlinx-rpc/pull/174 +* Fix compiler tests after #172 by @Mr3zee in https://github.com/Kotlin/kotlinx-rpc/pull/180 +* Remove unused and inactive annotation by @kez-lab in https://github.com/Kotlin/kotlinx-rpc/pull/182 +* Use built-in JsClass getter by @Mr3zee in https://github.com/Kotlin/kotlinx-rpc/pull/184 +* Update actions/configure-pages action to v5 by @renovate in https://github.com/Kotlin/kotlinx-rpc/pull/200 +* Update Samples dependencies by @renovate in https://github.com/Kotlin/kotlinx-rpc/pull/199 +* Update Core dependencies (non-major) by @renovate in https://github.com/Kotlin/kotlinx-rpc/pull/194 +* Update Core dependencies (non-major) by @renovate in https://github.com/Kotlin/kotlinx-rpc/pull/205 + +## New Contributors +* @kez-lab made their first contribution in https://github.com/Kotlin/kotlinx-rpc/pull/182 + +**Full Changelog**: https://github.com/Kotlin/kotlinx-rpc/compare/0.2.4...0.3.0 + # 0.2.4 > Published 20 August 2024 From 57f2f96888e700c50e39e093a824cbbc577808a5 Mon Sep 17 00:00:00 2001 From: Alexander Sysoev Date: Thu, 26 Sep 2024 14:02:37 +0200 Subject: [PATCH 4/7] Fix builds for older Kotlin and kover --- ...conventions-develocity.settings.gradle.kts | 6 ++-- .../empty/build.gradle.kts | 36 +++++++++++++++++++ .../kotlin/empty-settings.settings.gradle.kts | 5 +++ .../settings.gradle.kts | 8 ++++- .../main/kotlin/conventions-kover.gradle.kts | 2 +- tests/compiler-plugin-tests/build.gradle.kts | 2 +- 6 files changed, 53 insertions(+), 6 deletions(-) create mode 100644 gradle-conventions-settings/empty/build.gradle.kts create mode 100644 gradle-conventions-settings/empty/src/main/kotlin/empty-settings.settings.gradle.kts diff --git a/gradle-conventions-settings/develocity/src/main/kotlin/conventions-develocity.settings.gradle.kts b/gradle-conventions-settings/develocity/src/main/kotlin/conventions-develocity.settings.gradle.kts index 6e68c49a..89f7bd27 100644 --- a/gradle-conventions-settings/develocity/src/main/kotlin/conventions-develocity.settings.gradle.kts +++ b/gradle-conventions-settings/develocity/src/main/kotlin/conventions-develocity.settings.gradle.kts @@ -13,10 +13,10 @@ develocity { val startParameter = gradle.startParameter val scanJournal = File(settingsDir, "scan-journal.log") - server = DEVELOCITY_SERVER + server.set(DEVELOCITY_SERVER) buildScan { - uploadInBackground = !isCIRun + uploadInBackground.set(!isCIRun) // obfuscate NIC since we don't want to expose user real IP (will be relevant without VPN) obfuscation { @@ -24,7 +24,7 @@ develocity { } capture { - fileFingerprints = true + fileFingerprints.set(true) } buildScanPublished { diff --git a/gradle-conventions-settings/empty/build.gradle.kts b/gradle-conventions-settings/empty/build.gradle.kts new file mode 100644 index 00000000..531de275 --- /dev/null +++ b/gradle-conventions-settings/empty/build.gradle.kts @@ -0,0 +1,36 @@ +/* + * Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + +import java.io.File +import java.nio.file.Files +import java.nio.file.Path + +plugins { + alias(libs.plugins.gradle.kotlin.dsl) +} + +fun Path.name() = fileName?.toString().orEmpty() + +fun filterDirectory(sourceSetPath: Path, filter: (Path) -> Boolean): List { + return Files.newDirectoryStream(sourceSetPath).use { it.toList() }.filter(filter).map { it.toFile() } +} + +val pluginsSource: Path = layout.projectDirectory.dir("../develocity/src/main/kotlin").asFile.toPath() + +val plugins = filterDirectory(pluginsSource) { + Files.isRegularFile(it) && it.name().endsWith(".settings.gradle.kts") +}.map { it.name.substringBefore('.') } + +plugins.forEach { name -> + gradlePlugin { + plugins { + create(name) { + id = name + implementationClass = "EmptySettingsPlugin" + } + } + + logger.info("Applied $name precompiled plugin as stub") + } +} diff --git a/gradle-conventions-settings/empty/src/main/kotlin/empty-settings.settings.gradle.kts b/gradle-conventions-settings/empty/src/main/kotlin/empty-settings.settings.gradle.kts new file mode 100644 index 00000000..01aede8e --- /dev/null +++ b/gradle-conventions-settings/empty/src/main/kotlin/empty-settings.settings.gradle.kts @@ -0,0 +1,5 @@ +/* + * Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + +// Do not delete this. It is used as a stub plugin for latest-only plugins diff --git a/gradle-conventions-settings/settings.gradle.kts b/gradle-conventions-settings/settings.gradle.kts index 75c3e314..bf3d8289 100644 --- a/gradle-conventions-settings/settings.gradle.kts +++ b/gradle-conventions-settings/settings.gradle.kts @@ -7,4 +7,10 @@ rootProject.name = "gradle-conventions-settings" // Code below is a hack because a chicken-egg problem, I can't use myself as a settings-plugin apply(from = "src/main/kotlin/settings-conventions.settings.gradle.kts") -include(":develocity") +val kotlinVersion: KotlinVersion by extra + +if (kotlinVersion.isAtLeast(1, 9, 0)) { + include(":develocity") +} else { + include(":empty") +} diff --git a/gradle-conventions/latest-only/src/main/kotlin/conventions-kover.gradle.kts b/gradle-conventions/latest-only/src/main/kotlin/conventions-kover.gradle.kts index a494c18b..8606ede0 100644 --- a/gradle-conventions/latest-only/src/main/kotlin/conventions-kover.gradle.kts +++ b/gradle-conventions/latest-only/src/main/kotlin/conventions-kover.gradle.kts @@ -14,7 +14,7 @@ the().apply { total { html { onCheck.set(false) - charset.set("UTF_8") + charset.set("UTF-8") htmlDir.set(rootDir.resolve("kover")) } diff --git a/tests/compiler-plugin-tests/build.gradle.kts b/tests/compiler-plugin-tests/build.gradle.kts index 424d3690..81042728 100644 --- a/tests/compiler-plugin-tests/build.gradle.kts +++ b/tests/compiler-plugin-tests/build.gradle.kts @@ -161,6 +161,6 @@ fun Test.setJarPathAsProperty( } fun Test.systemPropertyLogged(name: String, value: Any) { - logger.lifecycle("Setting test prop $name=$value") + logger.info("Setting test prop $name=$value") systemProperty(name, value) } From 803238fe7ebb656c039ad4770ba9a9213a79348d Mon Sep 17 00:00:00 2001 From: Alexander Sysoev Date: Tue, 1 Oct 2024 11:51:50 +0200 Subject: [PATCH 5/7] Migration guide for 0.3.0 (#212) --- docs/pages/kotlinx-rpc/rpc.tree | 1 + docs/pages/kotlinx-rpc/topics/0-2-4.topic | 2 +- docs/pages/kotlinx-rpc/topics/0-3-0.topic | 254 ++++++++++++++++++++++ 3 files changed, 256 insertions(+), 1 deletion(-) create mode 100644 docs/pages/kotlinx-rpc/topics/0-3-0.topic diff --git a/docs/pages/kotlinx-rpc/rpc.tree b/docs/pages/kotlinx-rpc/rpc.tree index 034df82a..23ab1e14 100644 --- a/docs/pages/kotlinx-rpc/rpc.tree +++ b/docs/pages/kotlinx-rpc/rpc.tree @@ -26,6 +26,7 @@ + diff --git a/docs/pages/kotlinx-rpc/topics/0-2-4.topic b/docs/pages/kotlinx-rpc/topics/0-2-4.topic index 5200e14a..ade09457 100644 --- a/docs/pages/kotlinx-rpc/topics/0-2-4.topic +++ b/docs/pages/kotlinx-rpc/topics/0-2-4.topic @@ -10,7 +10,7 @@ title="Migration to 0.2.4" id="0-2-4">

- Version 0.2.4 does introduce any breaking changes. + Version 0.2.4 does not introduce any breaking changes. However, it includes some updates that may require additional modifications in user projects.

diff --git a/docs/pages/kotlinx-rpc/topics/0-3-0.topic b/docs/pages/kotlinx-rpc/topics/0-3-0.topic new file mode 100644 index 00000000..9b148744 --- /dev/null +++ b/docs/pages/kotlinx-rpc/topics/0-3-0.topic @@ -0,0 +1,254 @@ + + + + + + +

+ Version 0.3.0 introduces breaking changes. +

+ + This release resolves the issue of kRPC declarations being incorrectly included in non-kRPC artifacts. + All package names have been reviewed and updated to match artifact names and ensure uniqueness across the project. + All APIs were moved permanently without a deprecation cycle due to the size of the change. + The table below contains the full list of the changes. +

Removed declarations

+ + + + + + + + + + + + + + + + + +
0.2.40.3.0
kotlinx.rpc.client.withServiceRemoved (was deprecated in 0.2.4)
kotlinx.rpc.client.awaitFieldInitializationRemoved (was deprecated in 0.2.4)
kotlinx.rpc.client.UninitializedRPCFieldExceptionRemoved (was deprecated in 0.2.4)
+

Declarations that changed the artifact location and package

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
0.2.40.3.0
+ kotlinx.rpc.RPCConfig +

Artifact: kotlinx-rpc-core

+
+ kotlinx.rpc.krpc.RPCConfig +

Artifact: kotlinx-rpc-krpc-core

+
+ kotlinx.rpc.RPCConfigBuilder +

Artifact: kotlinx-rpc-core

+
+ kotlinx.rpc.krpc.RPCConfigBuilder +

Artifact: kotlinx-rpc-krpc-core

+
+ kotlinx.rpc.rpcClientConfig +

Artifact: kotlinx-rpc-core

+
+ kotlinx.rpc.krpc.rpcClientConfig +

Artifact: kotlinx-rpc-krpc-core

+
+ kotlinx.rpc.rpcServerConfig +

Artifact: kotlinx-rpc-core

+
+ kotlinx.rpc.krpc.rpcServerConfig +

Artifact: kotlinx-rpc-krpc-core

+
+ kotlinx.rpc.RPCTransport +

Artifact: kotlinx-rpc-core

+
+ kotlinx.rpc.krpc.RPCTransport +

Artifact: kotlinx-rpc-krpc-core

+
+ kotlinx.rpc.RPCTransportMessage +

Artifact: kotlinx-rpc-core

+
+ kotlinx.rpc.krpc.RPCTransportMessage +

Artifact: kotlinx-rpc-krpc-core

+
+ kotlinx.rpc.invokeOnStreamScopeCompletion +

Artifact: kotlinx-rpc-core

+
+ kotlinx.rpc.krpc.invokeOnStreamScopeCompletion +

Artifact: kotlinx-rpc-krpc-core

+
+ kotlinx.rpc.streamScoped +

Artifact: kotlinx-rpc-core

+
+ kotlinx.rpc.krpc.streamScoped +

Artifact: kotlinx-rpc-krpc-core

+
+

Declarations that only changed the package

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
0.2.40.3.0
+ kotlinx.rpc.client.KRPCClient + + kotlinx.rpc.krpc.client.KRPCClient +
+ kotlinx.rpc.client.withService + + kotlinx.rpc.krpc.client.withService +
+ kotlinx.rpc.transport.ktor.client.rpc + + kotlinx.rpc.krpc.ktor.client.rpc +
+ kotlinx.rpc.transport.ktor.client.KtorRPCClient + + kotlinx.rpc.krpc.ktor.client.KtorRPCClient +
+ kotlinx.rpc.transport.ktor.client.RPC + + kotlinx.rpc.krpc.ktor.client.RPC +
+ kotlinx.rpc.transport.ktor.server.RPC + + kotlinx.rpc.krpc.ktor.server.RPC +
+ kotlinx.rpc.transport.ktor.server.rpc + + kotlinx.rpc.krpc.ktor.server.rpc +
+ kotlinx.rpc.transport.ktor.server.RPCRoute + + kotlinx.rpc.krpc.ktor.server.RPCRoute +
+ kotlinx.rpc.serialization.cbor + + kotlinx.rpc.krpc.serialization.cbor.cbor +
+ kotlinx.rpc.serialization.json + + kotlinx.rpc.krpc.serialization.json.json +
+ kotlinx.rpc.serialization.protobuf + + kotlinx.rpc.krpc.serialization.protobuf.protobuf +
+ kotlinx.rpc.serialization.RPCSerialFormat + + kotlinx.rpc.krpc.serialization.RPCSerialFormat +
+ kotlinx.rpc.serialization.RPCSerialFormatBuilder + + kotlinx.rpc.krpc.serialization.RPCSerialFormatBuilder +
+ kotlinx.rpc.serialization.RPCSerialFormatConfiguration + + kotlinx.rpc.krpc.serialization.RPCSerialFormatConfiguration +
+ kotlinx.rpc.server.KRPCServer + + kotlinx.rpc.krpc.server.KRPCServer +
+
+
From 889ea85fd3620b08dede9c4e8c7d4d6c31dff44d Mon Sep 17 00:00:00 2001 From: Alexander Sysoev Date: Tue, 1 Oct 2024 11:55:54 +0200 Subject: [PATCH 6/7] Updated release date --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 35da2b30..5183a65a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ # 0.3.0 -> Published 27 September 2024 +> Published 1 October 2024 ### Features ๐ŸŽ‰ * Wasm Support by @Mr3zee in https://github.com/Kotlin/kotlinx-rpc/pull/190 From e78c240dc129b40e10d2135841717aedbe1e78d8 Mon Sep 17 00:00:00 2001 From: Alexander Sysoev Date: Tue, 1 Oct 2024 19:50:15 +0200 Subject: [PATCH 7/7] Update tests --- samples/ktor-android-app/gradle/libs.versions.toml | 2 +- samples/ktor-web-app/README.md | 3 +++ samples/ktor-web-app/gradle/libs.versions.toml | 2 +- .../ktor-web-app/server/src/test/kotlin/ApplicationTest.kt | 4 ++++ samples/simple-ktor-app/build.gradle.kts | 6 +++--- 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/samples/ktor-android-app/gradle/libs.versions.toml b/samples/ktor-android-app/gradle/libs.versions.toml index 8a7e009a..b5caa493 100644 --- a/samples/ktor-android-app/gradle/libs.versions.toml +++ b/samples/ktor-android-app/gradle/libs.versions.toml @@ -11,7 +11,7 @@ compose-plugin = "1.5.14" # https://mvnrepository.com/artifact/androidx.compose. compose-bom = "2024.09.02" material3 = "1.3.0" junit = "4.13.2" -ktor = "2.3.12" +ktor = "3.0.0-rc-1" kotlinx-serialization-json = "1.7.3" kotlinx-coroutines-core = "1.9.0" logback = "1.5.8" diff --git a/samples/ktor-web-app/README.md b/samples/ktor-web-app/README.md index e19bf290..fe9243f8 100644 --- a/samples/ktor-web-app/README.md +++ b/samples/ktor-web-app/README.md @@ -1,6 +1,9 @@ # Ktor Web App Sample application with Kotlin/Js on frontend and Kotlin/Jvm on backend,that uses kRPC with Ktor to communicate. +> Warning: the code is broken due to https://youtrack.jetbrains.com/issue/KT-71757/ +> No workarounds for now + ### Running frontend To run frontend in development mode, run this command: ```bash diff --git a/samples/ktor-web-app/gradle/libs.versions.toml b/samples/ktor-web-app/gradle/libs.versions.toml index f9a9a7d2..cde10b6b 100644 --- a/samples/ktor-web-app/gradle/libs.versions.toml +++ b/samples/ktor-web-app/gradle/libs.versions.toml @@ -1,7 +1,7 @@ [versions] kotlin = "2.0.10" kotlin-wrappers-bom = "1.0.0-pre.812" -ktor = "2.3.12" +ktor = "3.0.0-rc-1" kotlinx-serialization-json = "1.7.3" kotlinx-coroutines-core = "1.9.0" logback = "1.5.8" diff --git a/samples/ktor-web-app/server/src/test/kotlin/ApplicationTest.kt b/samples/ktor-web-app/server/src/test/kotlin/ApplicationTest.kt index a5241cac..a11982f4 100644 --- a/samples/ktor-web-app/server/src/test/kotlin/ApplicationTest.kt +++ b/samples/ktor-web-app/server/src/test/kotlin/ApplicationTest.kt @@ -16,6 +16,10 @@ import kotlin.test.assertEquals class ApplicationTest { @Test fun testRoot() = testApplication { + application { + module() + } + val service = createClient { installRPC() }.rpc("/api") { diff --git a/samples/simple-ktor-app/build.gradle.kts b/samples/simple-ktor-app/build.gradle.kts index cac2bbca..23e6e80b 100644 --- a/samples/simple-ktor-app/build.gradle.kts +++ b/samples/simple-ktor-app/build.gradle.kts @@ -5,7 +5,7 @@ plugins { kotlin("jvm") version "2.0.10" kotlin("plugin.serialization") version "2.0.10" - id("io.ktor.plugin") version "2.3.12" + id("io.ktor.plugin") version "3.0.0-rc-1" id("org.jetbrains.kotlinx.rpc.plugin") version "0.3.0" } @@ -35,10 +35,10 @@ dependencies { implementation("org.jetbrains.kotlinx:kotlinx-rpc-krpc-ktor-client") implementation("org.jetbrains.kotlinx:kotlinx-rpc-krpc-ktor-server") - implementation("io.ktor:ktor-client-cio-jvm") + implementation("io.ktor:ktor-client-cio") implementation("io.ktor:ktor-server-netty-jvm") implementation("ch.qos.logback:logback-classic:1.5.8") - testImplementation("io.ktor:ktor-server-tests-jvm") + testImplementation("io.ktor:ktor-server-test-host") testImplementation("org.jetbrains.kotlin:kotlin-test-junit:2.0.10") }