Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ target/
.java-version
build/
bin/
gradle/
gradle/*
!gradle/libs.versions.toml
gradlew
gradlew.bat
.idea/
Expand Down
6 changes: 3 additions & 3 deletions Configure.pl
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,10 @@ sub update_to_latest_versions {
}
}

# Update Gradle dependencies
# Update Gradle dependencies using version catalog
if (-f 'build.gradle') {
print "Updating Gradle dependencies to latest versions...\n";
my $gradle_output = `./gradlew useLatestVersions`;
print "Updating Gradle dependencies to latest versions using version catalog...\n";
my $gradle_output = `./gradlew versionCatalogUpdate`;
my $gradle_status = $? >> 8;
if ($gradle_status != 0) {
warn "Failed to update Gradle dependencies. Exit status: $gradle_status\n";
Expand Down
47 changes: 29 additions & 18 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,13 @@ buildscript {
// Core plugins configuration
plugins {
id 'java'
// Plugin for checking dependency updates
id 'com.github.ben-manes.versions' version '0.53.0'
// Plugin for automatically updating dependencies
id 'se.patrikerdes.use-latest-versions' version '0.2.19'
// Plugin for updating version catalog with latest versions (configuration cache compatible!)
alias(libs.plugins.version.catalog.update)
id 'application'
// Plugin for creating OS packages (deb)
id 'com.netflix.nebula.ospackage' version '12.1.1'
alias(libs.plugins.ospackage)
// Plugin for creating fat/uber JARs
id 'com.gradleup.shadow' version '9.3.0'
alias(libs.plugins.shadow)
}

// Main application class configuration
Expand Down Expand Up @@ -68,20 +66,20 @@ repositories {
// Project dependencies
dependencies {
// Core dependencies
implementation 'org.ow2.asm:asm:9.9' // ByteCode manipulation
implementation 'org.ow2.asm:asm-util:9.9' // ASM utilities
implementation 'com.ibm.icu:icu4j:78.1' // Unicode support
implementation 'com.alibaba.fastjson2:fastjson2:2.0.60' // JSON processing
implementation 'org.snakeyaml:snakeyaml-engine:3.0.1' // YAML processing
implementation 'org.tomlj:tomlj:1.1.1' // TOML processing
implementation 'org.apache.commons:commons-csv:1.14.1' // CSV processing
implementation 'net.java.dev.jna:jna:5.18.1' // Native access
implementation 'net.java.dev.jna:jna-platform:5.18.1' // Native access
implementation libs.asm // ByteCode manipulation
implementation libs.asm.util // ASM utilities
implementation libs.icu4j // Unicode support
implementation libs.fastjson2 // JSON processing
implementation libs.snakeyaml.engine // YAML processing
implementation libs.tomlj // TOML processing
implementation libs.commons.csv // CSV processing
implementation libs.jna // Native access
implementation libs.jna.platform // Native access

// Testing dependencies
testImplementation 'org.junit.jupiter:junit-jupiter-api:6.1.0-M1'
testImplementation 'org.junit.jupiter:junit-jupiter-engine:6.1.0-M1'
testImplementation 'org.junit.jupiter:junit-jupiter-params:6.1.0-M1'
testImplementation libs.junit.jupiter.api
testImplementation libs.junit.jupiter.engine
testImplementation libs.junit.jupiter.params
}

// JUnit configuration
Expand Down Expand Up @@ -220,3 +218,16 @@ tasks.register('testUnitParallel') {
description = 'Runs unit tests in parallel across multiple JVMs. Usage: gradle testUnitParallel --parallel'
dependsOn 'testUnitShard0', 'testUnitShard1', 'testUnitShard2', 'testUnitShard3'
}

// Version catalog update configuration
// The nl.littlerobots.version-catalog-update plugin is configuration cache compatible!
// Use: ./gradlew versionCatalogUpdate to check and update dependencies
// Use: ./gradlew versionCatalogUpdate --interactive to review changes interactively
versionCatalogUpdate {
// Sort the catalog keys
sortByKey = true
// Keep versions not used in the project
keep {
keepUnusedVersions = true
}
}
82 changes: 82 additions & 0 deletions dev/design/DEPENDENCY_UPDATES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Dependency Management Guide

This project uses **Gradle Version Catalogs** for centralized dependency management. All dependencies are defined in `gradle/libs.versions.toml`.

## Benefits of Version Catalogs

- **Centralized Management**: All versions in one place (`gradle/libs.versions.toml`)
- **Type-Safe**: IDE autocomplete for dependencies
- **Configuration Cache Compatible**: Works with Gradle's configuration cache for faster builds
- **Easy Updates**: Simple commands to check and update dependencies

## Available Tasks

### Check and Update Dependencies

```bash
# Check for updates and automatically update the version catalog
./gradlew versionCatalogUpdate
```

This will:
- Check all dependencies for newer versions
- Update `gradle/libs.versions.toml` with the latest versions
- Maintain proper formatting

### Interactive Mode

```bash
# Review each update interactively before applying
./gradlew versionCatalogUpdate --interactive
```

### Format Version Catalog

```bash
# Format the libs.versions.toml file (fully configuration cache compatible)
./gradlew versionCatalogFormat
```

## Version Catalog Location

All dependencies are defined in: `gradle/libs.versions.toml`

Structure:
- `[versions]` - Version numbers
- `[libraries]` - Library dependencies
- `[plugins]` - Gradle plugins

## Adding New Dependencies

1. Add the version to `[versions]` section
2. Add the library reference to `[libraries]` section
3. Use in `build.gradle` with: `implementation libs.library.name`

Example:
```toml
[versions]
gson = "2.10.1"

[libraries]
gson = { module = "com.google.code.gson:gson", version.ref = "gson" }
```

Then in `build.gradle`:
```groovy
dependencies {
implementation libs.gson
}
```

## Important Notes

- **Configuration Cache**: Fully compatible! No need to disable features
- **Review Changes**: Always review updates before committing
- **Test After Updates**: Run `./gradlew clean build test` after updating
- **Pin Versions**: Add `# @pin` comment in TOML to prevent auto-updates

## Migration Complete

✅ Migrated from `ben-manes.versions` + `use-latest-versions` to version catalogs
✅ Configuration cache now works with all tasks
✅ Cleaner, more maintainable dependency management
28 changes: 28 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[versions]
asm = "9.9.1"
commons-csv = "1.14.1"
fastjson2 = "2.0.60"
icu4j = "78.1"
jna = "5.18.1"
junit-jupiter = "6.1.0-M1"
snakeyaml-engine = "3.0.1"
tomlj = "1.1.1"

[libraries]
asm = { module = "org.ow2.asm:asm", version.ref = "asm" }
asm-util = { module = "org.ow2.asm:asm-util", version.ref = "asm" }
commons-csv = { module = "org.apache.commons:commons-csv", version.ref = "commons-csv" }
fastjson2 = { module = "com.alibaba.fastjson2:fastjson2", version.ref = "fastjson2" }
icu4j = { module = "com.ibm.icu:icu4j", version.ref = "icu4j" }
jna = { module = "net.java.dev.jna:jna", version.ref = "jna" }
jna-platform = { module = "net.java.dev.jna:jna-platform", version.ref = "jna" }
junit-jupiter-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "junit-jupiter" }
junit-jupiter-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "junit-jupiter" }
junit-jupiter-params = { module = "org.junit.jupiter:junit-jupiter-params", version.ref = "junit-jupiter" }
snakeyaml-engine = { module = "org.snakeyaml:snakeyaml-engine", version.ref = "snakeyaml-engine" }
tomlj = { module = "org.tomlj:tomlj", version.ref = "tomlj" }

[plugins]
ospackage = "com.netflix.nebula.ospackage:12.1.1"
shadow = "com.gradleup.shadow:9.3.0"
version-catalog-update = "nl.littlerobots.version-catalog-update:1.0.1"