mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-19 00:41:41 +00:00
Fix numerous places where using AutoCloseable objects without closing them. Changes: - Upgrade JUnit from 5.10.0 to 5.11.4 (so `@AutoClose` can be used) - Use `Files.copy()` to copy files - Use try-with-resources when calling `Files.list()` or `Files.walk()` - Use try-with-resources or `@AutoClose` to close `PhotonCamera` and `PhotonCameraSim` objects created by tests - Update `SQLConfigTest` to use `@TempDir` ## Meta Merge checklist: - [x] Pull Request title is [short, imperative summary](https://cbea.ms/git-commit/) of proposed changes - [x] The description documents the _what_ and _why_ - [ ] If this PR changes behavior or adds a feature, user documentation is updated - [ ] If this PR touches photon-serde, all messages have been regenerated and hashes have not changed unexpectedly - [ ] If this PR touches configuration, this is backwards compatible with settings back to v2024.3.1 - [ ] If this PR touches pipeline settings or anything related to data exchange, the frontend typing is updated - [ ] If this PR addresses a bug, a regression test for it is added
99 lines
3.5 KiB
Groovy
99 lines
3.5 KiB
Groovy
// Plugins
|
|
apply plugin: "java"
|
|
apply plugin: "jacoco"
|
|
|
|
java {
|
|
sourceCompatibility = JavaVersion.VERSION_17
|
|
targetCompatibility = JavaVersion.VERSION_17
|
|
}
|
|
|
|
wpilibTools.deps.wpilibVersion = wpilibVersion
|
|
|
|
// Tell gradlerio what version of things to use (that we care about)
|
|
// See: https://github.com/wpilibsuite/GradleRIO/blob/main/src/main/java/edu/wpi/first/gradlerio/wpi/WPIVersionsExtension.java
|
|
wpi.getVersions().getOpencvVersion().convention(openCVversion);
|
|
wpi.getVersions().getWpilibVersion().convention(wpilibVersion);
|
|
wpi.getVersions().getWpimathVersion().convention(wpimathVersion);
|
|
|
|
dependencies {
|
|
implementation project(':photon-targeting')
|
|
|
|
implementation "io.javalin:javalin:$javalinVersion"
|
|
|
|
implementation 'org.msgpack:msgpack-core:0.9.0'
|
|
implementation 'org.msgpack:jackson-dataformat-msgpack:0.9.0'
|
|
|
|
implementation wpilibTools.deps.wpilibJava("wpiutil")
|
|
implementation wpilibTools.deps.wpilibJava("cameraserver")
|
|
implementation wpilibTools.deps.wpilibJava("cscore")
|
|
implementation wpilibTools.deps.wpilibJava("wpinet")
|
|
implementation wpilibTools.deps.wpilibJava("wpimath")
|
|
implementation wpilibTools.deps.wpilibJava("ntcore")
|
|
implementation wpilibTools.deps.wpilibJava("hal")
|
|
implementation wpilibTools.deps.wpilibJava("wpilibj")
|
|
implementation wpilibTools.deps.wpilibJava("apriltag")
|
|
implementation wpilibTools.deps.wpilibJava("wpiunits")
|
|
implementation wpilibTools.deps.wpilibOpenCvJava("frc" + openCVYear, wpi.versions.opencvVersion.get())
|
|
|
|
implementation group: "com.fasterxml.jackson.core", name: "jackson-annotations", version: wpi.versions.jacksonVersion.get()
|
|
implementation group: "com.fasterxml.jackson.core", name: "jackson-core", version: wpi.versions.jacksonVersion.get()
|
|
implementation group: "com.fasterxml.jackson.core", name: "jackson-databind", version: wpi.versions.jacksonVersion.get()
|
|
|
|
implementation group: "org.ejml", name: "ejml-simple", version: wpi.versions.ejmlVersion.get()
|
|
implementation group: "us.hebi.quickbuf", name: "quickbuf-runtime", version: wpi.versions.quickbufVersion.get();
|
|
|
|
implementation "commons-io:commons-io:2.11.0"
|
|
implementation "commons-cli:commons-cli:1.5.0"
|
|
implementation "org.apache.commons:commons-exec:1.3"
|
|
|
|
testImplementation(platform('org.junit:junit-bom:5.11.4'))
|
|
testImplementation 'org.junit.jupiter:junit-jupiter-api'
|
|
testImplementation 'org.junit.jupiter:junit-jupiter-params'
|
|
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
|
|
}
|
|
|
|
test {
|
|
useJUnitPlatform()
|
|
testLogging {
|
|
events "passed", "skipped", "failed", "standardOut", "standardError"
|
|
}
|
|
workingDir = new File("${rootDir}")
|
|
finalizedBy jacocoTestReport
|
|
}
|
|
|
|
tasks.register('testHeadless', Test) {
|
|
group = "verification"
|
|
systemProperty("java.awt.headless", "true")
|
|
useJUnitPlatform()
|
|
testLogging {
|
|
events "passed", "skipped", "failed", "standardOut", "standardError"
|
|
exceptionFormat "full"
|
|
showStandardStreams = true
|
|
}
|
|
exclude '**/*BenchmarkTest*'
|
|
workingDir = "../"
|
|
}
|
|
|
|
jacoco {
|
|
toolVersion = "0.8.10"
|
|
reportsDirectory = layout.buildDirectory.dir('customJacocoReportDir')
|
|
}
|
|
|
|
jacocoTestReport {
|
|
dependsOn testHeadless
|
|
|
|
reports {
|
|
xml.required = true
|
|
csv.required = false
|
|
html.outputLocation = layout.buildDirectory.dir('jacocoHtml')
|
|
}
|
|
|
|
afterEvaluate {
|
|
classDirectories.setFrom(files(classDirectories.files.collect {
|
|
fileTree(dir: it,
|
|
exclude: "edu/wpi/**"
|
|
)
|
|
}))
|
|
}
|
|
}
|