-
Notifications
You must be signed in to change notification settings - Fork 425
Use version catalog. #7381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Use version catalog. #7381
Conversation
📝 WalkthroughWalkthroughThis pull request migrates Gradle dependency management across the Checker Framework project from hardcoded version coordinates and properties to a centralized version catalog approach. The changes include: replacing plugin declarations with version catalog aliases in multiple build.gradle files, converting dependency coordinates to version catalog references throughout the project modules, removing version property definitions from gradle.properties, and adding a new gradle/libs.versions.toml file that consolidates all dependency versions and plugin definitions in one location. Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (1 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
build.gradle (1)
118-134: MigrategoogleJavaFormatVersionto version catalog and remove from gradle.properties.The
googleJavaFormatVersionvariable remains ingradle.properties(line 8) and has not been added togradle/libs.versions.toml, contradicting the PR's objective to centralize all versions in the catalog. This is actively used in build.gradle at lines 126, 353, and 356.Add
google-java-formattogradle/libs.versions.toml, removegoogleJavaFormatVersionfromgradle.properties, and update build.gradle to reference it from the catalog.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (11)
annotation-file-utilities/build.gradle(1 hunks)build.gradle(5 hunks)checker-qual/build.gradle(1 hunks)checker-util/build.gradle(1 hunks)checker/build.gradle(2 hunks)dataflow/build.gradle(1 hunks)framework-test/build.gradle(1 hunks)framework/build.gradle(2 hunks)gradle.properties(0 hunks)gradle/libs.versions.toml(1 hunks)javacutil/build.gradle(1 hunks)
💤 Files with no reviewable changes (1)
- gradle.properties
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-11-02T02:18:00.536Z
Learnt from: mernst
Repo: typetools/checker-framework PR: 7354
File: annotation-file-utilities/tests/LocalMultipleManyMethodsShifted.java:14-14
Timestamp: 2025-11-02T02:18:00.536Z
Learning: In the Checker Framework repository, when doing refactoring PRs (such as preferring isEmpty() over size() comparisons), test files should not be changed. Tests should remain stable to preserve their exact patterns for annotation processing and bytecode verification purposes.
Applied to files:
checker-util/build.gradle
🔇 Additional comments (15)
build.gradle (2)
1-20: Plugin declarations correctly migrated to version catalog aliases.The conversion from hardcoded plugin IDs to catalog aliases is properly formatted and follows Gradle's accessor naming conventions (kebab-case in TOML → dot notation in code).
210-211: Core dependency migrations correctly applied.All hardcoded dependency coordinates have been properly replaced with catalog references, and dependency exclusions are preserved. The comment on line 579 was updated in sync with the code change.
Also applies to: 578-579, 828-829, 960-965
checker-util/build.gradle (1)
9-9: Test dependency correctly migrated to catalog.The junit test dependency reference resolves to the version catalog entry that uses version 4.13.2.
javacutil/build.gradle (1)
14-16: Plumelib dependencies correctly migrated to catalog references.All three dependencies (hashmap-util, plume-util, reflection-util) are properly resolved through the version catalog.
framework-test/build.gradle (1)
6-6: Dependencies correctly migrated to version catalog.Both
libs.junitandlibs.plume.utilreferences resolve correctly through the catalog.Also applies to: 10-10
framework/build.gradle (1)
38-67: All framework dependencies correctly migrated to catalog.Ten dependency references have been properly converted and all catalog entries are defined and resolvable.
checker-qual/build.gradle (1)
3-3: Plugin declaration correctly migrated to catalog alias.The biz.aQute.bnd.builder plugin version (7.1.0) is preserved in the catalog and properly referenced via alias.
dataflow/build.gradle (1)
11-11: Dataflow dependencies correctly migrated to catalog.All three dependency references properly resolve through the version catalog, and the
apidesignation for plume-util (reflecting that it's used in the public API) is preserved.Also applies to: 13-13, 15-15
checker/build.gradle (6)
45-46: Verify dependency catalog entries exist.These utility libraries are core dependencies. Confirm the catalog entries
libs.reflection.utilandlibs.plume.utilare defined correctly.
53-56: Verify AutoValue and Lombok catalog entries.Confirm that all four dependencies are correctly defined in the catalog:
libs.auto.value.annotations,libs.auto.value,libs.auto.value.parcel, andlibs.lombok.
64-64: Verify javax.servlet, commons-io, and spark-sql catalog entries.Confirm these three test dependencies are correctly defined in the catalog:
libs.javax.servlet.api,libs.commons.io, andlibs.spark.sql.Also applies to: 66-66, 69-69
71-71: Verify junit catalog entry references correct artifact.Confirm that
libs.junitresolves to the correct JUnit library (likelyjunit:junitwith an appropriate version).
6-6: No issues found—plugin alias is correctly defined and used.The verification confirms the plugin alias
com-gorylenko-gradle-git-propertiesexists in the version catalog and is properly referenced in build.gradle using the correct Gradle convention (hyphens in the catalog key transform to dots in the alias path). The version is correctly maintained in the catalog entry.
59-62: AWS SDK BOM configuration is correctly set up.The catalog properly defines the BOM as a string module entry, and the ec2/kms artifacts intentionally lack versions in the catalog—they will be managed by the BOM imported via
platform(). This pattern aligns with Gradle best practices for managing dependency versions.annotation-file-utilities/build.gradle (1)
23-31: Verify all dependency catalog entries and Guava is annotated version.Confirm: (1) all six catalog entries exist—
libs.options,libs.plume.util,libs.reflection.util,libs.guava,libs.asm, andlibs.junit; (2)libs.guavaresolves to the checker-annotated library (org.checkerframework.annotatedlib:guava); and (3) consistency with identical entries in checker/build.gradle.
| ## Generated by adding the following to setting.gradle | ||
| ## plugins { | ||
| ## // See https://jmfayard.github.io/refreshVersions | ||
| ## id("de.fayard.refreshVersions") version "0.60.6" | ||
| ## } | ||
| ## and then running: | ||
| ## ./gradlew refreshVersionsMigrate --mode=VersionCatalogOnly | ||
|
|
||
| [plugins] | ||
|
|
||
| com-gradleup-shadow = { id = "com.gradleup.shadow", version = "9.2.2" } | ||
|
|
||
| de-undercouch-download = { id = "de.undercouch.download", version = "5.6.0" } | ||
|
|
||
| net-ltgt-errorprone = { id = "net.ltgt.errorprone", version = "4.3.0" } | ||
|
|
||
| com-diffplug-spotless = { id = "com.diffplug.spotless", version = "8.0.0" } | ||
|
|
||
| com-gorylenko-gradle-git-properties = { id = "com.gorylenko.gradle-git-properties", version = "2.5.3" } | ||
|
|
||
| biz-aqute-bnd-builder = { id = "biz.aQute.bnd.builder", version = "7.1.0" } | ||
|
|
||
| [versions] | ||
|
|
||
| junit-junit = "4.13.2" | ||
|
|
||
| [libraries] | ||
|
|
||
| # If you update errorproneVersion: | ||
| # * Temporarily comment out "-Werror" in build.gradle files. | ||
| # * Repeatedly run `./gradlew clean compileJava` and fix all errors. | ||
| # * Uncomment "-Werror". | ||
| error-prone-core = "com.google.errorprone:error_prone_core:2.44.0" | ||
|
|
||
| javac = "com.google.errorprone:javac:9+181-r4173-1" | ||
|
|
||
| require-javadoc = "org.plumelib:require-javadoc:2.0.0" | ||
|
|
||
| error-prone-annotations = "com.google.errorprone:error_prone_annotations:2.44.0" | ||
|
|
||
| guava = "org.checkerframework.annotatedlib:guava:33.1.0.2-jre" | ||
|
|
||
| options = "org.plumelib:options:2.0.3" | ||
|
|
||
| plume-util = "org.plumelib:plume-util:1.12.2" | ||
|
|
||
| reflection-util = "org.plumelib:reflection-util:1.1.5" | ||
|
|
||
| asm = "org.ow2.asm:asm:9.9" | ||
|
|
||
| junit = { group = "junit", name = "junit", version.ref = "junit-junit" } | ||
|
|
||
| auto-value-annotations = "com.google.auto.value:auto-value-annotations:1.11.1" | ||
|
|
||
| auto-value = "com.google.auto.value:auto-value:1.11.1" | ||
|
|
||
| auto-value-parcel = "com.ryanharter.auto.value:auto-value-parcel:0.2.9" | ||
|
|
||
| lombok = "org.projectlombok:lombok:1.18.42" | ||
|
|
||
| aws-java-sdk-ec2 = { module = "com.amazonaws:aws-java-sdk-ec2" } | ||
|
|
||
| aws-java-sdk-kms = { module = "com.amazonaws:aws-java-sdk-kms" } | ||
|
|
||
| aws-java-sdk-bom = "com.amazonaws:aws-java-sdk-bom:1.12.793" | ||
|
|
||
| javax-servlet-api = "javax.servlet:javax.servlet-api:4.0.1" | ||
|
|
||
| commons-io = "commons-io:commons-io:2.21.0" | ||
|
|
||
| spark-sql = "org.apache.spark:spark-sql_2.12:3.3.2" | ||
|
|
||
| hashmap-util = "org.plumelib:hashmap-util:0.0.1" | ||
|
|
||
| stubparser = "org.checkerframework:stubparser:3.27.1" | ||
|
|
||
| classgraph = "io.github.classgraph:classgraph:4.8.184" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Version catalog appears comprehensive but missing google-java-format library.
The catalog defines 6 plugins and 20+ libraries for the migration. However, build.gradle (lines 126, 353, 356) references googleJavaFormatVersion which is not defined in this catalog.
This library should either:
- Be added to the
[libraries]section (if version catalog migration is intended to be complete), or - Remain in
gradle.properties(if intentionally excluded from the catalog)
Additionally, some entries (com-gorylenko-gradle-git-properties, aws-*, spark-sql) appear unused in the provided files, suggesting the automatic migration captured the complete inventory. Verify whether google-java-format should have been migrated as well.
🌐 Web query:
What is the latest version of google-java-format as of November 2025?
💡 Result:
The latest google-java-format release as of November 14, 2025 is v1.32.0 (released Oct 28, 2025). [1][2]
Sources:
[1] GitHub Releases — google/google-java-format (v1.32.0).
[2] google-java-format repository README.
🏁 Script executed:
#!/bin/bash
# Verify google-java-format references in build.gradle
echo "=== Searching for googleJavaFormat references ==="
rg -n "googleJavaFormat" --type gradle -A2 -B2
echo ""
echo "=== Checking if google-java-format is in the version catalog ==="
grep -i "google-java-format\|googleJavaFormat" gradle/libs.versions.toml || echo "NOT FOUND in catalog"
echo ""
echo "=== Counting entries in [libraries] section ==="
grep -A500 "^\[libraries\]" gradle/libs.versions.toml | grep "=" | wc -lLength of output: 955
---
🏁 Script executed:
```shell
#!/bin/bash
# Find where googleJavaFormatVersion is defined
echo "=== Searching for googleJavaFormatVersion definition ==="
rg -n "googleJavaFormatVersion\s*=" --type gradle --type text -B1 -A1
echo ""
echo "=== Checking gradle.properties for version definitions ==="
if [ -f gradle.properties ]; then
echo "gradle.properties found:"
grep -n "Version\|version" gradle.properties | head -20
else
echo "gradle.properties not found at root"
fi
echo ""
echo "=== Checking if plugins section references spotless ==="
grep -i "spotless" gradle/libs.versions.toml
Length of output: 336
Add missing google-java-format library to the version catalog.
The library is actively used in build.gradle (lines 126, 353, 356) via googleJavaFormatVersion, but is currently defined only in gradle.properties (line 8 with version 1.30.0) rather than in the version catalog.
To complete the migration, add the following entry to the [libraries] section of gradle/libs.versions.toml:
google-java-format = "com.google.googlejavaformat:google-java-format:1.30.0"
Consider also updating to the latest version (1.32.0, released October 2025) if desired.
🤖 Prompt for AI Agents
In gradle/libs.versions.toml around lines 1-77, the version catalog is missing
the google-java-format library referenced from build.gradle; add a libraries
entry for google-java-format in the [libraries] section (use the current version
from gradle.properties, 1.30.0, or update to a newer version such as 1.32.0) so
build.gradle can reference googleJavaFormatVersion from the catalog.
| @@ -0,0 +1,77 @@ | |||
| ## Generated by adding the following to setting.gradle | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this comment
|
|
||
| autoValueVersion=1.11.1 | ||
| errorproneVersion=2.44.0 | ||
| googleJavaFormatVersion=1.30.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move back to main build file.
Gradle version catalogs are a way to manage versions of dependencies added in Gradle 7. The version numbers are stored in
gradle/libs.versions.toml. Renovate will update them (https://github.com/renovatebot/renovate/releases/tag/26.18.0). The nice thing about doing it this way is that this enables IDEs to provide autocompletion.I did the conversion mostly automatically using by doing the following:
Add the following to
setting.gradleand then running:
Then carefully review the diffs because it changed a few thing not unrelated to version numbers. (Plus I had to manually change the plugin versions.)