Skip to content

Commit

Permalink
Samples update (#224)
Browse files Browse the repository at this point in the history
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
  • Loading branch information
Mr3zee and renovate[bot] committed Nov 5, 2024
1 parent ba916cf commit fca1259
Show file tree
Hide file tree
Showing 16 changed files with 75 additions and 89 deletions.
12 changes: 0 additions & 12 deletions samples/ktor-all-platforms-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,5 @@ plugins {
alias(libs.plugins.kotlinMultiplatform) apply false
alias(libs.plugins.kotlinPluginSerialization) apply false
alias(libs.plugins.kotlinx.rpc) apply false
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)
}
}
}
1 change: 0 additions & 1 deletion samples/ktor-all-platforms-app/composeApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ plugins {
alias(libs.plugins.androidApplication)
alias(libs.plugins.jetbrainsCompose)
alias(libs.plugins.compose.compiler)
alias(libs.plugins.kotlinx.rpc.platform)
}

kotlin {
Expand Down
39 changes: 19 additions & 20 deletions samples/ktor-all-platforms-app/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
[versions]
kotlin = "2.0.10"
kotlin = "2.0.21"

agp = "8.6.1"
android-compileSdk = "34"
agp = "8.7.2"
android-compileSdk = "35"
android-minSdk = "24"
android-targetSdk = "34"
androidx-activityCompose = "1.9.2"
android-targetSdk = "35"
androidx-activityCompose = "1.9.3"
androidx-appcompat = "1.7.0"
androidx-constraintlayout = "2.1.4"
androidx-core-ktx = "1.13.1"
androidx-constraintlayout = "2.2.0"
androidx-core-ktx = "1.15.0"
androidx-espresso-core = "3.6.1"
androidx-material = "1.12.0"
androidx-test-junit = "1.2.1"
compose = "1.7.2"
compose-plugin = "1.6.11"
compose = "1.7.5"
compose-plugin = "1.7.0"
junit = "4.13.2"
ktor = "3.0.0-rc-1"
logback = "1.5.8"
serialization = "1.7.1"
ktor = "3.0.1"
logback = "1.5.12"
serialization = "1.7.3"
coroutines = "1.9.0"
kotlinx-rpc = "0.3.0"
kotlinx-rpc = "0.4.0"

[libraries]
# kotlin
Expand Down Expand Up @@ -58,12 +58,12 @@ 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" }
kotlinx-rpc-krpc-client = { module = "org.jetbrains.kotlinx:kotlinx-rpc-krpc-client" }
kotlinx-rpc-krpc-server = { module = "org.jetbrains.kotlinx:kotlinx-rpc-krpc-server" }
kotlinx-rpc-krpc-ktor-client = { module = "org.jetbrains.kotlinx:kotlinx-rpc-krpc-ktor-client" }
kotlinx-rpc-krpc-ktor-server = { module = "org.jetbrains.kotlinx:kotlinx-rpc-krpc-ktor-server" }
kotlinx-rpc-krpc-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-rpc-krpc-serialization-json" }
kotlinx-rpc-core = { module = "org.jetbrains.kotlinx:kotlinx-rpc-core", version.ref = "kotlinx-rpc" }
kotlinx-rpc-krpc-client = { module = "org.jetbrains.kotlinx:kotlinx-rpc-krpc-client", version.ref = "kotlinx-rpc" }
kotlinx-rpc-krpc-server = { module = "org.jetbrains.kotlinx:kotlinx-rpc-krpc-server", version.ref = "kotlinx-rpc" }
kotlinx-rpc-krpc-ktor-client = { module = "org.jetbrains.kotlinx:kotlinx-rpc-krpc-ktor-client", version.ref = "kotlinx-rpc" }
kotlinx-rpc-krpc-ktor-server = { module = "org.jetbrains.kotlinx:kotlinx-rpc-krpc-ktor-server", version.ref = "kotlinx-rpc" }
kotlinx-rpc-krpc-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-rpc-krpc-serialization-json", version.ref = "kotlinx-rpc" }

# other
logback = { module = "ch.qos.logback:logback-classic", version.ref = "logback" }
Expand All @@ -81,4 +81,3 @@ kotlinJvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
ktor = { id = "io.ktor.plugin", version.ref = "ktor" }
kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
kotlinx-rpc = { id = "org.jetbrains.kotlinx.rpc.plugin", version.ref = "kotlinx-rpc" }
kotlinx-rpc-platform = { id = "org.jetbrains.kotlinx.rpc.platform", version.ref = "kotlinx-rpc" }
1 change: 0 additions & 1 deletion samples/ktor-all-platforms-app/server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
plugins {
alias(libs.plugins.kotlinJvm)
alias(libs.plugins.ktor)
alias(libs.plugins.kotlinx.rpc.platform)
application
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
*/

import kotlinx.coroutines.flow.Flow
import kotlinx.rpc.RPC
import kotlinx.rpc.RemoteService
import kotlinx.rpc.annotations.Rpc
import kotlinx.serialization.Serializable

@Serializable
Expand All @@ -12,7 +13,8 @@ data class UserData(
val lastName: String,
)

interface UserService : RPC {
@Rpc
interface UserService : RemoteService {
suspend fun hello(user: String, userData: UserData): String

suspend fun subscribeToNews(): Flow<String>
Expand Down
3 changes: 1 addition & 2 deletions samples/ktor-android-app/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ plugins {
alias(libs.plugins.androidApplication)
alias(libs.plugins.kotlinAndroid)
alias(libs.plugins.kotlinPluginSerialization)
alias(libs.plugins.kotlinx.rpc.platform)
alias(libs.plugins.compose.compiler)
}

android {
namespace = "kotlinx.rpc.sample"
compileSdk = 34
compileSdk = 35

packaging {
resources {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
package kotlinx.rpc.sample

import kotlinx.coroutines.flow.Flow
import kotlinx.rpc.RPC
import kotlinx.rpc.RemoteService
import kotlinx.rpc.annotations.Rpc

interface MyService : RPC {
@Rpc
interface MyService : RemoteService {
suspend fun hello(user: String, userData: UserData): String

suspend fun subscribeToNews(): Flow<String>
}
}
35 changes: 17 additions & 18 deletions samples/ktor-android-app/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
[versions]
agp = "8.6.1"
kotlin = "2.0.10"
androidx-activityCompose = "1.9.2"
agp = "8.7.2"
kotlin = "2.0.21"
androidx-activityCompose = "1.9.3"
androidx-appcompat = "1.7.0"
androidx-constraintlayout = "2.1.4"
androidx-core-ktx = "1.13.1"
androidx-constraintlayout = "2.2.0"
androidx-core-ktx = "1.15.0"
androidx-test-junit = "1.2.1"
compose = "1.7.2"
compose = "1.7.5"
compose-plugin = "1.5.14" # https://mvnrepository.com/artifact/androidx.compose.compiler/compiler
compose-bom = "2024.09.02"
material3 = "1.3.0"
compose-bom = "2024.10.01"
material3 = "1.3.1"
junit = "4.13.2"
ktor = "3.0.0-rc-1"
ktor = "3.0.1"
kotlinx-serialization-json = "1.7.3"
kotlinx-coroutines-core = "1.9.0"
logback = "1.5.8"
kotlinx-rpc = "0.3.0"
logback = "1.5.12"
kotlinx-rpc = "0.4.0"

[libraries]
# kotlin
Expand Down Expand Up @@ -66,12 +66,12 @@ junit = { group = "junit", name = "junit", version.ref = "junit" }
androidx-test-junit = { group = "androidx.test.ext", name = "junit", version.ref = "androidx-test-junit" }

# kotlinx-rpc
kotlinx-rpc-core = { module = "org.jetbrains.kotlinx:kotlinx-rpc-core" }
kotlinx-rpc-krpc-client = { module = "org.jetbrains.kotlinx:kotlinx-rpc-krpc-client" }
kotlinx-rpc-krpc-server = { module = "org.jetbrains.kotlinx:kotlinx-rpc-krpc-server" }
kotlinx-rpc-krpc-ktor-client = { module = "org.jetbrains.kotlinx:kotlinx-rpc-krpc-ktor-client" }
kotlinx-rpc-krpc-ktor-server = { module = "org.jetbrains.kotlinx:kotlinx-rpc-krpc-ktor-server" }
kotlinx-rpc-krpc-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-rpc-krpc-serialization-json" }
kotlinx-rpc-core = { module = "org.jetbrains.kotlinx:kotlinx-rpc-core", version.ref = "kotlinx-rpc" }
kotlinx-rpc-krpc-client = { module = "org.jetbrains.kotlinx:kotlinx-rpc-krpc-client", version.ref = "kotlinx-rpc" }
kotlinx-rpc-krpc-server = { module = "org.jetbrains.kotlinx:kotlinx-rpc-krpc-server", version.ref = "kotlinx-rpc" }
kotlinx-rpc-krpc-ktor-client = { module = "org.jetbrains.kotlinx:kotlinx-rpc-krpc-ktor-client", version.ref = "kotlinx-rpc" }
kotlinx-rpc-krpc-ktor-server = { module = "org.jetbrains.kotlinx:kotlinx-rpc-krpc-ktor-server", version.ref = "kotlinx-rpc" }
kotlinx-rpc-krpc-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-rpc-krpc-serialization-json", version.ref = "kotlinx-rpc" }

[plugins]
androidApplication = { id = "com.android.application", version.ref = "agp" }
Expand All @@ -80,5 +80,4 @@ kotlinJvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlinPluginSerialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
kotlinx-rpc = { id = "org.jetbrains.kotlinx.rpc.plugin", version.ref = "kotlinx-rpc" }
kotlinx-rpc-platform = { id = "org.jetbrains.kotlinx.rpc.platform", version.ref = "kotlinx-rpc" }
ktor = { id = "io.ktor.plugin", version.ref = "ktor" }
1 change: 0 additions & 1 deletion samples/ktor-android-app/server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ plugins {
alias(libs.plugins.kotlinJvm)
alias(libs.plugins.kotlinPluginSerialization)
alias(libs.plugins.ktor)
alias(libs.plugins.kotlinx.rpc.platform)

application
distribution
Expand Down
1 change: 0 additions & 1 deletion samples/ktor-web-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
plugins {
alias(libs.plugins.kotlin.multiplatform) apply false
alias(libs.plugins.kotlinx.rpc) apply false
alias(libs.plugins.kotlinx.rpc.platform) apply false
}

allprojects {
Expand Down
6 changes: 4 additions & 2 deletions samples/ktor-web-app/common/src/commonMain/kotlin/Common.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
*/

import kotlinx.coroutines.flow.Flow
import kotlinx.rpc.RPC
import kotlinx.rpc.RemoteService
import kotlinx.rpc.annotations.Rpc
import kotlinx.serialization.Serializable

@Serializable
Expand All @@ -12,7 +13,8 @@ data class UserData(
val lastName: String,
)

interface MyService : RPC {
@Rpc
interface MyService : RemoteService {
suspend fun hello(user: String, userData: UserData): String

suspend fun subscribeToNews(): Flow<String>
Expand Down
1 change: 0 additions & 1 deletion samples/ktor-web-app/frontend/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
plugins {
kotlin("multiplatform")
alias(libs.plugins.kotlin.plugin.serialization)
alias(libs.plugins.kotlinx.rpc.platform)
}

kotlin {
Expand Down
23 changes: 11 additions & 12 deletions samples/ktor-web-app/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[versions]
kotlin = "2.0.10"
kotlin-wrappers-bom = "1.0.0-pre.812"
ktor = "3.0.0-rc-1"
kotlin = "2.0.21"
kotlin-wrappers-bom = "1.0.0-pre.823"
ktor = "3.0.1"
kotlinx-serialization-json = "1.7.3"
kotlinx-coroutines-core = "1.9.0"
logback = "1.5.8"
kotlinx-rpc = "0.3.0"
logback = "1.5.12"
kotlinx-rpc = "0.4.0"

[libraries]
# kotlin
Expand Down Expand Up @@ -41,16 +41,15 @@ ktor-client-js = { module = "io.ktor:ktor-client-js", version.ref = "ktor" }
logback-classic = { module = "ch.qos.logback:logback-classic", version.ref = "logback" }

# krpc
kotlinx-rpc-core = { module = "org.jetbrains.kotlinx:kotlinx-rpc-core" }
kotlinx-rpc-krpc-client = { module = "org.jetbrains.kotlinx:kotlinx-rpc-krpc-client" }
kotlinx-rpc-krpc-server = { module = "org.jetbrains.kotlinx:kotlinx-rpc-krpc-server" }
kotlinx-rpc-krpc-ktor-client = { module = "org.jetbrains.kotlinx:kotlinx-rpc-krpc-ktor-client" }
kotlinx-rpc-krpc-ktor-server = { module = "org.jetbrains.kotlinx:kotlinx-rpc-krpc-ktor-server" }
kotlinx-rpc-krpc-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-rpc-krpc-serialization-json" }
kotlinx-rpc-core = { module = "org.jetbrains.kotlinx:kotlinx-rpc-core", version.ref = "kotlinx-rpc" }
kotlinx-rpc-krpc-client = { module = "org.jetbrains.kotlinx:kotlinx-rpc-krpc-client", version.ref = "kotlinx-rpc" }
kotlinx-rpc-krpc-server = { module = "org.jetbrains.kotlinx:kotlinx-rpc-krpc-server", version.ref = "kotlinx-rpc" }
kotlinx-rpc-krpc-ktor-client = { module = "org.jetbrains.kotlinx:kotlinx-rpc-krpc-ktor-client", version.ref = "kotlinx-rpc" }
kotlinx-rpc-krpc-ktor-server = { module = "org.jetbrains.kotlinx:kotlinx-rpc-krpc-ktor-server", version.ref = "kotlinx-rpc" }
kotlinx-rpc-krpc-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-rpc-krpc-serialization-json", version.ref = "kotlinx-rpc" }

[plugins]
kotlin-plugin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlinx-rpc = { id = "org.jetbrains.kotlinx.rpc.plugin", version.ref = "kotlinx-rpc" }
kotlinx-rpc-platform = { id = "org.jetbrains.kotlinx.rpc.platform", version.ref = "kotlinx-rpc" }
1 change: 0 additions & 1 deletion samples/ktor-web-app/server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
plugins {
kotlin("jvm")
alias(libs.plugins.kotlin.plugin.serialization)
alias(libs.plugins.kotlinx.rpc.platform)
application
distribution
}
Expand Down
20 changes: 10 additions & 10 deletions samples/simple-ktor-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
*/

plugins {
kotlin("jvm") version "2.0.10"
kotlin("plugin.serialization") version "2.0.10"
id("io.ktor.plugin") version "3.0.0-rc-1"
id("org.jetbrains.kotlinx.rpc.plugin") version "0.3.0"
kotlin("jvm") version "2.0.21"
kotlin("plugin.serialization") version "2.0.21"
id("io.ktor.plugin") version "3.0.1"
id("org.jetbrains.kotlinx.rpc.plugin") version "0.4.0"
}

group = "kotlinx.rpc.sample"
Expand All @@ -28,16 +28,16 @@ kotlin {
}

dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-rpc-krpc-client")
implementation("org.jetbrains.kotlinx:kotlinx-rpc-krpc-server")
implementation("org.jetbrains.kotlinx:kotlinx-rpc-krpc-serialization-json")
implementation("org.jetbrains.kotlinx:kotlinx-rpc-krpc-client:0.4.0")
implementation("org.jetbrains.kotlinx:kotlinx-rpc-krpc-server:0.4.0")
implementation("org.jetbrains.kotlinx:kotlinx-rpc-krpc-serialization-json:0.4.0")

implementation("org.jetbrains.kotlinx:kotlinx-rpc-krpc-ktor-client")
implementation("org.jetbrains.kotlinx:kotlinx-rpc-krpc-ktor-server")
implementation("org.jetbrains.kotlinx:kotlinx-rpc-krpc-ktor-client:0.4.0")
implementation("org.jetbrains.kotlinx:kotlinx-rpc-krpc-ktor-server:0.4.0")

implementation("io.ktor:ktor-client-cio")
implementation("io.ktor:ktor-server-netty-jvm")
implementation("ch.qos.logback:logback-classic:1.5.8")
implementation("ch.qos.logback:logback-classic:1.5.12")

testImplementation("io.ktor:ktor-server-test-host")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit:2.0.10")
Expand Down
6 changes: 4 additions & 2 deletions samples/simple-ktor-app/src/main/kotlin/ImageRecognizer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.map
import kotlinx.rpc.RPC
import kotlinx.rpc.RemoteService
import kotlinx.rpc.RPCEagerField
import kotlinx.rpc.annotations.Rpc
import kotlinx.serialization.Serializable
import kotlin.coroutines.CoroutineContext

Expand All @@ -25,7 +26,8 @@ enum class Category {
CAT, DOG
}

interface ImageRecognizer : RPC {
@Rpc
interface ImageRecognizer : RemoteService {
@RPCEagerField
val currentlyProcessedImage: StateFlow<Image?>

Expand Down

0 comments on commit fca1259

Please sign in to comment.