diff --git a/benchmarks/build.gradle.kts b/benchmarks/build.gradle.kts index 13914a342..b13e80b63 100644 --- a/benchmarks/build.gradle.kts +++ b/benchmarks/build.gradle.kts @@ -20,13 +20,11 @@ import org.jetbrains.kotlin.gradle.plugin.mpp.* plugins { kotlin("multiplatform") - id("org.jetbrains.kotlinx.benchmark") - kotlin("plugin.allopen") -} + id("kotlinx-atomicfu") -val rsocketJavaVersion: String by rootProject -val kotlinxCoroutinesVersion: String by rootProject -val kotlinxBenchmarkVersion: String by rootProject + alias(libs.plugins.kotlin.allopen) + alias(libs.plugins.kotlinx.benchmark) +} val jmhVersionOverride: String by rootProject @@ -38,8 +36,8 @@ kotlin { sourceSets { val commonMain by getting { dependencies { - implementation("org.jetbrains.kotlinx:kotlinx-benchmark-runtime:$kotlinxBenchmarkVersion") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinxCoroutinesVersion") + implementation(libs.kotlinx.benchmark) + implementation(libs.kotlinx.coroutines.core) } } @@ -48,17 +46,17 @@ kotlin { val kotlinMain by getting { dependsOn(jvmMain) dependencies { - implementation(project(":rsocket-core")) - implementation(project(":rsocket-transport-local")) + implementation(projects.rsocketCore) + implementation(projects.rsocketTransportLocal) } } val javaMain by getting { dependsOn(jvmMain) dependencies { - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactor:$kotlinxCoroutinesVersion") - implementation("io.rsocket:rsocket-core:$rsocketJavaVersion") - implementation("io.rsocket:rsocket-transport-local:$rsocketJavaVersion") + implementation(libs.kotlinx.coroutines.reactor) + implementation(libs.rsocket.java.core) + implementation(libs.rsocket.java.transport.local) } } } @@ -75,7 +73,7 @@ benchmark { register("java") } - targets.withType { jmhVersion = jmhVersionOverride } + targets.withType { jmhVersion = libs.versions.jmh.get() } } tasks.register("jmhProfilers") { diff --git a/build.gradle.kts b/build.gradle.kts index 2ea54225e..a92cc6336 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -24,22 +24,16 @@ buildscript { repositories { mavenCentral() } - val kotlinVersion: String by rootProject - val kotlinxAtomicfuVersion: String by rootProject dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") - classpath("org.jetbrains.kotlinx:atomicfu-gradle-plugin:$kotlinxAtomicfuVersion") + classpath(libs.build.kotlin) + classpath(libs.build.kotlinx.atomicfu) } } -val kotlinxAtomicfuVersion: String by rootProject - plugins { - id("com.github.ben-manes.versions") - - //needed to add classpath to script - id("com.jfrog.artifactory") apply false + alias(libs.plugins.versionUpdates) + alias(libs.plugins.jfrog.artifactory) apply false //needed to add classpath to script } //on macos it will return all publications supported by rsocket, as linux and mingw can be crosscompiled there for publication @@ -146,8 +140,6 @@ subprojects { extensions.configure { val isTestProject = project.name == "rsocket-test" || project.name == "rsocket-test-server" val isLibProject = project.name.startsWith("rsocket") - val isPlaygroundProject = project.name == "playground" - val isExampleProject = "examples" in project.path sourceSets.all { languageSettings.apply { @@ -159,7 +151,7 @@ subprojects { // will be not needed in future with ktor 2.0.0 optIn("io.ktor.utils.io.core.ExperimentalIoApi") - if (name.contains("test", ignoreCase = true) || isTestProject || isPlaygroundProject) { + if (name.contains("test", ignoreCase = true) || isTestProject) { optIn("kotlin.time.ExperimentalTime") optIn("kotlin.ExperimentalStdlibApi") @@ -183,14 +175,7 @@ subprojects { if (isLibProject && !isTestProject) { explicitApi() sourceSets["commonTest"].dependencies { - implementation(project(":rsocket-test")) - } - } - - //fix atomicfu for examples and playground - if (isExampleProject || isPlaygroundProject) { - sourceSets["commonMain"].dependencies { - implementation("org.jetbrains.kotlinx:atomicfu:$kotlinxAtomicfuVersion") + implementation(projects.rsocketTest) } } } diff --git a/gradle.properties b/gradle.properties index 24e69dafc..e1f3bc8ab 100644 --- a/gradle.properties +++ b/gradle.properties @@ -16,19 +16,6 @@ #Project group=io.rsocket.kotlin version=0.15.0-SNAPSHOT -#Versions -kotlinVersion=1.6.10 -ktorVersion=1.6.7 -kotlinxCoroutinesVersion=1.5.2-native-mt -kotlinxAtomicfuVersion=0.17.0 -kotlinxSerializationVersion=1.3.1 -kotlinxBenchmarkVersion=0.4.0 -rsocketJavaVersion=1.1.1 -turbineVersion=0.7.0 -artifactoryVersion=4.25.1 -versionUpdatesVersion=0.39.0 -gradleEnterpriseVersion=3.4.1 -jmhVersionOverride=1.33 #Kotlin kotlin.js.compiler=both kotlin.mpp.stability.nowarn=true diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 000000000..d26ee577c --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,53 @@ +[versions] +kotlin = "1.6.10" + +kotlinx-atomicfu = "0.17.0" +kotlinx-coroutines = "1.5.2-native-mt" +kotlinx-benchmark = "0.4.0" + +ktor = "1.6.7" + +turbine = "0.7.0" + +jfrog-artifactory = "4.25.1" +versionUpdates = "0.39.0" + +rsocket-java = "1.1.1" + +jmh = "1.33" + +[libraries] +kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" } +kotlinx-coroutines-reactor = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-reactor", version.ref = "kotlinx-coroutines" } + +kotlinx-atomicfu = { module = "org.jetbrains.kotlinx:atomicfu", version.ref = "kotlinx-atomicfu" } +kotlinx-benchmark = { module = "org.jetbrains.kotlinx:kotlinx-benchmark-runtime", version.ref = "kotlinx-benchmark" } + +ktor-io = { module = "io.ktor:ktor-io", version.ref = "ktor" } +ktor-utils = { module = "io.ktor:ktor-utils", version.ref = "ktor" } +ktor-network = { module = "io.ktor:ktor-network", version.ref = "ktor" } +ktor-http-cio = { module = "io.ktor:ktor-http-cio", version.ref = "ktor" } +ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" } +ktor-client-cio = { module = "io.ktor:ktor-client-cio", version.ref = "ktor" } +ktor-client-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktor" } +ktor-server-core = { module = "io.ktor:ktor-server", version.ref = "ktor" } +ktor-server-websockets = { module = "io.ktor:ktor-websockets", version.ref = "ktor" } +ktor-server-cio = { module = "io.ktor:ktor-server-cio", version.ref = "ktor" } +ktor-server-netty = { module = "io.ktor:ktor-server-netty", version.ref = "ktor" } +ktor-server-jetty = { module = "io.ktor:ktor-server-jetty", version.ref = "ktor" } + +turbine = { module = "app.cash.turbine:turbine", version.ref = "turbine" } + +rsocket-java-core = { module = 'io.rsocket:rsocket-core', version.ref = "rsocket-java" } +rsocket-java-transport-local = { module = 'io.rsocket:rsocket-transport-local', version.ref = "rsocket-java" } + +build-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } +build-kotlinx-atomicfu = { module = "org.jetbrains.kotlinx:atomicfu-gradle-plugin", version.ref = "kotlinx-atomicfu" } + +[plugins] +kotlin-allopen = { id = "org.jetbrains.kotlin.plugin.allopen", version.ref = "kotlin" } + +kotlinx-benchmark = { id = "org.jetbrains.kotlinx.benchmark", version.ref = "kotlinx-benchmark" } + +versionUpdates = { id = "com.github.ben-manes.versions", version.ref = "versionUpdates" } +jfrog-artifactory = { id = "com.jfrog.artifactory", version.ref = "jfrog-artifactory" } diff --git a/rsocket-core/build.gradle.kts b/rsocket-core/build.gradle.kts index 0cf50c201..f9fd479c7 100644 --- a/rsocket-core/build.gradle.kts +++ b/rsocket-core/build.gradle.kts @@ -23,20 +23,17 @@ plugins { id("com.jfrog.artifactory") } -val ktorVersion: String by rootProject -val kotlinxCoroutinesVersion: String by rootProject - kotlin { sourceSets { val commonMain by getting { dependencies { - api("io.ktor:ktor-io:$ktorVersion") - api("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinxCoroutinesVersion") + api(libs.kotlinx.coroutines.core) + api(libs.ktor.io) } } val commonTest by getting { dependencies { - implementation(project(":rsocket-transport-local")) + implementation(projects.rsocketTransportLocal) } } } diff --git a/rsocket-test/build.gradle.kts b/rsocket-test/build.gradle.kts index 19b2a9587..5d856a517 100644 --- a/rsocket-test/build.gradle.kts +++ b/rsocket-test/build.gradle.kts @@ -19,20 +19,15 @@ plugins { id("kotlinx-atomicfu") } -val ktorVersion: String by rootProject -val kotlinxCoroutinesVersion: String by rootProject -val turbineVersion: String by rootProject - kotlin { sourceSets { val commonMain by getting { dependencies { api(kotlin("test")) - api(project(":rsocket-core")) + api(projects.rsocketCore) - api("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinxCoroutinesVersion") - api("io.ktor:ktor-utils:$ktorVersion") - api("app.cash.turbine:turbine:$turbineVersion") + api(libs.ktor.utils) + api(libs.turbine) } } val jvmMain by getting { diff --git a/rsocket-test/rsocket-test-server/build.gradle.kts b/rsocket-test/rsocket-test-server/build.gradle.kts index 5fd31fcba..fe5513041 100644 --- a/rsocket-test/rsocket-test-server/build.gradle.kts +++ b/rsocket-test/rsocket-test-server/build.gradle.kts @@ -20,18 +20,17 @@ import java.net.* plugins { kotlin("multiplatform") + id("kotlinx-atomicfu") } -val ktorVersion: String by rootProject - kotlin { sourceSets { val jvmMain by getting { dependencies { - implementation(project(":rsocket-test")) - implementation(project(":rsocket-transport-ktor-server")) + implementation(projects.rsocketTest) + implementation(projects.rsocketTransportKtorServer) - implementation("io.ktor:ktor-server-cio:$ktorVersion") + implementation(libs.ktor.server.cio) } } } diff --git a/rsocket-transport-ktor/build.gradle.kts b/rsocket-transport-ktor/build.gradle.kts index 8c289a3e6..002961ceb 100644 --- a/rsocket-transport-ktor/build.gradle.kts +++ b/rsocket-transport-ktor/build.gradle.kts @@ -16,42 +16,38 @@ plugins { kotlin("multiplatform") + id("kotlinx-atomicfu") signing `maven-publish` id("com.jfrog.artifactory") } -val ktorVersion: String by rootProject -val kotlinxAtomicfuVersion: String by rootProject - kotlin { sourceSets { val commonMain by getting { dependencies { - api(project(":rsocket-core")) + api(projects.rsocketCore) - api("io.ktor:ktor-network:$ktorVersion") - api("io.ktor:ktor-http-cio:$ktorVersion") + api(libs.ktor.network) + api(libs.ktor.http.cio) } } val commonTest by getting { dependencies { - implementation(project(":rsocket-transport-ktor-client")) - - implementation("org.jetbrains.kotlinx:atomicfu:$kotlinxAtomicfuVersion") + implementation(projects.rsocketTransportKtorClient) } } val jvmTest by getting { dependencies { - implementation(project(":rsocket-transport-ktor-server")) + implementation(projects.rsocketTransportKtorServer) - implementation("io.ktor:ktor-client-cio:$ktorVersion") - implementation("io.ktor:ktor-client-okhttp:$ktorVersion") + implementation(libs.ktor.client.cio) + implementation(libs.ktor.client.okhttp) - implementation("io.ktor:ktor-server-cio:$ktorVersion") - implementation("io.ktor:ktor-server-netty:$ktorVersion") - implementation("io.ktor:ktor-server-jetty:$ktorVersion") + implementation(libs.ktor.server.cio) + implementation(libs.ktor.server.netty) + implementation(libs.ktor.server.jetty) } } } diff --git a/rsocket-transport-ktor/rsocket-transport-ktor-client/build.gradle.kts b/rsocket-transport-ktor/rsocket-transport-ktor-client/build.gradle.kts index f51b48ba7..1d8c5f0ae 100644 --- a/rsocket-transport-ktor/rsocket-transport-ktor-client/build.gradle.kts +++ b/rsocket-transport-ktor/rsocket-transport-ktor-client/build.gradle.kts @@ -16,22 +16,21 @@ plugins { kotlin("multiplatform") + id("kotlinx-atomicfu") signing `maven-publish` id("com.jfrog.artifactory") } -val ktorVersion: String by rootProject - kotlin { sourceSets { val commonMain by getting { dependencies { - api(project(":rsocket-core")) - api(project(":rsocket-transport-ktor")) + api(projects.rsocketCore) + api(projects.rsocketTransportKtor) - api("io.ktor:ktor-client-core:$ktorVersion") + api(libs.ktor.client.core) } } } diff --git a/rsocket-transport-ktor/rsocket-transport-ktor-server/build.gradle.kts b/rsocket-transport-ktor/rsocket-transport-ktor-server/build.gradle.kts index 9f92b24f7..53574273e 100644 --- a/rsocket-transport-ktor/rsocket-transport-ktor-server/build.gradle.kts +++ b/rsocket-transport-ktor/rsocket-transport-ktor-server/build.gradle.kts @@ -16,23 +16,22 @@ plugins { kotlin("multiplatform") + id("kotlinx-atomicfu") signing `maven-publish` id("com.jfrog.artifactory") } -val ktorVersion: String by rootProject - kotlin { sourceSets { val commonMain by getting { dependencies { - api(project(":rsocket-core")) - api(project(":rsocket-transport-ktor")) + api(projects.rsocketCore) + api(projects.rsocketTransportKtor) - api("io.ktor:ktor-server:$ktorVersion") - api("io.ktor:ktor-websockets:$ktorVersion") + api(libs.ktor.server.core) + api(libs.ktor.server.websockets) } } } diff --git a/rsocket-transport-local/build.gradle.kts b/rsocket-transport-local/build.gradle.kts index 161799e99..93d822c48 100644 --- a/rsocket-transport-local/build.gradle.kts +++ b/rsocket-transport-local/build.gradle.kts @@ -16,6 +16,7 @@ plugins { kotlin("multiplatform") + id("kotlinx-atomicfu") signing `maven-publish` @@ -26,7 +27,7 @@ kotlin { sourceSets { val commonMain by getting { dependencies { - api(project(":rsocket-core")) + api(projects.rsocketCore) } } } diff --git a/rsocket-transport-nodejs-tcp/build.gradle.kts b/rsocket-transport-nodejs-tcp/build.gradle.kts index c73084cef..c5bd8af86 100644 --- a/rsocket-transport-nodejs-tcp/build.gradle.kts +++ b/rsocket-transport-nodejs-tcp/build.gradle.kts @@ -27,7 +27,7 @@ kotlin { sourceSets { val jsMain by getting { dependencies { - api(project(":rsocket-core")) + api(projects.rsocketCore) } } } diff --git a/settings.gradle.kts b/settings.gradle.kts index ece5be2a6..5b2612c55 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -14,28 +14,14 @@ * limitations under the License. */ +enableFeaturePreview("VERSION_CATALOGS") +enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") + pluginManagement { repositories { gradlePluginPortal() mavenCentral() } - - val kotlinVersion: String by settings - val artifactoryVersion: String by settings - val versionUpdatesVersion: String by settings - val gradleEnterpriseVersion: String by settings - val kotlinxBenchmarkVersion: String by settings - - plugins { - kotlin("plugin.allopen") version kotlinVersion - kotlin("plugin.serialization") version kotlinVersion - - id("org.jetbrains.kotlinx.benchmark") version kotlinxBenchmarkVersion - - id("com.jfrog.artifactory") version artifactoryVersion - id("com.github.ben-manes.versions") version versionUpdatesVersion - id("com.gradle.enterprise") version gradleEnterpriseVersion - } } dependencyResolutionManagement { @@ -45,7 +31,8 @@ dependencyResolutionManagement { } plugins { - id("com.gradle.enterprise") + //this version can not be moved to version catalog, because it's in settings.gradle.kts + id("com.gradle.enterprise") version "3.7.2" } gradleEnterprise {