mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[build] Migrate to Gradle version catalogs (#8524)
Also fixes the google compile-testing library to 0.23.0 (the latest available at time of writing) instead of a wildcard Jackson versions were inconsistent across projects; most were on 2.19.2, but the fields subproject was on 2.15.2. All projects are now on 2.19.2 for consistency
This commit is contained in:
@@ -57,8 +57,8 @@ dependencies {
|
|||||||
implementation project(':wpiunits')
|
implementation project(':wpiunits')
|
||||||
implementation project(':wpiutil')
|
implementation project(':wpiutil')
|
||||||
annotationProcessor project(':epilogue-processor')
|
annotationProcessor project(':epilogue-processor')
|
||||||
implementation "org.openjdk.jmh:jmh-core:1.37"
|
implementation libs.jmh.core
|
||||||
annotationProcessor "org.openjdk.jmh:jmh-generator-annprocess:1.37"
|
annotationProcessor libs.jmh.annotationprocessor
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType(com.github.spotbugs.snom.SpotBugsTask).configureEach {
|
tasks.withType(com.github.spotbugs.snom.SpotBugsTask).configureEach {
|
||||||
|
|||||||
24
build.gradle
24
build.gradle
@@ -10,17 +10,23 @@ buildscript {
|
|||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'base'
|
id 'base'
|
||||||
id 'org.wpilib.WPILibVersioningPlugin' version '2027.0.1'
|
|
||||||
id 'org.wpilib.WPILibRepositoriesPlugin' version '2027.0.0'
|
|
||||||
id 'org.wpilib.NativeUtils' apply false
|
|
||||||
id 'org.wpilib.GradleJni' version '2027.0.0'
|
|
||||||
id 'org.wpilib.GradleVsCode'
|
|
||||||
id 'idea'
|
id 'idea'
|
||||||
id 'visual-studio'
|
id 'visual-studio'
|
||||||
id 'net.ltgt.errorprone' version '4.3.0' apply false
|
|
||||||
id 'com.gradleup.shadow' version '9.1.0' apply false
|
alias(libs.plugins.wpilib.versioning)
|
||||||
id 'com.diffplug.spotless' version '8.0.0' apply false
|
alias(libs.plugins.wpilib.repositories)
|
||||||
id 'com.github.spotbugs' version '6.4.2' apply false
|
// NativeUtils and GradleVsCode are on the classpath for buildSrc, which doesn't carry version information.
|
||||||
|
// We're forced to use the string-based syntax here instead.
|
||||||
|
id 'org.wpilib.NativeUtils' apply false
|
||||||
|
id 'org.wpilib.GradleVsCode' apply false
|
||||||
|
// alias(libs.plugins.wpilib.native.utils) apply false
|
||||||
|
// alias(libs.plugins.wpilib.gradle.vscode)
|
||||||
|
alias(libs.plugins.wpilib.gradle.jni)
|
||||||
|
|
||||||
|
alias(libs.plugins.build.shadow) apply false
|
||||||
|
alias(libs.plugins.lint.errorprone) apply false
|
||||||
|
alias(libs.plugins.lint.spotbugs) apply false
|
||||||
|
alias(libs.plugins.lint.spotless) apply false
|
||||||
}
|
}
|
||||||
|
|
||||||
wpilibVersioning.buildServerMode = project.hasProperty('buildServer')
|
wpilibVersioning.buildServerMode = project.hasProperty('buildServer')
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ repositories {
|
|||||||
url = "https://plugins.gradle.org/m2/"
|
url = "https://plugins.gradle.org/m2/"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation "org.wpilib:native-utils:2027.1.1"
|
implementation libs.wpilib.native.utils
|
||||||
|
implementation libs.wpilib.gradle.vscode
|
||||||
}
|
}
|
||||||
|
|||||||
7
buildSrc/settings.gradle
Normal file
7
buildSrc/settings.gradle
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
dependencyResolutionManagement {
|
||||||
|
versionCatalogs {
|
||||||
|
create("libs") {
|
||||||
|
from(files("../gradle/libs.versions.toml"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -31,7 +31,7 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.google.code.gson:gson:2.13.1'
|
implementation libs.gson
|
||||||
|
|
||||||
implementation project(':wpiutil')
|
implementation project(':wpiutil')
|
||||||
implementation project(':wpinet')
|
implementation project(':wpinet')
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ dependencies {
|
|||||||
implementation project(':wpilibj')
|
implementation project(':wpilibj')
|
||||||
implementation project(':wpiannotations')
|
implementation project(':wpiannotations')
|
||||||
api project(':datalog')
|
api project(':datalog')
|
||||||
testImplementation 'org.mockito:mockito-core:4.1.0'
|
testImplementation libs.bundles.mockito
|
||||||
annotationProcessor project(':javacPlugin')
|
annotationProcessor project(':javacPlugin')
|
||||||
testAnnotationProcessor project(':javacPlugin')
|
testAnnotationProcessor project(':javacPlugin')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,10 +25,10 @@ dependencies {
|
|||||||
implementation project(':hal')
|
implementation project(':hal')
|
||||||
implementation project(':wpimath')
|
implementation project(':wpimath')
|
||||||
implementation project(':wpilibj')
|
implementation project(':wpilibj')
|
||||||
api("us.hebi.quickbuf:quickbuf-runtime:1.4")
|
api(libs.quickbuf.runtime)
|
||||||
testAnnotationProcessor project(':javacPlugin')
|
testAnnotationProcessor project(':javacPlugin')
|
||||||
testAnnotationProcessor project(':epilogue-processor')
|
testAnnotationProcessor project(':epilogue-processor')
|
||||||
testImplementation 'org.mockito:mockito-core:4.1.0'
|
testImplementation(libs.bundles.mockito)
|
||||||
testImplementation project(':epilogue-runtime')
|
testImplementation project(':epilogue-runtime')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,5 +13,5 @@ dependencies {
|
|||||||
implementation(project(':epilogue-runtime'))
|
implementation(project(':epilogue-runtime'))
|
||||||
api project(':commandsv2')
|
api project(':commandsv2')
|
||||||
|
|
||||||
testImplementation 'com.google.testing.compile:compile-testing:+'
|
testImplementation libs.compile.testing
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,9 +14,7 @@ if (OperatingSystem.current().isWindows()) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation "com.fasterxml.jackson.core:jackson-annotations:2.15.2"
|
implementation libs.bundles.jackson
|
||||||
implementation "com.fasterxml.jackson.core:jackson-core:2.15.2"
|
|
||||||
implementation "com.fasterxml.jackson.core:jackson-databind:2.15.2"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
|
|||||||
53
gradle/libs.versions.toml
Normal file
53
gradle/libs.versions.toml
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
[versions]
|
||||||
|
ejml = "0.44.0"
|
||||||
|
jackson = "2.19.2"
|
||||||
|
jmh = "1.37"
|
||||||
|
opencv = "4.10.0-3"
|
||||||
|
thirdparty-year = "frc2025" # Note: this also appears in the opencv module name in the libraries section
|
||||||
|
quickbuf = "1.4"
|
||||||
|
|
||||||
|
[libraries]
|
||||||
|
# General runtime dependencies
|
||||||
|
ejml-simple = { module = "org.ejml:ejml-simple", version.ref = "ejml" } # also pulls in other EJML modules as transitive dependencies
|
||||||
|
gson = { module = "com.google.code.gson:gson", version = "2.13.1" }
|
||||||
|
jackson-annotations = { module = "com.fasterxml.jackson.core:jackson-annotations", version.ref = "jackson" }
|
||||||
|
jackson-core = { module = "com.fasterxml.jackson.core:jackson-core", version.ref = "jackson" }
|
||||||
|
jackson-databind = { module = "com.fasterxml.jackson.core:jackson-databind", version.ref = "jackson" }
|
||||||
|
quickbuf-runtime = { module = "us.hebi.quickbuf:quickbuf-runtime", version.ref = "quickbuf" }
|
||||||
|
thirdparty-opencv = { module = "edu.wpi.first.thirdparty.frc2025.opencv:opencv-java", version.ref = "opencv" }
|
||||||
|
|
||||||
|
# General test dependencies
|
||||||
|
compile-testing = { module = "com.google.testing.compile:compile-testing", version = "0.23.0" }
|
||||||
|
jmh-annotationprocessor = { module = "org.openjdk.jmh:jmh-generator-annprocess", version.ref = "jmh" }
|
||||||
|
jmh-core = { module = "org.openjdk.jmh:jmh-core", version.ref = "jmh" }
|
||||||
|
junit-api = { module = "org.junit.jupiter:junit-jupiter", version = "5.13.4" }
|
||||||
|
junit-launcher = { module = "org.junit.platform:junit-platform-launcher", version = "1.10.1" }
|
||||||
|
mockito-core = { module = "org.mockito:mockito-core", version = "4.1.0" }
|
||||||
|
|
||||||
|
# buildsrc dependencies
|
||||||
|
# Note that these are also Gradle plugins and cannot be used with the plugin specification
|
||||||
|
# due to their presence on the classpath without version information.
|
||||||
|
wpilib-gradle-vscode = { module = "org.wpilib:gradle-cpp-vscode", version = "2027.0.0" }
|
||||||
|
wpilib-native-utils = { module = "org.wpilib:native-utils", version = "2027.1.1" }
|
||||||
|
|
||||||
|
[bundles]
|
||||||
|
ejml = ["ejml-simple"]
|
||||||
|
jackson = ["jackson-annotations", "jackson-core", "jackson-databind"]
|
||||||
|
mockito = ["mockito-core"]
|
||||||
|
# junit api and launcher artifacts are different dependency types (implementation and runtime, respectively),
|
||||||
|
# so it doesn't make sense to bundle them in a single "junit" bundle
|
||||||
|
# Similar logic applies for JMH
|
||||||
|
|
||||||
|
[plugins]
|
||||||
|
build-shadow = { id = "com.gradleup.shadow", version = "9.1.0" }
|
||||||
|
lint-errorprone = { id = "net.ltgt.errorprone", version = "4.3.0" }
|
||||||
|
lint-spotbugs = { id = "com.github.spotbugs", version = "6.4.2" }
|
||||||
|
lint-spotless = { id = "com.diffplug.spotless", version = "8.0.0" }
|
||||||
|
|
||||||
|
wpilib-gradle-jni = { id = "org.wpilib.GradleJni", version = "2027.0.0" }
|
||||||
|
# Note: these plugins can't be used. Their JARs are on the classpath for buildSrc,
|
||||||
|
# which doesn't retain version information.
|
||||||
|
# wpilib-gradle-vscode = { id = "org.wpilib.GradleVsCode", version = "2027.0.0" }
|
||||||
|
# wpilib-native-utils = { id = "org.wpilib.NativeUtils", version = "2027.1.1" }
|
||||||
|
wpilib-repositories = { id = "org.wpilib.WPILibRepositoriesPlugin", version = "2027.0.0" }
|
||||||
|
wpilib-versioning = { id = "org.wpilib.WPILibVersioningPlugin", version = "2027.0.1" }
|
||||||
@@ -12,6 +12,6 @@ apply from: "${rootDir}/shared/java/javacommon.gradle"
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation project(':wpiannotations')
|
implementation project(':wpiannotations')
|
||||||
testImplementation 'com.google.testing.compile:compile-testing:+'
|
testImplementation libs.compile.testing
|
||||||
testImplementation project(':commandsv2')
|
testImplementation project(':commandsv2')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
import org.gradle.internal.os.OperatingSystem
|
|
||||||
|
|
||||||
nativeUtils.skipInstallPdb = project.hasProperty('buildServer')
|
nativeUtils.skipInstallPdb = project.hasProperty('buildServer')
|
||||||
|
|
||||||
if (project.hasProperty('ciDebugOnly')) {
|
if (project.hasProperty('ciDebugOnly')) {
|
||||||
@@ -12,8 +10,8 @@ nativeUtils.withCrossSystemCore()
|
|||||||
nativeUtils {
|
nativeUtils {
|
||||||
wpi {
|
wpi {
|
||||||
configureDependencies {
|
configureDependencies {
|
||||||
opencvYear = "frc2025"
|
opencvYear = libs.versions.thirdparty.year
|
||||||
opencvVersion = "4.10.0-3"
|
opencvVersion = libs.versions.opencv
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,8 +121,8 @@ tasks.withType(JavaCompile).configureEach {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
testImplementation 'org.junit.jupiter:junit-jupiter:5.13.4'
|
testImplementation libs.junit.api
|
||||||
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
testRuntimeOnly libs.junit.launcher
|
||||||
|
|
||||||
devImplementation sourceSets.main.output
|
devImplementation sourceSets.main.output
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
def opencvVersion = '4.10.0-3'
|
|
||||||
|
|
||||||
if (project.hasProperty('useCpp') && project.useCpp) {
|
if (project.hasProperty('useCpp') && project.useCpp) {
|
||||||
model {
|
model {
|
||||||
binaries {
|
binaries {
|
||||||
@@ -22,12 +20,12 @@ if (project.hasProperty('useCpp') && project.useCpp) {
|
|||||||
|
|
||||||
if (project.hasProperty('useJava') && project.useJava) {
|
if (project.hasProperty('useJava') && project.useJava) {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation "edu.wpi.first.thirdparty.frc2025.opencv:opencv-java:${opencvVersion}"
|
implementation libs.thirdparty.opencv
|
||||||
if (!project.hasProperty('skipDev') || !project.skipDev) {
|
if (!project.hasProperty('skipDev') || !project.skipDev) {
|
||||||
devImplementation "edu.wpi.first.thirdparty.frc2025.opencv:opencv-java:${opencvVersion}"
|
devImplementation libs.thirdparty.opencv
|
||||||
}
|
}
|
||||||
if (project.hasProperty('useDocumentation') && project.useDocumentation) {
|
if (project.hasProperty('useDocumentation') && project.useDocumentation) {
|
||||||
javaSource "edu.wpi.first.thirdparty.frc2025.opencv:opencv-java:${opencvVersion}:sources"
|
javaSource(variantOf(libs.thirdparty.opencv) { classifier("sources") })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ dependencies {
|
|||||||
implementation project(':cscore')
|
implementation project(':cscore')
|
||||||
api project(':datalog')
|
api project(':datalog')
|
||||||
implementation project(':cameraserver')
|
implementation project(':cameraserver')
|
||||||
testImplementation 'org.mockito:mockito-core:4.1.0'
|
testImplementation(libs.bundles.mockito)
|
||||||
devImplementation sourceSets.main.output
|
devImplementation sourceSets.main.output
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ dependencies {
|
|||||||
annotationProcessor project(':javacPlugin')
|
annotationProcessor project(':javacPlugin')
|
||||||
annotationProcessor project(':wpiannotations')
|
annotationProcessor project(':wpiannotations')
|
||||||
|
|
||||||
testImplementation 'org.junit.jupiter:junit-jupiter:5.13.4'
|
testImplementation libs.junit.api
|
||||||
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
testRuntimeOnly libs.junit.launcher
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prevent the eclipse compiler (used by the VS Code extension for intellisense and debugging)
|
// Prevent the eclipse compiler (used by the VS Code extension for intellisense and debugging)
|
||||||
|
|||||||
@@ -89,11 +89,9 @@ nativeUtils.exportsConfigs {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api project(":wpiunits")
|
api project(":wpiunits")
|
||||||
api "org.ejml:ejml-simple:0.44.0"
|
api libs.bundles.ejml
|
||||||
api "com.fasterxml.jackson.core:jackson-annotations:2.19.2"
|
api libs.bundles.jackson
|
||||||
api "com.fasterxml.jackson.core:jackson-core:2.19.2"
|
api libs.quickbuf.runtime
|
||||||
api "com.fasterxml.jackson.core:jackson-databind:2.19.2"
|
|
||||||
api "us.hebi.quickbuf:quickbuf-runtime:1.4"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets.main.java.srcDir "${projectDir}/src/generated/main/java"
|
sourceSets.main.java.srcDir "${projectDir}/src/generated/main/java"
|
||||||
|
|||||||
@@ -275,8 +275,6 @@ model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api "com.fasterxml.jackson.core:jackson-annotations:2.19.2"
|
api libs.bundles.jackson
|
||||||
api "com.fasterxml.jackson.core:jackson-core:2.19.2"
|
api libs.quickbuf.runtime
|
||||||
api "com.fasterxml.jackson.core:jackson-databind:2.19.2"
|
|
||||||
api 'us.hebi.quickbuf:quickbuf-runtime:1.4'
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user