Skip to content

Commit b4d3e30

Browse files
authored
Use version catalog. (#7381)
1 parent 156bf56 commit b4d3e30

File tree

11 files changed

+126
-68
lines changed

11 files changed

+126
-68
lines changed

annotation-file-utilities/build.gradle

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ dependencies {
2020
// Annotations in checker-qual.jar are used, but no checkers are (currently) run on the code.
2121
compileOnly(project(":checker-qual"))
2222

23-
implementation("org.plumelib:options:2.0.3")
24-
implementation("org.plumelib:plume-util:${plumeUtilVersion}")
25-
implementation("org.plumelib:reflection-util:${reflectionUtilVersion}")
26-
implementation("org.checkerframework.annotatedlib:guava:33.1.0.2-jre") {
23+
implementation(libs.options)
24+
implementation(libs.plume.util)
25+
implementation(libs.reflection.util)
26+
implementation(libs.guava) {
2727
// So long as Guava only uses annotations from checker-qual, excluding it should not cause problems.
2828
exclude group: "org.checkerframework"
2929
}
30-
implementation("org.ow2.asm:asm:9.9")
31-
testImplementation("junit:junit:${junitVersion}")
30+
implementation(libs.asm)
31+
testImplementation(libs.junit)
3232
testImplementation(project(":checker-qual"))
3333
}
3434

build.gradle

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
plugins {
22
// https://plugins.gradle.org/plugin/com.gradleup.shadow
3-
id("com.gradleup.shadow").version("9.2.2")
3+
alias(libs.plugins.com.gradleup.shadow)
44
// https://plugins.gradle.org/plugin/de.undercouch.download
5-
id("de.undercouch.download").version("5.6.0")
5+
alias(libs.plugins.de.undercouch.download)
66
id("java")
77
// https://github.com/tbroyer/gradle-errorprone-plugin
8-
id("net.ltgt.errorprone").version("4.3.0")
8+
alias(libs.plugins.net.ltgt.errorprone)
99
// https://docs.gradle.org/current/userguide/eclipse_plugin.html
1010
id("eclipse")
1111

1212
id("groovy") // needed for formatting Gradle files
13+
1314
// Code formatting; defines targets "spotlessApply" and "spotlessCheck".
1415
// https://github.com/diffplug/spotless/tags ; see tags starting "gradle/"
1516
// Only works on JDK 11+ (even including the plugin crashes Gradle on JDK 8);
1617
// shell scripts in checker/bin-devel/ ensure spotless isn't called unless
1718
// the JDK is 17 or later.
18-
id("com.diffplug.spotless").version("8.1.0")
19+
alias(libs.plugins.com.diffplug.spotless)
1920
}
2021
apply from: rootProject.file("release.gradle")
2122

@@ -122,7 +123,7 @@ spotlessPredeclare {
122123
// > Could not create task ":spotlessJava'.
123124
// > Add a step with [com.google.googlejavaformat:google-java-format:1.15.0] into the `spotlessPredeclare` block in the root project.
124125
java {
125-
googleJavaFormat(googleJavaFormatVersion)
126+
googleJavaFormat(libs.google.java.format.get().version)
126127
}
127128
groovyGradle {
128129
greclipse()
@@ -207,11 +208,11 @@ allprojects { currentProj ->
207208
}
208209

209210
dependencies {
210-
errorprone("com.google.errorprone:error_prone_core:${errorproneVersion}")
211+
errorprone(libs.error.prone.core)
211212

212-
javacJar("com.google.errorprone:javac:9+181-r4173-1")
213+
javacJar(libs.javac)
213214

214-
errorproneJavac("com.google.errorprone:javac:9+181-r4173-1")
215+
errorproneJavac(libs.javac)
215216

216217
allProjects(subprojects)
217218
}
@@ -349,10 +350,10 @@ allprojects { currentProj ->
349350
targetExclude(doNotFormat)
350351

351352
if (project.hasProperty("eisopFormatting")) {
352-
googleJavaFormat(googleJavaFormatVersion).aosp()
353+
googleJavaFormat(libs.google.java.format.get().version).aosp()
353354
importOrder("com", "jdk", "lib", "lombok", "org", "java", "javax")
354355
} else {
355-
googleJavaFormat(googleJavaFormatVersion) // the formatter to apply to Java files
356+
googleJavaFormat(libs.google.java.format.get().version) // the formatter to apply to Java files
356357
}
357358
formatAnnotations()
358359
}
@@ -575,7 +576,7 @@ allprojects { currentProj ->
575576
"-Xep:NonOverridingEquals:OFF",
576577
// Suggests using a class that's in Error Prone itself, not in any library for clients.
577578
// It requires "import com.google.errorprone.util.ASTHelpers;", and (in build.gradle)
578-
// implementation("com.google.errorprone:error_prone_core:${errorproneVersion}")
579+
// implementation(libs.error.prone.core)
579580
// Adding that line in build.gradle causes a javac crash when running the Checker Framework.
580581
"-Xep:ASTHelpersSuggestions:OFF",
581582
// Removing "public" from private class members loses information about the abstraction.
@@ -825,7 +826,7 @@ configurations {
825826
requireJavadoc
826827
}
827828
dependencies {
828-
requireJavadoc("org.plumelib:require-javadoc:2.0.0")
829+
requireJavadoc(libs.require.javadoc)
829830
}
830831
tasks.register("requireJavadoc", JavaExec) {
831832
description = "Ensures that Javadoc documentation exists in source code."
@@ -957,8 +958,8 @@ subprojects {
957958

958959
dependencies {
959960
// TODO: it's a bug that annotatedlib:guava requires the error_prone_annotations dependency.
960-
annotatedGuava("com.google.errorprone:error_prone_annotations:${errorproneVersion}")
961-
annotatedGuava("org.checkerframework.annotatedlib:guava:33.1.0.2-jre") {
961+
annotatedGuava(libs.error.prone.annotations)
962+
annotatedGuava(libs.guava) {
962963
// So long as Guava only uses annotations from checker-qual, excluding it should not cause problems.
963964
exclude group: "org.checkerframework"
964965
}

checker-qual/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
plugins {
22
id("java-library")
3-
id("biz.aQute.bnd.builder").version("7.1.0")
3+
alias(libs.plugins.biz.aqute.bnd.builder)
44
}
55

66
sourceSets {

checker-util/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ dependencies {
66
api(project(":checker-qual"))
77
// Don't add implementation dependencies; checker-util.jar should have no dependencies.
88

9-
testImplementation("junit:junit:${junitVersion}")
9+
testImplementation(libs.junit)
1010
}
1111

1212
jar {

checker/build.gradle

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins {
33
id("base")
44
// https://github.com/n0mer/gradle-git-properties
55
// Generates file build/resources/main/git.properties when the `classes` task runs.
6-
id("com.gorylenko.gradle-git-properties").version("2.5.4")
6+
alias(libs.plugins.com.gorylenko.gradle.git.properties)
77
}
88

99
sourceSets {
@@ -42,33 +42,33 @@ dependencies {
4242
// If you add an external dependency, you must shadow its packages.
4343
// See the comment in ../build.gradle in the shadowJar block.
4444

45-
implementation("org.plumelib:reflection-util:${reflectionUtilVersion}")
46-
implementation("org.plumelib:plume-util:${plumeUtilVersion}")
45+
implementation(libs.reflection.util)
46+
implementation(libs.plume.util)
4747

4848
// Dependencies added to "shadow" appear as dependencies in Maven Central.
4949
shadow(project(":checker-qual"))
5050
shadow(project(":checker-util"))
5151

5252
// Called Methods Checker AutoValue + Lombok support
53-
testImplementation("com.google.auto.value:auto-value-annotations:${autoValueVersion}")
54-
testImplementation("com.google.auto.value:auto-value:${autoValueVersion}")
55-
testImplementation("com.ryanharter.auto.value:auto-value-parcel:0.2.9")
56-
testImplementation("org.projectlombok:lombok:${lombokVersion}")
53+
testImplementation(libs.auto.value.annotations)
54+
testImplementation(libs.auto.value)
55+
testImplementation(libs.auto.value.parcel)
56+
testImplementation(libs.lombok)
5757

5858
// Called Methods Checker support for detecting misuses of AWS APIs
59-
testImplementation("com.amazonaws:aws-java-sdk-ec2")
60-
testImplementation("com.amazonaws:aws-java-sdk-kms")
59+
testImplementation(libs.aws.java.sdk.ec2)
60+
testImplementation(libs.aws.java.sdk.kms)
6161
// The AWS SDK is used for testing the Called Methods Checker.
62-
testImplementation(platform("com.amazonaws:aws-java-sdk-bom:1.12.794"))
62+
testImplementation(platform(libs.aws.java.sdk.bom))
6363
// For the Resource Leak Checker's support for JavaEE.
64-
testImplementation("javax.servlet:javax.servlet-api:4.0.1")
64+
testImplementation(libs.javax.servlet.api)
6565
// For the Resource Leak Checker's support for IOUtils.
66-
testImplementation("commons-io:commons-io:2.21.0")
66+
testImplementation(libs.commons.io)
6767
// To test for an obscure crash in CFG construction for try-with-resources;
6868
// see https://github.com/typetools/checker-framework/issues/6396
69-
testImplementation("org.apache.spark:spark-sql_2.12:3.3.2")
69+
testImplementation(libs.spark.sql)
7070

71-
testImplementation("junit:junit:${junitVersion}")
71+
testImplementation(libs.junit)
7272
testImplementation(project(":framework-test"))
7373
testImplementation(sourceSets.testannotations.output)
7474

dataflow/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ dependencies {
88
api(project(":checker-qual"))
99

1010
// Node implements org.plumelib.util.UniqueId, so this dependency must be "api".
11-
api("org.plumelib:plume-util:${plumeUtilVersion}")
11+
api(libs.plume.util)
1212

13-
implementation("org.plumelib:hashmap-util:${hashmapUtilVersion}")
13+
implementation(libs.hashmap.util)
1414

15-
testImplementation("junit:junit:${junitVersion}")
15+
testImplementation(libs.junit)
1616

1717
// External dependencies:
1818
// If you add an external dependency, you must shadow its packages both in the dataflow-shaded

framework-test/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ sourceSets {
33
}
44

55
dependencies {
6-
implementation("junit:junit:${junitVersion}")
6+
implementation(libs.junit)
77
implementation(project(":javacutil"))
88
implementation(project(":checker-qual"))
99

10-
implementation("org.plumelib:plume-util:${plumeUtilVersion}")
10+
implementation(libs.plume.util)
1111
testImplementation(project(":framework"))
1212
}
1313

framework/build.gradle

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ def stubifierJar = tasks.register("stubifierJar", Jar) {
3838
dependencies {
3939
api(project(":javacutil"))
4040
api(project(":dataflow"))
41-
api("org.checkerframework:stubparser:3.27.1")
42-
stubifierImplementation("org.checkerframework:stubparser:3.27.1")
41+
api(libs.stubparser)
42+
stubifierImplementation(libs.stubparser)
4343
// This should be implementation sourceSets.stubifier.output, but that cause a failure in shadowJar.
4444
// This work around is from here: https://github.com/GradleUp/shadow/issues/1606#issuecomment-3164731141
4545
implementation(files(stubifierJar))
@@ -49,21 +49,21 @@ dependencies {
4949
// External dependencies:
5050
// If you add an external dependency, you must shadow its packages.
5151
// See the comment in ../build.gradle in the shadowJar block.
52-
implementation("org.plumelib:hashmap-util:${hashmapUtilVersion}")
53-
implementation("org.plumelib:plume-util:${plumeUtilVersion}")
54-
implementation("org.plumelib:reflection-util:${reflectionUtilVersion}")
55-
implementation("io.github.classgraph:classgraph:4.8.184")
52+
implementation(libs.hashmap.util)
53+
implementation(libs.plume.util)
54+
implementation(libs.reflection.util)
55+
implementation(libs.classgraph)
5656

57-
testImplementation("junit:junit:${junitVersion}")
57+
testImplementation(libs.junit)
5858
testImplementation(project(":framework-test"))
5959
testImplementation(sourceSets.testannotations.output)
6060

6161
// AutoValue support in Returns Receiver Checker
62-
testImplementation("com.google.auto.value:auto-value-annotations:${autoValueVersion}")
63-
testImplementation("com.google.auto.value:auto-value:${autoValueVersion}")
62+
testImplementation(libs.auto.value.annotations)
63+
testImplementation(libs.auto.value)
6464

6565
// Lombok support in Returns Receiver Checker
66-
testImplementation("org.projectlombok:lombok:${lombokVersion}")
66+
testImplementation(libs.lombok)
6767
}
6868

6969
tasks.register("cloneTypetoolsJdk", CloneTask) {

gradle.properties

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,3 @@ org.gradle.parallel=true
44

55
org.gradle.jvmargs=-Xmx4g -Dfile.encoding=UTF-8
66
org.gradle.caching=true
7-
8-
# If you update errorproneVersion:
9-
# * Temporarily comment out "-Werror" in build.gradle files.
10-
# * Repeatedly run `./gradlew clean compileJava` and fix all errors.
11-
# * Uncomment "-Werror".
12-
13-
autoValueVersion=1.11.1
14-
errorproneVersion=2.45.0
15-
googleJavaFormatVersion=1.30.0
16-
hashmapUtilVersion=0.0.1
17-
junitVersion=4.13.2
18-
lombokVersion=1.18.42
19-
plumeUtilVersion=1.12.3
20-
reflectionUtilVersion=1.1.5

gradle/libs.versions.toml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
[plugins]
2+
3+
com-gradleup-shadow = { id = "com.gradleup.shadow", version = "9.2.2" }
4+
5+
de-undercouch-download = { id = "de.undercouch.download", version = "5.6.0" }
6+
7+
net-ltgt-errorprone = { id = "net.ltgt.errorprone", version = "4.3.0" }
8+
9+
com-diffplug-spotless = { id = "com.diffplug.spotless", version = "8.0.0" }
10+
11+
com-gorylenko-gradle-git-properties = { id = "com.gorylenko.gradle-git-properties", version = "2.5.3" }
12+
13+
biz-aqute-bnd-builder = { id = "biz.aQute.bnd.builder", version = "7.1.0" }
14+
15+
[versions]
16+
17+
junit-junit = "4.13.2"
18+
19+
[libraries]
20+
21+
# If you update errorproneVersion:
22+
# * Temporarily comment out "-Werror" in build.gradle files.
23+
# * Repeatedly run `./gradlew clean compileJava` and fix all errors.
24+
# * Uncomment "-Werror".
25+
error-prone-core = "com.google.errorprone:error_prone_core:2.45.0"
26+
27+
javac = "com.google.errorprone:javac:9+181-r4173-1"
28+
29+
require-javadoc = "org.plumelib:require-javadoc:2.0.0"
30+
31+
error-prone-annotations = "com.google.errorprone:error_prone_annotations:2.45.0"
32+
33+
guava = "org.checkerframework.annotatedlib:guava:33.1.0.2-jre"
34+
35+
options = "org.plumelib:options:2.0.3"
36+
37+
plume-util = "org.plumelib:plume-util:1.12.3"
38+
39+
reflection-util = "org.plumelib:reflection-util:1.1.5"
40+
41+
asm = "org.ow2.asm:asm:9.9"
42+
43+
junit = { group = "junit", name = "junit", version.ref = "junit-junit" }
44+
45+
auto-value-annotations = "com.google.auto.value:auto-value-annotations:1.11.1"
46+
47+
auto-value = "com.google.auto.value:auto-value:1.11.1"
48+
49+
auto-value-parcel = "com.ryanharter.auto.value:auto-value-parcel:0.2.9"
50+
51+
lombok = "org.projectlombok:lombok:1.18.42"
52+
53+
aws-java-sdk-ec2 = { module = "com.amazonaws:aws-java-sdk-ec2" }
54+
55+
aws-java-sdk-kms = { module = "com.amazonaws:aws-java-sdk-kms" }
56+
57+
aws-java-sdk-bom = "com.amazonaws:aws-java-sdk-bom:1.12.794"
58+
59+
javax-servlet-api = "javax.servlet:javax.servlet-api:4.0.1"
60+
61+
commons-io = "commons-io:commons-io:2.21.0"
62+
63+
spark-sql = "org.apache.spark:spark-sql_2.12:3.3.2"
64+
65+
hashmap-util = "org.plumelib:hashmap-util:0.0.1"
66+
67+
stubparser = "org.checkerframework:stubparser:3.27.1"
68+
69+
classgraph = "io.github.classgraph:classgraph:4.8.184"
70+
71+
google-java-format = "com.google.googlejavaformat:google-java-format:1.30.0"

0 commit comments

Comments
 (0)