From 2f1e35afed79c3de52a2d4e026d80d851669ce53 Mon Sep 17 00:00:00 2001 From: Joffrey Bion Date: Mon, 6 Sep 2021 18:39:17 +0200 Subject: Extract common dependency versions to versions catalog --- gradle/libs.versions.toml | 19 +++++++++++++++++++ settings.gradle.kts | 3 +++ sw-bot/build.gradle.kts | 6 +++--- sw-client/build.gradle.kts | 8 ++++---- sw-common-model/build.gradle.kts | 4 +--- sw-engine/build.gradle.kts | 4 ++-- sw-server/build.gradle.kts | 21 ++++++++++----------- sw-ui/build.gradle.kts | 2 +- 8 files changed, 43 insertions(+), 24 deletions(-) create mode 100644 gradle/libs.versions.toml diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 00000000..4f69927a --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,19 @@ +[versions] +kotlinx-coroutines = "1.4.2" +kotlinx-serialization = "1.0.1" +krossbow = "1.1.5" +logback-classic = "1.2.3" +loki-logback-appender = "1.0.0" +micrometer-registry-prometheus = "1.6.1" +slf4j = "1.7.30" + +[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-serialization-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "kotlinx-serialization" } +kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx-serialization" } +krossbow-stomp-kxserialization = { module = "org.hildan.krossbow:krossbow-stomp-kxserialization", version.ref = "krossbow" } +logback-classic = { module = "ch.qos.logback:logback-classic", version.ref = "logback-classic" } +loki-logback-appender = { module = "com.github.loki4j:loki-logback-appender", version.ref = "loki-logback-appender" } +micrometer-registry-prometheus = { module = "io.micrometer:micrometer-registry-prometheus", version.ref = "micrometer-registry-prometheus" } +slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" } diff --git a/settings.gradle.kts b/settings.gradle.kts index b312e0b8..21c233fe 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -6,3 +6,6 @@ include("sw-server") include("sw-client") include("sw-ui") include("sw-bot") + +enableFeaturePreview("VERSION_CATALOGS") +enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") diff --git a/sw-bot/build.gradle.kts b/sw-bot/build.gradle.kts index 523f17e1..86017147 100644 --- a/sw-bot/build.gradle.kts +++ b/sw-bot/build.gradle.kts @@ -3,11 +3,11 @@ plugins { } dependencies { - api(project(":sw-client")) + api(projects.swClient) implementation(kotlin("stdlib-jdk8")) - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2") + implementation(libs.kotlinx.coroutines.core) - implementation("org.slf4j:slf4j-api:1.7.30") + implementation(libs.slf4j.api) testImplementation(kotlin("test")) testImplementation(kotlin("test-junit")) diff --git a/sw-client/build.gradle.kts b/sw-client/build.gradle.kts index f29fcbf8..d141bf9c 100644 --- a/sw-client/build.gradle.kts +++ b/sw-client/build.gradle.kts @@ -13,10 +13,10 @@ kotlin { } val commonMain by getting { dependencies { - api(project(":sw-common-model")) - api("org.hildan.krossbow:krossbow-stomp-kxserialization:1.1.5") - implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.0.1") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2") + api(projects.swCommonModel) + api(libs.krossbow.stomp.kxserialization) + implementation(libs.kotlinx.serialization.json) + implementation(libs.kotlinx.coroutines.core) } } val commonTest by getting { diff --git a/sw-common-model/build.gradle.kts b/sw-common-model/build.gradle.kts index dc95d608..fd5b8848 100644 --- a/sw-common-model/build.gradle.kts +++ b/sw-common-model/build.gradle.kts @@ -3,8 +3,6 @@ plugins { kotlin("plugin.serialization") } -val kotlinSerialization = "1.0.0" - kotlin { jvm() js { @@ -17,7 +15,7 @@ kotlin { } val commonMain by getting { dependencies { - api("org.jetbrains.kotlinx:kotlinx-serialization-core:$kotlinSerialization") + api(libs.kotlinx.serialization.core) } } val commonTest by getting { diff --git a/sw-engine/build.gradle.kts b/sw-engine/build.gradle.kts index ca2d6fec..3b5691f2 100644 --- a/sw-engine/build.gradle.kts +++ b/sw-engine/build.gradle.kts @@ -4,8 +4,8 @@ plugins { } dependencies { - implementation(project(":sw-common-model")) - implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.0.1") + implementation(projects.swCommonModel) + implementation(libs.kotlinx.serialization.json) testImplementation(kotlin("test")) testImplementation(kotlin("test-junit")) } diff --git a/sw-server/build.gradle.kts b/sw-server/build.gradle.kts index 445ae4d8..832ce912 100644 --- a/sw-server/build.gradle.kts +++ b/sw-server/build.gradle.kts @@ -8,15 +8,14 @@ plugins { apply(plugin = "io.spring.dependency-management") dependencies { - implementation(project(":sw-common-model")) - implementation(project(":sw-engine")) - implementation(project(":sw-bot")) + implementation(projects.swCommonModel) + implementation(projects.swEngine) + implementation(projects.swBot) implementation(kotlin("reflect")) // required by Spring 5 - val coroutinesVersion = "1.4.2" - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactor:$coroutinesVersion") // for Spring - implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.0.1") + implementation(libs.kotlinx.coroutines.core) + implementation(libs.kotlinx.coroutines.reactor) // for Spring + implementation(libs.kotlinx.serialization.json) implementation("org.springframework.boot:spring-boot-starter-websocket") implementation("org.springframework.boot:spring-boot-starter-security") @@ -24,16 +23,16 @@ dependencies { implementation("org.springframework.security:spring-security-messaging") // logging - implementation("ch.qos.logback:logback-classic:1.2.3") - implementation("com.github.loki4j:loki-logback-appender:1.0.0") + implementation(libs.logback.classic) + implementation(libs.loki.logback.appender) // monitoring / metrics implementation("org.springframework.boot:spring-boot-starter-actuator") - implementation("io.micrometer:micrometer-registry-prometheus:1.6.1") + implementation(libs.micrometer.registry.prometheus) testImplementation(kotlin("test")) testImplementation(kotlin("test-junit")) - testImplementation(project(":sw-client")) + testImplementation(projects.swClient) testImplementation("org.springframework.boot:spring-boot-starter-test") } diff --git a/sw-ui/build.gradle.kts b/sw-ui/build.gradle.kts index 9965ce85..3f7f569e 100644 --- a/sw-ui/build.gradle.kts +++ b/sw-ui/build.gradle.kts @@ -23,7 +23,7 @@ kotlin { sourceSets { main { dependencies { - implementation(project(":sw-client")) + implementation(projects.swClient) val reactVersion = "17.0.2" implementation("org.jetbrains:kotlin-react:$reactVersion-$kotlinWrappersVersion") -- cgit