From 46c708dbdd51e338f7ff41f3c285fe19ad9d041f Mon Sep 17 00:00:00 2001 From: Kyle Moore Date: Mon, 23 Sep 2024 12:30:52 -0700 Subject: [PATCH] Fix #61: Use version catalog to specify project and build dependencies --- build.gradle | 24 ++++++++++++++---------- gradle.properties | 14 +------------- gradle/libs.versions.toml | 13 +++++++++++++ 3 files changed, 28 insertions(+), 23 deletions(-) create mode 100644 gradle/libs.versions.toml diff --git a/build.gradle b/build.gradle index dfd02be..1a4c922 100644 --- a/build.gradle +++ b/build.gradle @@ -2,8 +2,8 @@ import org.gosulang.gradle.build.VersionWriterTask import java.nio.charset.StandardCharsets plugins { - id 'com.gradle.plugin-publish' version "${gradlePublishPluginVersion}" - id 'net.researchgate.release' version "${researchgateReleaseGradlePluginVersion}" + alias(libs.plugins.plugin.publish) + alias(libs.plugins.release) id 'groovy' id 'java-gradle-plugin' id 'maven-publish' @@ -40,14 +40,18 @@ repositories { } dependencies { - testImplementation platform("org.junit:junit-bom:${junitPlatformVersion}") - testImplementation "org.junit.jupiter:junit-jupiter" - testRuntimeOnly "org.junit.vintage:junit-vintage-engine" - testImplementation "junit:junit:${junitVersion}" //TODO refactor existing unit tests and get rid of junit 4 - testImplementation "org.hamcrest:hamcrest-library:${hamcrestLibraryVersion}" - testImplementation "org.spockframework:spock-core:${spockCoreVersion}" - testImplementation "org.assertj:assertj-core:${assertjCoreVersion}" - testImplementation "org.opentest4j:opentest4j:${opentest4jVersion}" + testImplementation platform(libs.junit.platform) + testImplementation libs.junit.jupiter + testRuntimeOnly libs.junit.vintageEngine + testImplementation libs.junit4 + testImplementation libs.hamcrest + testImplementation(libs.spock.core) { + artifact { + type = "jar" + } + } + testImplementation libs.assertj + testImplementation libs.opentest4j } java { diff --git a/gradle.properties b/gradle.properties index b28f7ce..71cc3a9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,17 +12,5 @@ org.gradle.workers.max=1 gosuVersion=1.17.8 testedVersions=8.2,8.10.1 -# Gradle plugins -gradlePublishPluginVersion=0.15.0 -researchgateReleaseGradlePluginVersion=3.0.2 - # For docker container -javaVersion=11 - -# Test implementation dependencies -assertjCoreVersion=3.24.2 -hamcrestLibraryVersion=2.2 -spockCoreVersion=2.3-groovy-3.0@jar -junitVersion=4.13.2 -junitPlatformVersion=5.8.2 -opentest4jVersion=1.3.0 +javaVersion=11 \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..5c03b4a --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,13 @@ +[libraries] +junit-platform = { module = "org.junit:junit-bom", version = "5.8.2" } +junit-jupiter = { module = "org.junit.jupiter:junit-jupiter" } # version inherited from junit-bom +junit-vintageEngine = { module = "org.junit.vintage:junit-vintage-engine" } # version inherited from junit-bom +junit4 = { module = "junit:junit", version = "4.13.2" } +hamcrest = { module = "org.hamcrest:hamcrest-library", version = "2.2" } +spock-core = { module = "org.spockframework:spock-core", version = "2.3-groovy-3.0" } +assertj = { module = "org.assertj:assertj-core", version = "3.24.2" } +opentest4j = { module = "org.opentest4j:opentest4j", version = "1.3.0" } + +[plugins] +plugin-publish = { id = "com.gradle.plugin-publish", version = "0.15.0" } +release = { id = "net.researchgate.release", version = "3.0.2" }