Skip to content

Commit 556ef99

Browse files
committed
build: use gradle version catalogs
This commit keeps all versions in one location, for reference throughout various build scripts. https://docs.gradle.org/current/userguide/platforms.html
1 parent ab7b603 commit 556ef99

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

build.gradle

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ plugins {
22
// Facilitates Java compilation
33
id 'java'
44
// For formatting source-code
5-
// NOTE: This is the maximum version that will work with JDK 8.
6-
id 'com.diffplug.spotless' version '6.12.0'
5+
alias(libs.plugins.spotless)
76
}
87

98
// Tasks not related to build are split out into their own gradle scripts
@@ -21,7 +20,7 @@ dependencies {
2120
// Ensure gradle is aware of the patched_client.jar dependency
2221
implementation files('patched_client.jar')
2322
// Used to find/populate scripts
24-
implementation group: 'org.reflections', name: 'reflections', version: '0.10.2'
23+
implementation libs.reflections
2524
}
2625

2726
tasks.named('jar') {

gradle/libs.versions.toml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[versions]
2+
spotless = '6.12.0' # maximum version that will work with JDK 8.
3+
google-java-format = '1.7' # maximum version that will work with JDK 8.
4+
reflections = '0.10.2'
5+
6+
[plugins]
7+
spotless = { id = 'com.diffplug.spotless', version.ref = 'spotless' }
8+
google-java-format = { id = 'com.google.googlejavaformat', version.ref = 'google-java-format' }
9+
10+
[libraries]
11+
reflections = { module = 'org.reflections:reflections', version.ref = 'reflections' }

spotless.gradle

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ spotless {
1515
removeUnusedImports()
1616
// Follow the Google Java formatting guide
1717
// ref: https://google.github.io/styleguide/javaguide.html
18-
// NOTE: This is the maximum version that will work with JDK 8.
19-
googleJavaFormat('1.7')
18+
googleJavaFormat("${libs.versions.google.java.format.get()}")
2019
// Fix formatting of type annotations
2120
formatAnnotations()
2221
}

0 commit comments

Comments
 (0)