mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-21 01:01:41 +00:00
## Description [OSHI](https://github.com/oshi/oshi) is a free (MIT license) JNA-based library for accessing hardware and system performance information. This PR includes a re-write of the metrics monitoring code to be based on OSHI. The original intent was to gain access to data about network traffic for addition to the Settings tab. An additional benefit is that collecting the data is now around two orders of magnitude (or more) faster! ## 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 - [x] If this PR touches configuration, this is backwards compatible with settings back to v2025.3.2 - [x] 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 --------- Co-authored-by: samfreund <samf.236@proton.me>
86 lines
3.1 KiB
Groovy
86 lines
3.1 KiB
Groovy
apply plugin: 'edu.wpi.first.WpilibTools'
|
|
|
|
import java.nio.file.Path
|
|
|
|
ext.licenseFile = file("$rootDir/LICENSE")
|
|
apply from: "${rootDir}/shared/common.gradle"
|
|
|
|
wpilibTools.deps.wpilibVersion = wpi.versions.wpilibVersion.get()
|
|
|
|
def nativeConfigName = 'wpilibNatives'
|
|
configurations {
|
|
wpilibNatives
|
|
}
|
|
def nativeTasks = wpilibTools.createExtractionTasks {
|
|
configurationName = nativeConfigName
|
|
}
|
|
|
|
nativeTasks.addToSourceSetResources(sourceSets.main)
|
|
|
|
dependencies {
|
|
wpilibNatives project(path: ':photon-targeting', configuration: 'wpilibNatives')
|
|
wpilibNatives wpilibTools.deps.wpilib("wpimath")
|
|
wpilibNatives wpilibTools.deps.wpilib("wpinet")
|
|
wpilibNatives wpilibTools.deps.wpilib("wpiutil")
|
|
wpilibNatives wpilibTools.deps.wpilib("ntcore")
|
|
wpilibNatives wpilibTools.deps.wpilib("cscore")
|
|
wpilibNatives wpilibTools.deps.wpilib("apriltag")
|
|
wpilibNatives wpilibTools.deps.wpilib("hal")
|
|
wpilibNatives wpilibTools.deps.wpilibOpenCv("frc" + openCVYear, wpi.versions.opencvVersion.get())
|
|
|
|
// These stay as implementation dependencies since they don't have native code that gets packaged
|
|
implementation 'org.zeroturnaround:zt-zip:1.14'
|
|
implementation "org.xerial:sqlite-jdbc:3.41.0.0"
|
|
implementation 'com.diozero:diozero-core:1.4.1'
|
|
implementation 'com.github.oshi:oshi-core:6.9.1'
|
|
|
|
// The JNI libraries use wpilibNatives, the java libraries use implementation
|
|
if (jniPlatform == "linuxarm64") {
|
|
wpilibNatives("org.photonvision:rknn_jni-jni:$rknnVersion:$wpilibNativeName") {
|
|
transitive = false
|
|
}
|
|
wpilibNatives("org.photonvision:rubik_jni-jni:$rubikVersion:$wpilibNativeName") {
|
|
transitive = false
|
|
}
|
|
wpilibNatives("org.photonvision:photon-libcamera-gl-driver-jni:$libcameraDriverVersion:$wpilibNativeName") {
|
|
transitive = false
|
|
}
|
|
}
|
|
|
|
implementation("org.photonvision:rknn_jni-java:$rknnVersion") {
|
|
transitive = false
|
|
}
|
|
|
|
implementation("org.photonvision:rubik_jni-java:$rubikVersion") {
|
|
transitive = false
|
|
}
|
|
|
|
implementation "org.photonvision:photon-libcamera-gl-driver-java:$libcameraDriverVersion"
|
|
|
|
implementation "org.photonvision:photon-mrcal-java:$mrcalVersion"
|
|
|
|
// Only include mrcal natives on platforms that we build for
|
|
if (!(jniPlatform in [
|
|
"osxx86-64",
|
|
"osxarm64"
|
|
])) {
|
|
wpilibNatives("org.photonvision:photon-mrcal-jni:$mrcalVersion:$wpilibNativeName") {
|
|
transitive = false
|
|
}
|
|
}
|
|
|
|
testImplementation group: 'org.junit-pioneer' , name: 'junit-pioneer', version: '2.2.0'
|
|
}
|
|
|
|
task writeCurrentVersion {
|
|
doLast {
|
|
def versionFileIn = file("${rootDir}/shared/PhotonVersion.java.in")
|
|
writePhotonVersionFile(versionFileIn, Path.of("$buildDir", "generated", "java", "org", "photonvision", "PhotonVersion.java"),
|
|
versionString)
|
|
}
|
|
}
|
|
// https://github.com/wpilibsuite/allwpilib/blob/main/wpilibj/build.gradle#L52
|
|
sourceSets.main.java.srcDir "${buildDir}/generated/java/"
|
|
|
|
compileJava.dependsOn writeCurrentVersion
|