Skip to content

Commit 79c81d8

Browse files
committed
Start using Gradle's version catalog
1 parent 1939feb commit 79c81d8

3 files changed

Lines changed: 41 additions & 3 deletions

File tree

build.gradle

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,10 @@ sourceSets {
118118
}
119119

120120
dependencies {
121-
testImplementation "org.junit.jupiter:junit-jupiter-api:5.9.2"
122-
testImplementation "org.junit.jupiter:junit-jupiter-params:5.9.2"
121+
testImplementation platform(libs.junit5.bom)
122+
testImplementation libs.bundles.junit5.implementation
123123

124-
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.9.2"
124+
testRuntimeOnly libs.bundles.junit5.runtime
125125

126126
jruby9_1_15TestImplementation "org.jruby:jruby-complete:9.1.15.0"
127127
jruby9_1_17TestImplementation "org.jruby:jruby-complete:9.1.17.0"
@@ -160,6 +160,19 @@ javadocJar {
160160
}
161161
}
162162

163+
// A safer and strict alternative to: "dependencies" (and "dependencies --write-locks")
164+
//
165+
// This task fails explicitly when the specified dependency is not available.
166+
// In contrast, "dependencies (--write-locks)" does not fail even when a part the dependencies are unavailable.
167+
//
168+
// https://docs.gradle.org/8.7/userguide/dependency_locking.html#generating_and_updating_dependency_locks
169+
task checkDependencies {
170+
notCompatibleWithConfigurationCache("The task \"checkDependencies\" filters configurations at execution time.")
171+
doLast {
172+
configurations.findAll { it.canBeResolved }.each { it.resolve() }
173+
}
174+
}
175+
163176
// It should not publish a `.module` file in Maven Central.
164177
// https://docs.gradle.org/current/userguide/publishing_gradle_module_metadata.html#sub:disabling-gmm-publication
165178
tasks.withType(GenerateModuleMetadata) {

gradle/libs.versions.toml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[versions]
2+
3+
junit5 = "5.9.2"
4+
5+
[libraries]
6+
7+
junit5-bom = { group = "org.junit", name = "junit-bom", version.ref = "junit5" }
8+
junit5-api = { group = "org.junit.jupiter", name = "junit-jupiter-api" }
9+
junit5-params = { group = "org.junit.jupiter", name = "junit-jupiter-params" }
10+
junit5-engine = { group = "org.junit.jupiter", name = "junit-jupiter-engine" }
11+
12+
[bundles]
13+
14+
junit5-implementation = [
15+
"junit5-api",
16+
"junit5-params",
17+
]
18+
19+
junit5-runtime = [
20+
"junit5-engine",
21+
]

settings-gradle.lockfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# This is a Gradle generated file for dependency locking.
2+
# Manual edits can break the build and are not advised.
3+
# This file is expected to be part of source control.
4+
empty=incomingCatalogForLibs0

0 commit comments

Comments
 (0)