From a2a1f8a7a50e57e15b92c843e3379197ab694cc4 Mon Sep 17 00:00:00 2001 From: Dennis Rieks Date: Sun, 25 Aug 2024 02:15:36 +0200 Subject: [PATCH] migrated to gradle version catalog --- build.gradle.kts | 6 +-- buildSrc/.gitignore | 2 - buildSrc/build.gradle.kts | 7 ---- buildSrc/src/main/kotlin/Versions.kt | 14 ------- common-test/build.gradle.kts | 4 +- gradle/libs.versions.toml | 39 +++++++++++++++++++ .../build.gradle.kts | 2 +- .../build.gradle.kts | 2 +- .../build.gradle.kts | 4 +- .../build.gradle.kts | 2 +- parser-antlr-java/build.gradle.kts | 2 +- parser-antlr-kotlin/build.gradle.kts | 2 +- parser-antlr-optimized/build.gradle.kts | 2 +- 13 files changed, 52 insertions(+), 36 deletions(-) delete mode 100644 buildSrc/.gitignore delete mode 100644 buildSrc/build.gradle.kts delete mode 100644 buildSrc/src/main/kotlin/Versions.kt create mode 100644 gradle/libs.versions.toml diff --git a/build.gradle.kts b/build.gradle.kts index ffc3802..b1edb1d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,13 +1,13 @@ buildscript { dependencies { // add the antlr-kotlin-gradle-plugin to the classpath - classpath("${Versions.antlrKotlinGroup}:antlr-kotlin-gradle-plugin:${Versions.antlrKotlin}") + classpath(libs.comStrumenta.antlrKotlinGradlePlugin) } } plugins { base - kotlin("multiplatform") version Versions.kotlin apply false + alias(libs.plugins.kotlin.multiplatform) apply false } // a small hack: the variable must be named like the property @@ -40,6 +40,6 @@ allprojects { } tasks.withType { - gradleVersion = Versions.gradle + gradleVersion = "8.10" distributionType = Wrapper.DistributionType.ALL } diff --git a/buildSrc/.gitignore b/buildSrc/.gitignore deleted file mode 100644 index 12eb6a9..0000000 --- a/buildSrc/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/.gradle -/build diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts deleted file mode 100644 index d317042..0000000 --- a/buildSrc/build.gradle.kts +++ /dev/null @@ -1,7 +0,0 @@ -repositories { - mavenCentral() -} - -plugins { - `kotlin-dsl` -} diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt deleted file mode 100644 index 6347726..0000000 --- a/buildSrc/src/main/kotlin/Versions.kt +++ /dev/null @@ -1,14 +0,0 @@ -object Versions { - const val kotlin = "2.0.10" - const val gradle = "8.10" - const val antlrJava = "4.7.2" - const val antlrOptimized = "4.7.4" - const val antlrUsedByAntlrKotlin = "4.7.1" - - const val antlrKotlin = "1.0.0-RC4" - - // official antlr kotlin version - val antlrKotlinGroup = "com.strumenta" - - const val kotest = "5.5.4" -} diff --git a/common-test/build.gradle.kts b/common-test/build.gradle.kts index 06d17cb..9106c35 100644 --- a/common-test/build.gradle.kts +++ b/common-test/build.gradle.kts @@ -17,8 +17,8 @@ kotlin { val jvmMain by getting { dependencies { - implementation("ch.qos.logback:logback-classic:1.2.10") - api("io.kotest:kotest-runner-junit5:${Versions.kotest}") + implementation(libs.chQosLogback.logbackClassic) + api(libs.ioKotest.kotestRunnerJunit5) } } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..eb9def5 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,39 @@ +[versions] +antlr-kotlin = "1.0.0-RC4" +antlr-optimized = "4.7.4" +antlr4 = "4.7.2" +kotest = "5.5.4" +kotlin = "2.0.10" +logback = "1.2.10" + +[libraries.comStrumenta-antlrKotlinGradlePlugin] +module = "com.strumenta:antlr-kotlin-gradle-plugin" +version.ref = "antlr-kotlin" + +[libraries.comStrumenta-antlrKotlinRuntime] +module = "com.strumenta:antlr-kotlin-runtime" +version.ref = "antlr-kotlin" + +[libraries.comStrumenta-antlrKotlinTarget] +module = "com.strumenta:antlr-kotlin-target" +version.ref = "antlr-kotlin" + +[libraries.comTunnelvisionlabs-antlr4] +module = "com.tunnelvisionlabs:antlr4" +version.ref = "antlr-optimized" + +[libraries.orgAntlr-antlr4] +module = "org.antlr:antlr4" +version.ref = "antlr4" + +[libraries.ioKotest-kotestRunnerJunit5] +module = "io.kotest:kotest-runner-junit5" +version.ref = "kotest" + +[plugins.kotlin-multiplatform] +id = "org.jetbrains.kotlin.multiplatform" +version.ref = "kotlin" + +[libraries.chQosLogback-logbackClassic] +module = "ch.qos.logback:logback-classic" +version.ref = "logback" diff --git a/grammar-antlr4-parser-antlr-java/build.gradle.kts b/grammar-antlr4-parser-antlr-java/build.gradle.kts index 7294d70..746ef22 100644 --- a/grammar-antlr4-parser-antlr-java/build.gradle.kts +++ b/grammar-antlr4-parser-antlr-java/build.gradle.kts @@ -17,7 +17,7 @@ tasks.withType(Test::class.java).all { } dependencies { - antlr("org.antlr:antlr4:${Versions.antlrJava}") + antlr(libs.orgAntlr.antlr4) api(project(":parser-antlr-java")) api(project(":grammar-antlr4-parser-common")) testApi(project(":common-test")) diff --git a/grammar-kotlin-parser-antlr-java/build.gradle.kts b/grammar-kotlin-parser-antlr-java/build.gradle.kts index 346a087..1481f34 100644 --- a/grammar-kotlin-parser-antlr-java/build.gradle.kts +++ b/grammar-kotlin-parser-antlr-java/build.gradle.kts @@ -17,7 +17,7 @@ tasks.withType(Test::class.java).all { } dependencies { - antlr("org.antlr:antlr4:${Versions.antlrJava}") + antlr(libs.orgAntlr.antlr4) api(project(":parser-antlr-java")) api(project(":grammar-kotlin-parser-common")) testImplementation(project(":grammar-kotlin-parser-test")) diff --git a/grammar-kotlin-parser-antlr-kotlin/build.gradle.kts b/grammar-kotlin-parser-antlr-kotlin/build.gradle.kts index 261a466..489deb4 100644 --- a/grammar-kotlin-parser-antlr-kotlin/build.gradle.kts +++ b/grammar-kotlin-parser-antlr-kotlin/build.gradle.kts @@ -30,8 +30,8 @@ kotlin { tasks.register("generateGrammarSource") { antlrClasspath = configurations.detachedConfiguration( - project.dependencies.create("org.antlr:antlr4:${Versions.antlrUsedByAntlrKotlin}"), - project.dependencies.create("${Versions.antlrKotlinGroup}:antlr-kotlin-target:${Versions.antlrKotlin}") + project.dependencies.create(libs.orgAntlr.antlr4), + project.dependencies.create(libs.comStrumenta.antlrKotlinTarget) ) maxHeapSize = "64m" packageName = "kotlinx.ast.grammar.kotlin.target.antlr.kotlin.generated" diff --git a/grammar-kotlin-parser-antlr-optimized/build.gradle.kts b/grammar-kotlin-parser-antlr-optimized/build.gradle.kts index 79beb5a..abd0bb7 100644 --- a/grammar-kotlin-parser-antlr-optimized/build.gradle.kts +++ b/grammar-kotlin-parser-antlr-optimized/build.gradle.kts @@ -17,7 +17,7 @@ tasks.withType(Test::class.java).all { } dependencies { - antlr("com.tunnelvisionlabs:antlr4:${Versions.antlrOptimized}") + antlr(libs.comTunnelvisionlabs.antlr4) api(project(":parser-antlr-optimized")) api(project(":grammar-kotlin-parser-common")) testImplementation(project(":grammar-kotlin-parser-test")) diff --git a/parser-antlr-java/build.gradle.kts b/parser-antlr-java/build.gradle.kts index b25d845..ccc48ec 100644 --- a/parser-antlr-java/build.gradle.kts +++ b/parser-antlr-java/build.gradle.kts @@ -5,7 +5,7 @@ plugins { dependencies { api(project(":common")) - api("org.antlr:antlr4:${Versions.antlrJava}") + api(libs.orgAntlr.antlr4) } kotlin { diff --git a/parser-antlr-kotlin/build.gradle.kts b/parser-antlr-kotlin/build.gradle.kts index 9d9eb6b..cc8c50e 100644 --- a/parser-antlr-kotlin/build.gradle.kts +++ b/parser-antlr-kotlin/build.gradle.kts @@ -12,7 +12,7 @@ kotlin { val commonMain by getting { dependencies { api(project(":common")) - api("${Versions.antlrKotlinGroup}:antlr-kotlin-runtime:${Versions.antlrKotlin}") + api(libs.comStrumenta.antlrKotlinRuntime) } } } diff --git a/parser-antlr-optimized/build.gradle.kts b/parser-antlr-optimized/build.gradle.kts index 4ee842c..8f1a7e0 100644 --- a/parser-antlr-optimized/build.gradle.kts +++ b/parser-antlr-optimized/build.gradle.kts @@ -7,7 +7,7 @@ dependencies { api(project(":parser-antlr-java")) { exclude("org.antlr", "antlr4") } - api("com.tunnelvisionlabs:antlr4:${Versions.antlrOptimized}") + api(libs.comTunnelvisionlabs.antlr4) } kotlin {