From 80994c9c84c911c4f3527640b1aab9c807a7ac6a Mon Sep 17 00:00:00 2001 From: Nicholas Hubbard Date: Sat, 1 Jun 2024 10:08:49 -0400 Subject: [PATCH] build: Move to version catalogs. Update Develocity plugin. --- build.gradle.kts | 60 ++++++++++++++++++++++----------------------- settings.gradle.kts | 45 +++++++++++++++++++++++++++++++++- 2 files changed, 73 insertions(+), 32 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index d2b3c4d..1ea7a43 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -41,11 +41,11 @@ plugins { signing kotlin("jvm") version "2.0.0" kotlin("plugin.allopen") version "2.0.0" - id("org.jetbrains.dokka") version "1.9.20" - id("org.jetbrains.kotlinx.kover") version "0.8.0" - id("org.jetbrains.kotlinx.benchmark") version "0.4.10" - id("net.thebugmc.gradle.sonatype-central-portal-publisher") version "1.2.3" - id("ca.solo-studios.sonatype-publish") version "0.1.3" + alias(libs.plugins.dokka) + alias(libs.plugins.kover) + alias(libs.plugins.benchmark) + alias(libs.plugins.sonatype.publisher) + alias(libs.plugins.solo.publisher) } group = "io.github.nhubbard" @@ -72,48 +72,46 @@ val benchmarkImplementation by configurations benchmarkImplementation.extendsFrom(configurations.implementation.get()) dependencies { - // Core implementation dependencies + // Core Kotlin dependencies implementation(kotlin("stdlib-jdk8")) - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1") implementation(kotlin("reflect")) - implementation("org.reflections:reflections:0.10.2") - implementation("org.apache.commons:commons-text:1.12.0") - implementation("com.fasterxml.jackson.core:jackson-core:2.17.1") - implementation("com.fasterxml.jackson.core:jackson-annotations:2.17.1") - implementation("com.fasterxml.jackson.core:jackson-databind:2.17.1") - implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.17.1") - implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.17.1") + + // KotlinX Coroutines + implementation(libs.kotlinx.coroutines.core) + + // Reflections + implementation(libs.reflections) + + // Apache Commons Text + implementation(libs.commons.text) + + // FasterXML Jackson + implementation(libs.bundles.jackson) // Git - implementation("org.eclipse.jgit:org.eclipse.jgit:6.9.0.202403050737-r") + implementation(libs.jgit) // Hocon - implementation("com.typesafe:config:1.4.3") + implementation(libs.hocon) // JS - // WARNING! - // Don't upgrade the GraalVM dependency versions! - // The newer versions have different coordinates, and a bunch of unusual issues that have no documented fix on - // non-Graal JDKs. - implementation("org.graalvm.sdk:graal-sdk:22.3.5") - implementation("org.graalvm.js:js:22.3.5") + implementation(libs.bundles.graal) // TOML - implementation("com.moandjiezana.toml:toml4j:0.7.2") + implementation(libs.toml) // XML - implementation("org.dom4j:dom4j:2.1.4") - implementation("jaxen:jaxen:2.0.0") + implementation(libs.dom4j) + implementation(libs.jaxen) // YAML - implementation("org.yaml:snakeyaml:2.2") + implementation(libs.snakeyaml) // Core test dependencies testImplementation(kotlin("test")) - testImplementation("org.junit.jupiter:junit-jupiter-params:5.10.2") - testImplementation("com.sparkjava:spark-core:2.9.4") - testImplementation("org.jetbrains.kotlin:kotlin-test") - testRuntimeOnly("org.slf4j:slf4j-simple:2.0.13") + testImplementation(libs.junit.params) + testImplementation(libs.spark) + testRuntimeOnly(libs.slf4j.simple) // Snippet implementation snippetImplementation(sourceSets.main.get().output) @@ -122,7 +120,7 @@ dependencies { // Benchmark implementation benchmarkImplementation(sourceSets.main.get().output) - benchmarkImplementation("org.jetbrains.kotlinx:kotlinx-benchmark-runtime:0.4.10") + benchmarkImplementation(libs.kotlinx.benchmark.runtime) } tasks.test { diff --git a/settings.gradle.kts b/settings.gradle.kts index cade05d..3094545 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -27,7 +27,7 @@ rootProject.name = "konf" plugins { id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0" - id("com.gradle.develocity") version "3.17.3" + id("com.gradle.develocity") version "3.17.4" } develocity { @@ -35,4 +35,47 @@ develocity { termsOfUseUrl = "https://gradle.com/terms-of-service" termsOfUseAgree = "yes" } +} + +dependencyResolutionManagement { + versionCatalogs { + create("libs") { + version("jackson", "2.17.1") + // WARNING! + // Don't upgrade the GraalVM dependency version! + // The newer versions have different coordinates and a bunch of unusual issues. + // There is no documented fix on non-Graal JDKs. + version("graal", "22.3.5") + + plugin("dokka", "org.jetbrains.dokka").version("1.9.20") + plugin("kover", "org.jetbrains.kotlinx.kover").version("0.8.0") + plugin("benchmark", "org.jetbrains.kotlinx.benchmark").version("0.4.10") + plugin("sonatype-publisher", "net.thebugmc.gradle.sonatype-central-portal-publisher").version("1.2.3") + plugin("solo-publisher", "ca.solo-studios.sonatype-publish").version("0.1.3") + + library("kotlinx-coroutines-core", "org.jetbrains.kotlinx", "kotlinx-coroutines-core").version("1.8.1") + library("reflections", "org.reflections", "reflections").version("0.10.2") + library("commons-text", "org.apache.commons", "commons-text").version("1.12.0") + library("jackson-core", "com.fasterxml.jackson.core", "jackson-core").versionRef("jackson") + library("jackson-annotations", "com.fasterxml.jackson.core", "jackson-annotations").versionRef("jackson") + library("jackson-databind", "com.fasterxml.jackson.core", "jackson-databind").versionRef("jackson") + library("jackson-kotlin", "com.fasterxml.jackson.module", "jackson-module-kotlin").versionRef("jackson") + library("jackson-jsr310", "com.fasterxml.jackson.datatype", "jackson-datatype-jsr310").versionRef("jackson") + library("jgit", "org.eclipse.jgit", "org.eclipse.jgit").version("6.9.0.202403050737-r") + library("hocon", "com.typesafe", "config").version("1.4.3") + library("graal-sdk", "org.graalvm.sdk", "graal-sdk").versionRef("graal") + library("graal-js", "org.graalvm.js", "js").versionRef("graal") + library("toml", "com.moandjiezana.toml", "toml4j").version("0.7.2") + library("dom4j", "org.dom4j", "dom4j").version("2.1.4") + library("jaxen", "jaxen", "jaxen").version("2.0.0") + library("snakeyaml", "org.yaml", "snakeyaml").version("2.2") + library("junit-params", "org.junit.jupiter", "junit-jupiter-params").version("5.10.2") + library("spark", "com.sparkjava", "spark-core").version("2.9.4") + library("slf4j-simple", "org.slf4j", "slf4j-simple").version("2.0.13") + library("kotlinx-benchmark-runtime", "org.jetbrains.kotlinx", "kotlinx-benchmark-runtime").version("0.4.10") + + bundle("jackson", listOf("jackson-core", "jackson-annotations", "jackson-databind", "jackson-kotlin", "jackson-jsr310")) + bundle("graal", listOf("graal-sdk", "graal-js")) + } + } } \ No newline at end of file