diff --git a/base/build.gradle.kts b/base/build.gradle.kts index b60b431..ceba6f3 100644 --- a/base/build.gradle.kts +++ b/base/build.gradle.kts @@ -2,22 +2,18 @@ import org.gradle.api.JavaVersion.VERSION_17 import org.jetbrains.kotlin.gradle.dsl.JvmTarget plugins { - kotlin("jvm") - id("org.jetbrains.dokka") + alias(buildLibs.plugins.kotlin.jvm) + alias(buildLibs.plugins.dokka) } val artifactId by extra("testfiles") val description by extra("Manage test files and directories neatly!") dependencies { - testImplementation("org.spekframework.spek2:spek-dsl-jvm:2.0.17") - testImplementation("ch.tutteli.atrium:atrium-fluent-en_GB:0.16.0") - testRuntimeOnly("org.spekframework.spek2:spek-runner-junit5:2.0.17") - testRuntimeOnly("org.junit.platform:junit-platform-launcher") - - constraints { - testImplementation(kotlin("reflect")) - } + testImplementation(libs.spek.dsl.jvm) + testImplementation(testLibs.atrium.fluent.en.gb) + testRuntimeOnly(testLibs.spek.runner.junit5) + testRuntimeOnly(testLibs.junit.platform.launcher) } java { diff --git a/build.gradle.kts b/build.gradle.kts index cd86adb..4ff0ff9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,12 +1,12 @@ import org.jetbrains.dokka.gradle.DokkaExtension plugins { - kotlin("jvm") version "2.3.10" - id("org.jetbrains.dokka") version "2.1.0" - id("org.jetbrains.dokka-javadoc") version "2.1.0" apply false + alias(buildLibs.plugins.kotlin.jvm) + alias(buildLibs.plugins.dokka) + alias(buildLibs.plugins.dokka.javadoc) apply false `maven-publish` signing - id("io.github.gradle-nexus.publish-plugin") version "2.0.0" + alias(buildLibs.plugins.nexus.publish) idea } diff --git a/gradle/buildLibs.versions.toml b/gradle/buildLibs.versions.toml new file mode 100644 index 0000000..e6431b4 --- /dev/null +++ b/gradle/buildLibs.versions.toml @@ -0,0 +1,9 @@ +[versions] +dokka = "2.1.0" + +[plugins] +develocity = "com.gradle.develocity:4.3.2" +dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" } +dokka-javadoc = { id = "org.jetbrains.dokka-javadoc", version.ref = "dokka" } +kotlin-jvm = "org.jetbrains.kotlin.jvm:2.3.10" +nexus-publish = "io.github.gradle-nexus.publish-plugin:2.0.0" diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..64d5c3f --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,7 @@ +[versions] +spek = "2.0.17" + +[libraries] +kotest-framework-api = "io.kotest:kotest-framework-api:4.6.4" +spek-dsl-jvm = { module = "org.spekframework.spek2:spek-dsl-jvm", version.ref = "spek" } +spek-runtime-jvm = { module = "org.spekframework.spek2:spek-runtime-jvm", version.ref = "spek" } diff --git a/gradle/testLibs.versions.toml b/gradle/testLibs.versions.toml new file mode 100644 index 0000000..61a85f2 --- /dev/null +++ b/gradle/testLibs.versions.toml @@ -0,0 +1,5 @@ +[libraries] +atrium-fluent-en-gb = "ch.tutteli.atrium:atrium-fluent-en_GB:0.16.0" +junit-platform-launcher = "org.junit.platform:junit-platform-launcher:6.0.3" +kotest-runner-junit5 = "io.kotest:kotest-runner-junit5:4.6.4" +spek-runner-junit5 = "org.spekframework.spek2:spek-runner-junit5:2.0.17" diff --git a/kotest/build.gradle.kts b/kotest/build.gradle.kts index c1b3358..b565b74 100644 --- a/kotest/build.gradle.kts +++ b/kotest/build.gradle.kts @@ -2,8 +2,8 @@ import org.gradle.api.JavaVersion.VERSION_17 import org.jetbrains.kotlin.gradle.dsl.JvmTarget plugins { - kotlin("jvm") - id("org.jetbrains.dokka") + alias(buildLibs.plugins.kotlin.jvm) + alias(buildLibs.plugins.dokka) } val artifactId by extra("kotest-files") @@ -12,15 +12,11 @@ val description by extra("Manage test files and directories neatly when testing dependencies { api(project(":base")) // Kotest is a peer dependency - compileOnly("io.kotest:kotest-framework-api:4.6.4") + compileOnly(libs.kotest.framework.api) - testImplementation("io.kotest:kotest-runner-junit5:4.6.4") - testImplementation("ch.tutteli.atrium:atrium-fluent-en_GB:0.16.0") - testRuntimeOnly("org.junit.platform:junit-platform-launcher") - - constraints { - testImplementation(kotlin("reflect")) - } + testImplementation(testLibs.kotest.runner.junit5) + testImplementation(testLibs.atrium.fluent.en.gb) + testRuntimeOnly(testLibs.junit.platform.launcher) } java { diff --git a/settings.gradle.kts b/settings.gradle.kts index 3005386..4b95f03 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -4,6 +4,17 @@ plugins { id("com.gradle.develocity") version "4.3.2" } +dependencyResolutionManagement { + versionCatalogs { + create("testLibs") { + from(files("gradle/testLibs.versions.toml")) + } + create("buildLibs") { + from(files("gradle/buildLibs.versions.toml")) + } + } +} + include("base", "kotest", "spek") develocity { diff --git a/spek/build.gradle.kts b/spek/build.gradle.kts index 9f4d84c..d27a836 100644 --- a/spek/build.gradle.kts +++ b/spek/build.gradle.kts @@ -2,8 +2,8 @@ import org.gradle.api.JavaVersion.VERSION_17 import org.jetbrains.kotlin.gradle.dsl.JvmTarget plugins { - kotlin("jvm") - id("org.jetbrains.dokka") + alias(buildLibs.plugins.kotlin.jvm) + alias(buildLibs.plugins.dokka) } val artifactId by extra("spek-testfiles") @@ -11,18 +11,14 @@ val description by extra("Manage test files and directories neatly when testing dependencies { // Spek is a peer dependency - compileOnly("org.spekframework.spek2:spek-dsl-jvm:2.0.17") - compileOnly("org.spekframework.spek2:spek-runtime-jvm:2.0.17") + compileOnly(libs.spek.dsl.jvm) + compileOnly(libs.spek.runtime.jvm) api(project(":base")) - testImplementation("org.spekframework.spek2:spek-dsl-jvm:2.0.17") - testImplementation("ch.tutteli.atrium:atrium-fluent-en_GB:0.16.0") - testRuntimeOnly("org.spekframework.spek2:spek-runner-junit5:2.0.17") - testRuntimeOnly("org.junit.platform:junit-platform-launcher") - - constraints { - testImplementation(kotlin("reflect")) - } + testImplementation(libs.spek.dsl.jvm) + testImplementation(testLibs.atrium.fluent.en.gb) + testRuntimeOnly(testLibs.spek.runner.junit5) + testRuntimeOnly(testLibs.junit.platform.launcher) } java {