diff --git a/build.gradle.kts b/build.gradle.kts index 9198be79..f0387a4b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,3 +1,7 @@ +import org.jetbrains.dokka.DokkaConfiguration +import org.jetbrains.dokka.gradle.DokkaPlugin +import org.jetbrains.dokka.plugability.ConfigurableBlock + /* * Copyright 2020 Jason Monk * @@ -17,26 +21,25 @@ import org.jetbrains.dokka.base.DokkaBase import org.jetbrains.dokka.base.DokkaBaseConfiguration buildscript { - repositories { - mavenCentral() - mavenLocal() - } dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.0") - classpath("org.jetbrains.dokka:dokka-gradle-plugin:1.7.20") - classpath("org.jetbrains.dokka:dokka-base:1.7.20") + classpath(libs.bundles.dokka) } extra["kotlin_plugin_id"] = "com.monkopedia.ksrpc.plugin" } plugins { - kotlin("plugin.serialization") version "1.8.0" apply false + alias(libs.plugins.android.application) apply false + alias(libs.plugins.android.library) apply false + alias(libs.plugins.kotlin.android) apply false + alias(libs.plugins.kotlin.kapt) apply false + alias(libs.plugins.kotlin.serialization) apply false + alias(libs.plugins.dokka) + id("org.jlleitschuh.gradle.ktlint") version "11.0.0" id("com.github.hierynomus.license") version "0.16.1" id("com.github.gmazzo.buildconfig") version "3.1.0" apply false id("ksrpc-generate-module") id("com.monkopedia.ksrpc.plugin") apply false - id("org.jetbrains.dokka") version "1.7.20" } group = "com.monkopedia.ksrpc" diff --git a/compiler/build.gradle.kts b/compiler/build.gradle.kts index 35ab63a1..3cb6aac7 100644 --- a/compiler/build.gradle.kts +++ b/compiler/build.gradle.kts @@ -15,28 +15,25 @@ */ buildscript { - repositories { - mavenCentral() - mavenLocal() - } dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.0") - classpath("org.jetbrains.dokka:dokka-gradle-plugin:1.7.20") + classpath(libs.bundles.dokka) } extra["kotlin_plugin_id"] = "com.monkopedia.ksrpc.plugin" } plugins { - kotlin("plugin.serialization") version "1.8.0" apply false - id("com.github.hierynomus.license") version "0.16.1" - id("org.jlleitschuh.gradle.ktlint") version "11.0.0" + alias(libs.plugins.kotlin) apply false + alias(libs.plugins.kotlin.serialization) apply false + alias(libs.plugins.hierynomus.license) + alias(libs.plugins.jlleitschuh.ktlint) - id("com.github.gmazzo.buildconfig") version "3.1.0" apply false + alias(libs.plugins.gmazzo.buildconfig) apply false } group = "com.monkopedia.ksrpc" allprojects { repositories { + google() mavenLocal() mavenCentral() } diff --git a/compiler/gradle/libs.versions.toml b/compiler/gradle/libs.versions.toml new file mode 120000 index 00000000..d9b1d4e6 --- /dev/null +++ b/compiler/gradle/libs.versions.toml @@ -0,0 +1 @@ +../../gradle/libs.versions.toml \ No newline at end of file diff --git a/compiler/gradle/wrapper/gradle-wrapper.properties b/compiler/gradle/wrapper/gradle-wrapper.properties index ae04661e..da1db5f0 100644 --- a/compiler/gradle/wrapper/gradle-wrapper.properties +++ b/compiler/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/compiler/local-plugin/build.gradle.kts b/compiler/local-plugin/build.gradle.kts index 34fee823..674f38d9 100644 --- a/compiler/local-plugin/build.gradle.kts +++ b/compiler/local-plugin/build.gradle.kts @@ -26,8 +26,8 @@ dependencies { implementation(kotlin("stdlib")) implementation(kotlin("gradle-plugin-api")) implementation(gradleKotlinDsl()) - api("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.0") - api("org.jetbrains.dokka:dokka-gradle-plugin:1.7.20") + api(libs.kotlin.gradle) + api(libs.bundles.dokka) } java { diff --git a/compiler/local-plugin/src/main/kotlin/GenerateKsrpcProject.kt b/compiler/local-plugin/src/main/kotlin/GenerateKsrpcProject.kt index be0cf3ee..0236a56f 100644 --- a/compiler/local-plugin/src/main/kotlin/GenerateKsrpcProject.kt +++ b/compiler/local-plugin/src/main/kotlin/GenerateKsrpcProject.kt @@ -100,33 +100,21 @@ fun Project.ksrpcModule( if (name != "ksrpc-core") { api(project(":ksrpc-core")) } - implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.4.1") - implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") - implementation("org.jetbrains.kotlinx:atomicfu:0.18.5") } sourceSets["commonTest"].dependencies { implementation(kotlin("test")) } if (supportJvm) { sourceSets["jvmMain"].dependencies { - implementation("com.aventrix.jnanoid:jnanoid:2.0.0") - implementation(kotlin("stdlib")) implementation(kotlin("reflect")) - implementation("org.slf4j:slf4j-api:2.0.6") } sourceSets["jvmTest"].dependencies { implementation(kotlin("test-junit")) - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4") - implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.4.1") - implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1") } } if (supportJs) { sourceSets["jsMain"].dependencies { - implementation(npm("nanoid", "3.1.22")) } sourceSets["jsTest"].dependencies { implementation(kotlin("test-js")) @@ -135,7 +123,6 @@ fun Project.ksrpcModule( if (supportNative) { sourceSets["nativeMain"].dependencies { implementation(kotlin("stdlib")) - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") } } } @@ -157,7 +144,7 @@ fun Project.ksrpcModule( val dokkaJavadoc = tasks.create("dokkaJavadocCustom", DokkaTask::class) { it.project.dependencies { - it.plugins("org.jetbrains.dokka:kotlin-as-java-plugin:1.7.20") + it.plugins("org.jetbrains.dokka:kotlin-as-java-plugin") } // outputFormat = "javadoc" it.outputDirectory.set(File(project.buildDir, "javadoc")) diff --git a/compiler/native/build.gradle.kts b/compiler/native/build.gradle.kts index bc912c1f..ee36d809 100644 --- a/compiler/native/build.gradle.kts +++ b/compiler/native/build.gradle.kts @@ -35,8 +35,8 @@ java { dependencies { compileOnly("org.jetbrains.kotlin:kotlin-compiler") - kapt("com.google.auto.service:auto-service:1.0-rc7") - compileOnly("com.google.auto.service:auto-service-annotations:1.0-rc7") + kapt(libs.autoservice) + compileOnly(libs.autoservice.annotations) } tasks.named("compileKotlin") { dependsOn("syncSource") } @@ -95,7 +95,7 @@ publishing { tasks.withType { kotlinOptions.jvmTarget = "1.8" - kotlinOptions.freeCompilerArgs = listOf("-Xjvm-default=enable") + kotlinOptions.freeCompilerArgs = listOf("-Xjvm-default=all") } signing { diff --git a/compiler/plugin/build.gradle.kts b/compiler/plugin/build.gradle.kts index 7046f257..39ed7b4a 100644 --- a/compiler/plugin/build.gradle.kts +++ b/compiler/plugin/build.gradle.kts @@ -35,13 +35,13 @@ java { dependencies { compileOnly("org.jetbrains.kotlin:kotlin-compiler-embeddable") - kapt("com.google.auto.service:auto-service:1.0-rc7") - compileOnly("com.google.auto.service:auto-service-annotations:1.0-rc7") + kapt(libs.autoservice) + compileOnly(libs.autoservice.annotations) - testImplementation("com.monkopedia:ksrpc:0.6.0") + testImplementation(libs.ksrpctest) testImplementation(kotlin("test-junit")) testImplementation("org.jetbrains.kotlin:kotlin-compiler-embeddable") - testImplementation("com.github.tschuchortdev:kotlin-compile-testing:1.4.9") + testImplementation(libs.kotlin.compiletesting) } buildConfig { @@ -91,7 +91,7 @@ publishing { tasks.withType { kotlinOptions.jvmTarget = "1.8" - kotlinOptions.freeCompilerArgs = listOf("-Xjvm-default=enable") + kotlinOptions.freeCompilerArgs = listOf("-Xjvm-default=all") } signing { diff --git a/compiler/settings.gradle.kts b/compiler/settings.gradle.kts index 04b68b07..7ea8920e 100644 --- a/compiler/settings.gradle.kts +++ b/compiler/settings.gradle.kts @@ -13,6 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +pluginManagement { + repositories { + gradlePluginPortal() + google() + mavenCentral() + } +} include(":ksrpc-gradle-plugin") project(":ksrpc-gradle-plugin").projectDir = file("gradle") diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 00000000..7d380748 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,62 @@ +[versions] +gradleplugin = "8.0.0" +kotlin = "1.9.0" +kotlin-serialization = "1.5.1" +kotlin-coroutines = "1.7.2" +kotlin-atomicfu = "0.21.0" +kotlin-compiletesting = "1.4.9" +dokka = "1.8.20" +ktor = "2.3.2" +googleautoservice = "1.0.1" +ksrpctest = "0.7.1" +nanoid = "3.1.22" +jnanoid = "2.0.0" +slf4j = "2.0.6" +clikt = "3.5.1" + +[libraries] +dokka-base = { module = "org.jetbrains.dokka:dokka-base", version.ref = "dokka" } +dokka-gradle = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokka" } +kotlin-gradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } +autoservice = { module = "com.google.auto.service:auto-service", version.ref = "googleautoservice" } +autoservice-annotations = { module = "com.google.auto.service:auto-service-annotations", version.ref = "googleautoservice" } +ksrpctest = { module = "com.monkopedia.ksrpc:ksrpc-core", version.ref = "ksrpctest"} +kotlin-compiletesting = { module = "com.github.tschuchortdev:kotlin-compile-testing", version.ref = "kotlin-compiletesting"} +ktor-io = { module = "io.ktor:ktor-io", version.ref = "ktor" } +kotlinx-serialization = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "kotlin-serialization"} +kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlin-serialization"} +kotlinx-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlin-coroutines"} +kotlinx-atomicfu = { module = "org.jetbrains.kotlinx:atomicfu", version.ref = "kotlin-atomicfu"} +jnanoid = { module = "com.aventrix.jnanoid:jnanoid", version.ref = "jnanoid" } +slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j"} +ktor-client = { module = "io.ktor:ktor-client-core", version.ref = "ktor" } +ktor-client-curl = { module = "io.ktor:ktor-client-curl", version.ref = "ktor" } +ktor-client-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktor" } +ktor-client-websockets = { module = "io.ktor:ktor-client-websockets", version.ref = "ktor" } +ktor-server = { module = "io.ktor:ktor-server-core", version.ref = "ktor" } +ktor-server-websockets = { module = "io.ktor:ktor-server-websockets", version.ref = "ktor" } +ktor-server-cors = { module = "io.ktor:ktor-server-cors", version.ref = "ktor" } +ktor-server-host-common = { module = "io.ktor:ktor-server-host-common", version.ref = "ktor" } +ktor-server-netty = { module = "io.ktor:ktor-server-netty", version.ref = "ktor" } +ktor-server-cio = { module = "io.ktor:ktor-server-cio", version.ref = "ktor" } +ktor-http = { module = "io.ktor:ktor-http", version.ref = "ktor" } +ktor-kotlinx-serialization = { module = "io.ktor:ktor-serialization-kotlinx-json", version.ref = "ktor" } +ktor-jackson-serialization = { module = "io.ktor:ktor-serialization-jackson", version.ref = "ktor" } +ktor-websockets = { module = "io.ktor:ktor-websockets", version.ref = "ktor" } +ktor-websockets-serialization = { module = "io.ktor:ktor-websocket-serialization", version.ref = "ktor" } +clikt = { module = "com.github.ajalt.clikt:clikt", version.ref = "clikt"} + +[bundles] +dokka = ["dokka-base", "dokka-gradle"] + +[plugins] +android-application = { id = "com.android.application", version.ref = "gradleplugin" } +android-library = { id = "com.android.library", version.ref = "gradleplugin" } +kotlin = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } +kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } +kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" } +kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } +dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" } +hierynomus-license = { id = "com.github.hierynomus.license", version = "0.16.1" } +jlleitschuh-ktlint = { id = "org.jlleitschuh.gradle.ktlint", version = "11.0.0" } +gmazzo-buildconfig = { id = "com.github.gmazzo.buildconfig", version = "3.1.0" } \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 070cb702..da1db5f0 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/ksrpc-core/build.gradle.kts b/ksrpc-core/build.gradle.kts index 10e257f7..17f1b2a8 100644 --- a/ksrpc-core/build.gradle.kts +++ b/ksrpc-core/build.gradle.kts @@ -23,11 +23,18 @@ ksrpcModule() kotlin { sourceSets["commonMain"].dependencies { - api("io.ktor:ktor-io:2.2.1") + api(libs.ktor.io) + api(libs.kotlinx.serialization) + api(libs.kotlinx.serialization.json) + api(libs.kotlinx.coroutines) + api(libs.kotlinx.atomicfu) } sourceSets["jvmMain"].dependencies { + implementation(libs.jnanoid) + implementation(libs.slf4j.api) } sourceSets["jsMain"].dependencies { + implementation(npm("nanoid", libs.versions.nanoid.get())) } sourceSets["nativeMain"].dependencies { } diff --git a/ksrpc-core/src/nativeMain/kotlin/EpochMillis.kt b/ksrpc-core/src/nativeMain/kotlin/EpochMillis.kt index a7fd7ad7..4ff5c768 100644 --- a/ksrpc-core/src/nativeMain/kotlin/EpochMillis.kt +++ b/ksrpc-core/src/nativeMain/kotlin/EpochMillis.kt @@ -15,12 +15,14 @@ */ package com.monkopedia.ksrpc +import kotlinx.cinterop.ExperimentalForeignApi import kotlinx.cinterop.alloc import kotlinx.cinterop.memScoped import kotlinx.cinterop.ptr import platform.posix.gettimeofday import platform.posix.timeval +@OptIn(ExperimentalForeignApi::class) internal actual fun epochMillis(): Long = memScoped { val timeVal = alloc() gettimeofday(timeVal.ptr, null) diff --git a/ksrpc-jsonrpc/build.gradle.kts b/ksrpc-jsonrpc/build.gradle.kts index 00baa638..05672d4e 100644 --- a/ksrpc-jsonrpc/build.gradle.kts +++ b/ksrpc-jsonrpc/build.gradle.kts @@ -25,7 +25,7 @@ kotlin { sourceSets["commonMain"].dependencies { api(project(":ksrpc-packets")) api(project(":ksrpc-sockets")) - api("io.ktor:ktor-io:2.2.1") + api(libs.ktor.io) } sourceSets["jvmMain"].dependencies { } diff --git a/ksrpc-ktor/client/build.gradle.kts b/ksrpc-ktor/client/build.gradle.kts index 58109bd2..38592392 100644 --- a/ksrpc-ktor/client/build.gradle.kts +++ b/ksrpc-ktor/client/build.gradle.kts @@ -23,20 +23,20 @@ ksrpcModule() kotlin { sourceSets["commonMain"].dependencies { - implementation("io.ktor:ktor-client-core:2.2.1") - implementation("io.ktor:ktor-http:2.2.1") - implementation("io.ktor:ktor-serialization-kotlinx-json:2.2.1") + implementation(libs.ktor.client) + implementation(libs.ktor.http) + implementation(libs.ktor.kotlinx.serialization) } sourceSets["jvmMain"].dependencies { - compileOnly("io.ktor:ktor-client-core:2.2.1") + compileOnly(libs.ktor.client) - implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.4.1") - implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1") + implementation(libs.kotlinx.serialization) + implementation(libs.kotlinx.serialization.json) } sourceSets["jsMain"].dependencies { - compileOnly("io.ktor:ktor-client-core:2.2.1") + compileOnly(libs.ktor.client) } sourceSets["nativeMain"].dependencies { - implementation("io.ktor:ktor-client-curl:2.2.1") + implementation(libs.ktor.client.curl) } } diff --git a/ksrpc-ktor/server/build.gradle.kts b/ksrpc-ktor/server/build.gradle.kts index 104e6423..fa91f865 100644 --- a/ksrpc-ktor/server/build.gradle.kts +++ b/ksrpc-ktor/server/build.gradle.kts @@ -25,6 +25,6 @@ ksrpcModule( kotlin { sourceSets["commonMain"].dependencies { - api("io.ktor:ktor-server-core:2.2.1") + api(libs.ktor.server) } } diff --git a/ksrpc-ktor/websocket/client/build.gradle.kts b/ksrpc-ktor/websocket/client/build.gradle.kts index b6e776a4..9a86aa70 100644 --- a/ksrpc-ktor/websocket/client/build.gradle.kts +++ b/ksrpc-ktor/websocket/client/build.gradle.kts @@ -24,6 +24,6 @@ ksrpcModule() kotlin { sourceSets["commonMain"].dependencies { api(project(":ksrpc-ktor-websocket-shared")) - implementation("io.ktor:ktor-client-websockets:2.2.1") + implementation(libs.ktor.client.websockets) } } diff --git a/ksrpc-ktor/websocket/server/build.gradle.kts b/ksrpc-ktor/websocket/server/build.gradle.kts index 823db224..49ef270a 100644 --- a/ksrpc-ktor/websocket/server/build.gradle.kts +++ b/ksrpc-ktor/websocket/server/build.gradle.kts @@ -26,6 +26,6 @@ ksrpcModule( kotlin { sourceSets["commonMain"].dependencies { api(project(":ksrpc-ktor-websocket-shared")) - api("io.ktor:ktor-server-websockets:2.2.1") + api(libs.ktor.server.websockets) } } diff --git a/ksrpc-ktor/websocket/shared/build.gradle.kts b/ksrpc-ktor/websocket/shared/build.gradle.kts index e0924282..6c8abefe 100644 --- a/ksrpc-ktor/websocket/shared/build.gradle.kts +++ b/ksrpc-ktor/websocket/shared/build.gradle.kts @@ -24,8 +24,8 @@ ksrpcModule() kotlin { sourceSets["commonMain"].dependencies { api(project(":ksrpc-packets")) - api("io.ktor:ktor-websockets:2.2.1") - api("io.ktor:ktor-websocket-serialization:2.2.1") - api("io.ktor:ktor-serialization-kotlinx-json:2.2.1") + api(libs.ktor.websockets) + api(libs.ktor.websockets.serialization) + api(libs.ktor.kotlinx.serialization) } } diff --git a/ksrpc-ktor/websocket/shared/src/commonMain/kotlin/WebsocketPacketChannel.kt b/ksrpc-ktor/websocket/shared/src/commonMain/kotlin/WebsocketPacketChannel.kt index 300e112d..39d01667 100644 --- a/ksrpc-ktor/websocket/shared/src/commonMain/kotlin/WebsocketPacketChannel.kt +++ b/ksrpc-ktor/websocket/shared/src/commonMain/kotlin/WebsocketPacketChannel.kt @@ -19,6 +19,7 @@ import com.monkopedia.ksrpc.KsrpcEnvironment import com.monkopedia.ksrpc.packets.internal.Packet import com.monkopedia.ksrpc.packets.internal.PacketChannelBase import io.ktor.serialization.kotlinx.KotlinxWebsocketSerializationConverter +import io.ktor.util.InternalAPI import io.ktor.utils.io.charsets.Charsets import io.ktor.websocket.DefaultWebSocketSession import io.ktor.websocket.close @@ -27,6 +28,7 @@ import io.ktor.websocket.serialization.sendSerializedBase import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.sync.Mutex +@OptIn(InternalAPI::class) class WebsocketPacketChannel( scope: CoroutineScope, private val socketSession: DefaultWebSocketSession, @@ -44,7 +46,7 @@ class WebsocketPacketChannel( override suspend fun send(packet: Packet) { sendLock.lock() try { - socketSession.sendSerializedBase(packet, converter, Charsets.UTF_8) + socketSession.sendSerializedBase(packet, converter, Charsets.UTF_8) } finally { sendLock.unlock() } diff --git a/ksrpc-packets/build.gradle.kts b/ksrpc-packets/build.gradle.kts index 8f37c1ea..d50f0b2a 100644 --- a/ksrpc-packets/build.gradle.kts +++ b/ksrpc-packets/build.gradle.kts @@ -23,40 +23,40 @@ ksrpcModule() kotlin { sourceSets["commonMain"].dependencies { - implementation("io.ktor:ktor-client-core:2.2.1") - implementation("io.ktor:ktor-client-websockets:2.2.1") - implementation("io.ktor:ktor-http:2.2.1") - implementation("io.ktor:ktor-serialization-kotlinx-json:2.2.1") + implementation(libs.ktor.client) + implementation(libs.ktor.client.websockets) + implementation(libs.ktor.http) + implementation(libs.ktor.kotlinx.serialization) } sourceSets["jvmMain"].dependencies { - compileOnly("io.ktor:ktor-server-core:2.2.1") - compileOnly("io.ktor:ktor-server-host-common:2.2.1") - compileOnly("io.ktor:ktor-server-netty:2.2.1") - compileOnly("io.ktor:ktor-websockets:2.2.1") - compileOnly("io.ktor:ktor-server-websockets:2.2.1") - compileOnly("io.ktor:ktor-client-core:2.2.1") - compileOnly("io.ktor:ktor-server-cors:2.2.1") + compileOnly(libs.ktor.server) + compileOnly(libs.ktor.server.host.common) + compileOnly(libs.ktor.server.netty) + compileOnly(libs.ktor.websockets) + compileOnly(libs.ktor.server.websockets) + compileOnly(libs.ktor.client) + compileOnly(libs.ktor.server.cors) - implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.4.1") - implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1") + implementation(libs.kotlinx.serialization) + implementation(libs.kotlinx.serialization.json) } sourceSets["jvmTest"].dependencies { - implementation("io.ktor:ktor-server-core:2.2.1") - implementation("io.ktor:ktor-server-netty:2.2.1") - implementation("io.ktor:ktor-serialization-jackson:2.2.1") + implementation(libs.ktor.server) + implementation(libs.ktor.server.netty) + implementation(libs.ktor.jackson.serialization) - implementation("io.ktor:ktor-client-core:2.2.1") - implementation("io.ktor:ktor-client-okhttp:2.2.1") - implementation("io.ktor:ktor-server-websockets:2.2.1") - implementation("io.ktor:ktor-client-websockets:2.2.1") + implementation(libs.ktor.client) + implementation(libs.ktor.client.okhttp) + implementation(libs.ktor.server.websockets) + implementation(libs.ktor.client.websockets) } sourceSets["jsTest"].dependencies { - implementation("io.ktor:ktor-client-core:2.2.1") + implementation(libs.ktor.client) } sourceSets["jsMain"].dependencies { - compileOnly("io.ktor:ktor-client-core:2.2.1") + compileOnly(libs.ktor.client) } sourceSets["nativeMain"].dependencies { - implementation("io.ktor:ktor-client-curl:2.2.1") + implementation(libs.ktor.client.curl) } } diff --git a/ksrpc-server/build.gradle.kts b/ksrpc-server/build.gradle.kts index cc15ae3a..917d56c9 100644 --- a/ksrpc-server/build.gradle.kts +++ b/ksrpc-server/build.gradle.kts @@ -28,16 +28,16 @@ kotlin { api(project(":ksrpc-ktor-server")) api(project(":ksrpc-ktor-websocket-server")) api(project(":ksrpc-sockets")) - api("com.github.ajalt.clikt:clikt:3.5.1") - api("io.ktor:ktor-server-core:2.2.1") - api("io.ktor:ktor-server-cors:2.2.1") - api("io.ktor:ktor-server-host-common:2.2.1") + api(libs.clikt) + api(libs.ktor.server) + api(libs.ktor.server.cors) + api(libs.ktor.server.host.common) } sourceSets["jvmMain"].dependencies { api(project(":ksrpc-sockets")) - api("io.ktor:ktor-server-netty:2.2.1") + api(libs.ktor.server.netty) } sourceSets["nativeMain"].dependencies { - api("io.ktor:ktor-server-cio:2.2.1") + api(libs.ktor.server.cio) } } diff --git a/ksrpc-sockets/build.gradle.kts b/ksrpc-sockets/build.gradle.kts index cb812011..1801cfef 100644 --- a/ksrpc-sockets/build.gradle.kts +++ b/ksrpc-sockets/build.gradle.kts @@ -26,7 +26,7 @@ kotlin { api(project(":ksrpc-packets")) } sourceSets["jvmMain"].dependencies { - implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.4.1") - implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1") + implementation(libs.kotlinx.serialization) + implementation(libs.kotlinx.serialization.json) } } diff --git a/ksrpc-sockets/src/nativeMain/kotlin/PosixFileReadChannel.kt b/ksrpc-sockets/src/nativeMain/kotlin/PosixFileReadChannel.kt index 45685775..41a1be25 100644 --- a/ksrpc-sockets/src/nativeMain/kotlin/PosixFileReadChannel.kt +++ b/ksrpc-sockets/src/nativeMain/kotlin/PosixFileReadChannel.kt @@ -13,6 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:OptIn(ExperimentalForeignApi::class) + package com.monkopedia.ksrpc.sockets import com.monkopedia.ksrpc.KsrpcEnvironment @@ -27,6 +29,7 @@ import io.ktor.utils.io.read import io.ktor.utils.io.reader import io.ktor.utils.io.writer import kotlinx.cinterop.ByteVar +import kotlinx.cinterop.ExperimentalForeignApi import kotlinx.cinterop.allocArray import kotlinx.cinterop.memScoped import kotlinx.coroutines.DelicateCoroutinesApi diff --git a/ksrpc-sockets/src/nativeMain/kotlin/TermiosUtil.kt b/ksrpc-sockets/src/nativeMain/kotlin/TermiosUtil.kt index 87163e90..6d4fbd43 100644 --- a/ksrpc-sockets/src/nativeMain/kotlin/TermiosUtil.kt +++ b/ksrpc-sockets/src/nativeMain/kotlin/TermiosUtil.kt @@ -13,12 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:OptIn(ExperimentalForeignApi::class) + package com.monkopedia.ksrpc.sockets import kotlin.contracts.ExperimentalContracts import kotlin.contracts.InvocationKind.EXACTLY_ONCE import kotlin.contracts.contract import kotlinx.cinterop.CPointer +import kotlinx.cinterop.ExperimentalForeignApi import kotlinx.cinterop.alloc import kotlinx.cinterop.memScoped import kotlinx.cinterop.pointed diff --git a/ksrpc-test/build.gradle.kts b/ksrpc-test/build.gradle.kts index 66cc4d55..409654e5 100644 --- a/ksrpc-test/build.gradle.kts +++ b/ksrpc-test/build.gradle.kts @@ -15,24 +15,24 @@ kotlin { implementation(project(":ksrpc-ktor-client")) implementation(project(":ksrpc-ktor-websocket-client")) implementation(project(":ksrpc-sockets")) - implementation("io.ktor:ktor-client-core:2.2.1") + implementation(libs.ktor.client) } sourceSets["jvmTest"].dependencies { implementation(project(":ksrpc-server")) implementation(project(":ksrpc-ktor-server")) implementation(project(":ksrpc-ktor-websocket-server")) - implementation("io.ktor:ktor-server-core:2.2.1") - implementation("io.ktor:ktor-server-netty:2.2.1") - implementation("io.ktor:ktor-serialization-jackson:2.2.1") + implementation(libs.ktor.server) + implementation(libs.ktor.server.netty) + implementation(libs.ktor.jackson.serialization) - implementation("io.ktor:ktor-client-okhttp:2.2.1") - implementation("io.ktor:ktor-server-websockets:2.2.1") - implementation("io.ktor:ktor-client-websockets:2.2.1") + implementation(libs.ktor.client.okhttp) + implementation(libs.ktor.server.websockets) + implementation(libs.ktor.client.websockets) } sourceSets["nativeTest"].dependencies { implementation(project(":ksrpc-ktor-server")) implementation(project(":ksrpc-ktor-websocket-server")) - implementation("io.ktor:ktor-server-cio:2.2.1") + implementation(libs.ktor.server.cio) } sourceSets["jsTest"].dependencies { } diff --git a/ksrpc-test/src/nativeTest/kotlin/NativeTestUtil.kt b/ksrpc-test/src/nativeTest/kotlin/NativeTestUtil.kt index 2f930c8a..3fa2bea7 100644 --- a/ksrpc-test/src/nativeTest/kotlin/NativeTestUtil.kt +++ b/ksrpc-test/src/nativeTest/kotlin/NativeTestUtil.kt @@ -13,6 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:OptIn(ExperimentalForeignApi::class) + package com.monkopedia.ksrpc import com.monkopedia.ksrpc.channels.SerializedService @@ -25,6 +27,7 @@ import io.ktor.server.engine.embeddedServer import io.ktor.server.routing.routing import io.ktor.utils.io.ByteReadChannel import io.ktor.utils.io.ByteWriteChannel +import kotlinx.cinterop.ExperimentalForeignApi import kotlin.test.Test import kotlin.test.fail import kotlinx.cinterop.IntVar @@ -42,7 +45,7 @@ import kotlinx.coroutines.withContext import platform.posix.pipe import platform.posix.pthread_self -var PORT = 9081 +var PORT = 9181 val serverDispatcher = newFixedThreadPoolContext(8, "server-threads") actual suspend inline fun httpTest( diff --git a/settings.gradle.kts b/settings.gradle.kts index 6d3c5e76..bcfbfb6c 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -13,6 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +pluginManagement { + repositories { + gradlePluginPortal() + google() + mavenCentral() + } +} rootProject.name = "ksrpc" include(":ksrpc-core")