Skip to content

Version catalogs and safe project accessors #197

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from Jan 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions benchmarks/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
}
}

Expand All @@ -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)
}
}
}
Expand All @@ -75,7 +73,7 @@ benchmark {
register("java")
}

targets.withType<JvmBenchmarkTarget> { jmhVersion = jmhVersionOverride }
targets.withType<JvmBenchmarkTarget> { jmhVersion = libs.versions.jmh.get() }
}

tasks.register<JavaExec>("jmhProfilers") {
Expand Down
27 changes: 6 additions & 21 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -146,8 +140,6 @@ subprojects {
extensions.configure<KotlinMultiplatformExtension> {
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 {
Expand All @@ -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")

Expand All @@ -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)
}
}
}
Expand Down
13 changes: 0 additions & 13 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
53 changes: 53 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -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" }
9 changes: 3 additions & 6 deletions rsocket-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
Expand Down
11 changes: 3 additions & 8 deletions rsocket-test/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
9 changes: 4 additions & 5 deletions rsocket-test/rsocket-test-server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
Expand Down
26 changes: 11 additions & 15 deletions rsocket-transport-ktor/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion rsocket-transport-local/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

plugins {
kotlin("multiplatform")
id("kotlinx-atomicfu")

signing
`maven-publish`
Expand All @@ -26,7 +27,7 @@ kotlin {
sourceSets {
val commonMain by getting {
dependencies {
api(project(":rsocket-core"))
api(projects.rsocketCore)
}
}
}
Expand Down
Loading