Skip to content

Commit

Permalink
Using Gradle version catalogue in conventions plug-in
Browse files Browse the repository at this point in the history
  • Loading branch information
jlink committed Dec 16, 2024
1 parent 7c41441 commit 4380c00
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 5 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[versions]
apiguardian = "1.1.2"
junit-jupiter = "5.11.3"
junit-platform = "1.11.3"
assertJ = '3.26.3'
kotlin = '2.1.0'
#opentest4j = '1.3.0'
Expand All @@ -14,6 +15,9 @@ assertj-core = { module = "org.assertj:assertj-core", version.ref = "assertJ" }
kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" }
kotlin-test-junit5 = { module = "org.jetbrains.kotlin:kotlin-test-junit5", version.ref = "kotlin" }

# Used in gradle plugins build.gradle.kts:
# Used in conventions plug-ins:
junit-platform-launcher = { module = "org.junit.platform:junit-platform-launcher", version.ref = "junit-platform" }

# Used indirectly in gradle plugins build.gradle.kts:
kotlin-gradlePlugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
kotlin-powerAssertPlugin = { module = "org.jetbrains.kotlin:kotlin-power-assert", version.ref = "kotlin" }
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

fun alias(alias: String): Provider<MinimalExternalModuleDependency> {
return versionCatalogs.named("libs").findLibrary(alias).orElseThrow()
}

plugins {
`java-library`
id("buildlogic.publish-library")
Expand All @@ -22,7 +26,7 @@ powerAssert {
}

dependencies {
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
testRuntimeOnly(alias("junit.platform.launcher"))
}

tasks.named<Test>("test") {
Expand Down Expand Up @@ -60,3 +64,4 @@ tasks.withType<KotlinCompile> {
kotlin {
jvmToolchain(21)
}

0 comments on commit 4380c00

Please sign in to comment.