mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-19 00:41:41 +00:00
## Description Update to use our fork of the WPILib tool plugin. WPILib has indicated that it won't be maintained past 2026, so we're forking it under our org. We also fixed a bug that results in native libraries for multiple platforms being included in a jar when only the native libraries for the platform being built should be included. ## 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 v2025.3.2 - [ ] 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: Gold856 <117957790+Gold856@users.noreply.github.com> Co-authored-by: samfreund <samf.236@proton.me>
86 lines
3.1 KiB
Groovy
86 lines
3.1 KiB
Groovy
apply plugin: 'org.photonvision.tools.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
|