diff --git a/build.gradle b/build.gradle index c0792d03f2..f772c89e32 100644 --- a/build.gradle +++ b/build.gradle @@ -21,6 +21,7 @@ apply from: "versioningHelper.gradle" ext { wpilibVersion = "2024.1.1-beta-3" + wpimathVersion = wpilibVersion openCVversion = "4.8.0-2" joglVersion = "2.4.0-rc-20200307" javalinVersion = "5.6.2" @@ -36,16 +37,11 @@ ext { if (nativeName == "macx64") nativeName = "osxx86-64"; if (nativeName == "macarm64") nativeName = "osxarm64"; jniPlatform = nativeName - println("Building for platform " + jniPlatform) + println("Building for platform: " + jniPlatform) + println("Using Wpilib: " + wpilibVersion) + println("Using OpenCV: " + openCVversion) } -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); - spotless { java { target fileTree('.') { diff --git a/photon-client/src/components/app/photon-camera-stream.vue b/photon-client/src/components/app/photon-camera-stream.vue index 13f3e75776..a836e4b362 100644 --- a/photon-client/src/components/app/photon-camera-stream.vue +++ b/photon-client/src/components/app/photon-camera-stream.vue @@ -8,7 +8,7 @@ import PvIcon from "@/components/common/pv-icon.vue"; const props = defineProps<{ streamType: "Raw" | "Processed"; - id?: string; + id: string; }>(); const streamSrc = computed(() => { @@ -25,8 +25,6 @@ const streamDesc = computed(() => `${props.streamType} Stream View`); const streamStyle = computed(() => { if (useStateStore().colorPickingMode) { return { width: "100%", cursor: "crosshair" }; - } else if (streamSrc.value !== loadingImage) { - return { width: "100%", cursor: "pointer" }; } return { width: "100%" }; @@ -40,11 +38,6 @@ const overlayStyle = computed(() => { } }); -const handleStreamClick = () => { - if (!useStateStore().colorPickingMode && streamSrc.value !== loadingImage) { - window.open(streamSrc.value); - } -}; const handleCaptureClick = () => { if (props.streamType === "Raw") { useCameraSettingsStore().saveInputSnapshot(); @@ -52,18 +45,19 @@ const handleCaptureClick = () => { useCameraSettingsStore().saveOutputSnapshot(); } }; +const handlePopoutClick = () => { + window.open(streamSrc.value); +}; +const handleFullscreenRequest = () => { + const stream = document.getElementById(props.id); + if (!stream) return; + stream.requestFullscreen(); +}; @@ -81,6 +87,7 @@ const handleCaptureClick = () => { } .stream-overlay { + display: flex; opacity: 0; transition: 0.1s ease; position: absolute; diff --git a/photon-client/src/components/cameras/CamerasView.vue b/photon-client/src/components/cameras/CamerasView.vue index f7c110cf62..1d52bfcf05 100644 --- a/photon-client/src/components/cameras/CamerasView.vue +++ b/photon-client/src/components/cameras/CamerasView.vue @@ -78,10 +78,20 @@ const fpsTooLow = computed(() => {
- +
- +
diff --git a/photon-core/build.gradle b/photon-core/build.gradle index 6fbf407797..d5de014915 100644 --- a/photon-core/build.gradle +++ b/photon-core/build.gradle @@ -1,38 +1,24 @@ -plugins { - id 'edu.wpi.first.WpilibTools' version '1.3.0' -} - import java.nio.file.Path apply from: "${rootDir}/shared/common.gradle" 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' - // JOGL stuff (currently we only distribute for aarch64, which is Pi 4) implementation "org.jogamp.gluegen:gluegen-rt:$joglVersion" implementation "org.jogamp.jogl:jogl-all:$joglVersion" - implementation "org.jogamp.gluegen:gluegen-rt:$joglVersion:natives-linux-aarch64" implementation "org.jogamp.jogl:jogl-all:$joglVersion:natives-linux-aarch64" // Zip implementation 'org.zeroturnaround:zt-zip:1.14' - implementation wpilibTools.deps.wpilibJava("apriltag") - implementation "org.xerial:sqlite-jdbc:3.41.0.0" } -task writeCurrentVersionJava { +task writeCurrentVersion { def versionFileIn = file("${rootDir}/shared/PhotonVersion.java.in") writePhotonVersionFile(versionFileIn, Path.of("$projectDir", "src", "main", "java", "org", "photonvision", "PhotonVersion.java"), versionString) } -build.dependsOn writeCurrentVersionJava +build.dependsOn writeCurrentVersion diff --git a/photon-core/src/main/java/org/photonvision/common/hardware/PiVersion.java b/photon-core/src/main/java/org/photonvision/common/hardware/PiVersion.java index dbf23ac7e4..86e63512fb 100644 --- a/photon-core/src/main/java/org/photonvision/common/hardware/PiVersion.java +++ b/photon-core/src/main/java/org/photonvision/common/hardware/PiVersion.java @@ -27,6 +27,7 @@ public enum PiVersion { ZERO_2_W("Raspberry Pi Zero 2"), PI_3("Pi 3"), PI_4("Pi 4"), + PI_5("Pi 5"), COMPUTE_MODULE_3("Compute Module 3"), UNKNOWN("UNKNOWN"); diff --git a/photon-lib/build.gradle b/photon-lib/build.gradle index e5d880fb4a..099308f470 100644 --- a/photon-lib/build.gradle +++ b/photon-lib/build.gradle @@ -9,54 +9,14 @@ import java.nio.file.Path ext { nativeName = "photonlib" includePhotonTargeting = true + // Include the generated Version file + generatedHeaders = "src/generate/native/include" } -apply from: "${rootDir}/shared/setupBuild.gradle" +apply from: "${rootDir}/shared/javacpp/setupBuild.gradle" apply from: "${rootDir}/versioningHelper.gradle" - -wpilibTools.deps.wpilibVersion = wpi.versions.wpilibVersion.get() - -def nativeConfigName = 'wpilibNatives' -def nativeConfig = configurations.create(nativeConfigName) - -def nativeTasks = wpilibTools.createExtractionTasks { - configurationName = nativeConfigName -} - -nativeTasks.addToSourceSetResources(sourceSets.main) - -nativeConfig.dependencies.add wpilibTools.deps.wpilib("wpimath") -nativeConfig.dependencies.add wpilibTools.deps.wpilib("wpinet") -nativeConfig.dependencies.add wpilibTools.deps.wpilib("wpiutil") -nativeConfig.dependencies.add wpilibTools.deps.wpilib("ntcore") -nativeConfig.dependencies.add wpilibTools.deps.wpilib("cscore") -nativeConfig.dependencies.add wpilibTools.deps.wpilib("apriltag") -nativeConfig.dependencies.add wpilibTools.deps.wpilib("hal") -nativeConfig.dependencies.add wpilibTools.deps.wpilibOpenCv("frc" + wpi.frcYear.get(), wpi.versions.opencvVersion.get()) - -dependencies { - implementation project(":photon-targeting") - - 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.wpilibOpenCvJava("frc" + wpi.frcYear.get(), 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(); -} - +// Include the version file in the distributed sources cppHeadersZip { from('src/generate/native/include') { into '/' @@ -66,8 +26,6 @@ cppHeadersZip { def photonlibFileInput = file("src/generate/photonlib.json.in") ext.photonlibFileOutput = file("$buildDir/generated/vendordeps/photonlib.json") -def vendorJson = artifacts.add('archives', file("$photonlibFileOutput")) - task generateVendorJson() { description = "Generates the vendor JSON file" group = "PhotonVision" @@ -103,18 +61,9 @@ task writeCurrentVersion { build.mustRunAfter writeCurrentVersion -model { - components { - all { - it.sources.each { - it.exportedHeaders { - srcDirs "src/main/native/include" - srcDirs "src/generate/native/include" - } - } - } - } +def vendorJson = artifacts.add('archives', file("$photonlibFileOutput")) +model { // Publish the vendordep json publishing { publications { diff --git a/photon-lib/src/main/driver/cpp/VendorJNI.cpp b/photon-lib/src/main/driver/cpp/VendorJNI.cpp deleted file mode 100644 index c449ee05c9..0000000000 --- a/photon-lib/src/main/driver/cpp/VendorJNI.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * MIT License - * - * Copyright (c) PhotonVision - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#include "com_vendor_jni_VendorJNI.h" -#include "jni.h" - -JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved) { - // Check to ensure the JNI version is valid - - JNIEnv* env; - if (vm->GetEnv(reinterpret_cast(&env), JNI_VERSION_1_6) != JNI_OK) - return JNI_ERR; - - // In here is also where you store things like class references - // if they are ever needed - - return JNI_VERSION_1_6; -} - -JNIEXPORT void JNICALL JNI_OnUnload(JavaVM* vm, void* reserved) {} - -/* - * Class: com_vendor_jni_VendorJNI - * Method: initialize - * Signature: ()I - */ -JNIEXPORT jint JNICALL -Java_com_vendor_jni_VendorJNI_initialize - (JNIEnv*, jclass) -{ - return 0; -} diff --git a/photon-lib/src/main/driver/cpp/driversource.cpp b/photon-lib/src/main/driver/cpp/driversource.cpp deleted file mode 100644 index 039fde6f8e..0000000000 --- a/photon-lib/src/main/driver/cpp/driversource.cpp +++ /dev/null @@ -1,29 +0,0 @@ -/* - * MIT License - * - * Copyright (c) PhotonVision - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#include "driverheader.h" - -extern "C" { -void c_doThing(void) {} -} // extern "C" diff --git a/photon-lib/src/main/driver/include/driverheader.h b/photon-lib/src/main/driver/include/driverheader.h deleted file mode 100644 index eb2a4de816..0000000000 --- a/photon-lib/src/main/driver/include/driverheader.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * MIT License - * - * Copyright (c) PhotonVision - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#pragma once - -extern "C" { -void c_doThing(void); -} // extern "C" diff --git a/photon-lib/src/main/driver/symbols.txt b/photon-lib/src/main/driver/symbols.txt deleted file mode 100644 index 2f9b64148a..0000000000 --- a/photon-lib/src/main/driver/symbols.txt +++ /dev/null @@ -1,4 +0,0 @@ -JNI_OnLoad -JNI_OnUnload -Java_com_vendor_jni_VendorJNI_initialize -c_doThing diff --git a/photon-server/build.gradle b/photon-server/build.gradle index 2fdfcff4ec..c60c441760 100644 --- a/photon-server/build.gradle +++ b/photon-server/build.gradle @@ -6,32 +6,20 @@ plugins { id 'edu.wpi.first.WpilibTools' version '1.3.0' } -evaluationDependsOn(':photon-core') - -mainClassName = 'org.photonvision.Main' - -group 'org.photonvision' -version versionString + (project.hasProperty('pionly') ? "-raspi" : "") - apply from: "${rootDir}/shared/common.gradle" dependencies { implementation project(':photon-core') - implementation project(':photon-targeting') - implementation "io.javalin:javalin:$javalinVersion" + // Needed for Javalin Runtime Logging implementation "org.slf4j:slf4j-simple:2.0.7" +} - implementation wpilibTools.deps.wpilibJava("wpiutil") - implementation wpilibTools.deps.wpilibJava("wpimath") - implementation wpilibTools.deps.wpilibJava("wpinet") - implementation wpilibTools.deps.wpilibJava("hal") - implementation wpilibTools.deps.wpilibJava("ntcore") - implementation wpilibTools.deps.wpilibJava("wpilibj") - implementation wpilibTools.deps.wpilibOpenCv("frc" + wpi.frcYear.get(), wpi.versions.opencvVersion.get()) +group 'org.photonvision' +version versionString + (project.hasProperty('pionly') ? "-raspi" : "") - implementation "org.msgpack:msgpack-core:0.9.0" - implementation "org.msgpack:jackson-dataformat-msgpack:0.9.0" +application { + mainClass = 'org.photonvision.Main' } shadowJar { @@ -43,7 +31,6 @@ shadowJar { ] } - node { nodeProjectDir = file("${projectDir}/../photon-client") } @@ -58,6 +45,10 @@ tasks.register("buildAndCopyUI") { finalizedBy "copyClientUIToResources" } +run { + environment "PATH_PREFIX", "../" +} + run { if (project.hasProperty("profile")) { jvmArgs=[ @@ -70,7 +61,6 @@ run { } } - remotes { pi { host = 'photonvision.local' @@ -119,10 +109,6 @@ task findDeployTarget { } } -run { - environment "PATH_PREFIX", "../" -} - task deploy { dependsOn findDeployTarget dependsOn assemble diff --git a/photon-server/src/main/java/org/photonvision/server/RequestHandler.java b/photon-server/src/main/java/org/photonvision/server/RequestHandler.java index 81f669c4c2..d277f2904f 100644 --- a/photon-server/src/main/java/org/photonvision/server/RequestHandler.java +++ b/photon-server/src/main/java/org/photonvision/server/RequestHandler.java @@ -89,8 +89,9 @@ public static void onSettingsImportRequest(Context ctx) { if (ConfigManager.saveUploadedSettingsZip(tempFilePath.get())) { ctx.status(200); - ctx.result("Successfully saved the uploaded settings zip"); - logger.info("Successfully saved the uploaded settings zip"); + ctx.result("Successfully saved the uploaded settings zip, rebooting"); + logger.info("Successfully saved the uploaded settings zip, rebooting"); + restartProgram(); } else { ctx.status(500); ctx.result("There was an error while saving the uploaded zip file"); diff --git a/photon-targeting/build.gradle b/photon-targeting/build.gradle index 6f91d82dc6..4238e951e6 100644 --- a/photon-targeting/build.gradle +++ b/photon-targeting/build.gradle @@ -6,45 +6,4 @@ ext { nativeName = "photontargeting" } -apply from: "${rootDir}/shared/setupBuild.gradle" - - -wpilibTools.deps.wpilibVersion = wpi.versions.wpilibVersion.get() - -def nativeConfigName = 'wpilibNatives' -def nativeConfig = configurations.create(nativeConfigName) - -def nativeTasks = wpilibTools.createExtractionTasks { - configurationName = nativeConfigName -} - -nativeTasks.addToSourceSetResources(sourceSets.main) - -nativeConfig.dependencies.add wpilibTools.deps.wpilib("wpimath") -nativeConfig.dependencies.add wpilibTools.deps.wpilib("wpinet") -nativeConfig.dependencies.add wpilibTools.deps.wpilib("wpiutil") -nativeConfig.dependencies.add wpilibTools.deps.wpilib("ntcore") -nativeConfig.dependencies.add wpilibTools.deps.wpilib("cscore") -nativeConfig.dependencies.add wpilibTools.deps.wpilib("apriltag") -nativeConfig.dependencies.add wpilibTools.deps.wpilib("hal") -nativeConfig.dependencies.add wpilibTools.deps.wpilibOpenCv("frc" + wpi.frcYear.get(), wpi.versions.opencvVersion.get()) - -dependencies { - 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.wpilibOpenCvJava("frc" + wpi.frcYear.get(), 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(); -} +apply from: "${rootDir}/shared/javacpp/setupBuild.gradle" diff --git a/shared/common.gradle b/shared/common.gradle index dc3331ff16..faeaa1f694 100644 --- a/shared/common.gradle +++ b/shared/common.gradle @@ -7,28 +7,22 @@ java { targetCompatibility = JavaVersion.VERSION_11 } -wpilibTools.deps.wpilibVersion = wpi.versions.wpilibVersion.get() +wpilibTools.deps.wpilibVersion = wpilibVersion -def nativeConfigName = 'wpilibTestNative' -def nativeConfig = configurations.create(nativeConfigName) +// 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); -def nativeTasks = wpilibTools.createExtractionTasks { - configurationName = nativeConfigName -} +dependencies { + implementation project(':photon-targeting') -nativeTasks.addToSourceSetResources(sourceSets.main) + implementation "io.javalin:javalin:$javalinVersion" -nativeConfig.dependencies.add wpilibTools.deps.wpilib("wpimath") -nativeConfig.dependencies.add wpilibTools.deps.wpilib("wpinet") -nativeConfig.dependencies.add wpilibTools.deps.wpilib("wpiutil") -nativeConfig.dependencies.add wpilibTools.deps.wpilib("ntcore") -nativeConfig.dependencies.add wpilibTools.deps.wpilib("cscore") -nativeConfig.dependencies.add wpilibTools.deps.wpilib("apriltag") -nativeConfig.dependencies.add wpilibTools.deps.wpilib("hal") -nativeConfig.dependencies.add wpilibTools.deps.wpilibOpenCv("frc" + wpi.frcYear.get(), wpi.versions.opencvVersion.get()) + implementation 'org.msgpack:msgpack-core:0.9.0' + implementation 'org.msgpack:jackson-dataformat-msgpack:0.9.0' -dependencies { - // WPILib deps implementation wpilibTools.deps.wpilibJava("wpiutil") implementation wpilibTools.deps.wpilibJava("cameraserver") implementation wpilibTools.deps.wpilibJava("cscore") @@ -40,25 +34,22 @@ dependencies { implementation wpilibTools.deps.wpilibJava("apriltag") implementation wpilibTools.deps.wpilibOpenCvJava("frc" + wpi.frcYear.get(), wpi.versions.opencvVersion.get()) - // Jackson 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() - // Apache commons - implementation group: "org.apache.commons", name: "commons-lang3", version: "3.12.0" - implementation group: "commons-io", name: "commons-io", version: "2.11.0" - implementation group: "commons-cli", name: "commons-cli", version: "1.5.0" - implementation "org.apache.commons:commons-collections4:4.4" - implementation "org.apache.commons:commons-exec:1.3" - 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(); - testImplementation("org.junit.jupiter:junit-jupiter:5.8.2") + implementation "commons-io:commons-io:2.11.0" + implementation "commons-cli:commons-cli:1.5.0" + implementation "org.apache.commons:commons-lang3:3.12.0" + implementation "org.apache.commons:commons-collections4:4.4" + implementation "org.apache.commons:commons-exec:1.3" - // wpilib serde - implementation 'us.hebi.quickbuf:quickbuf-runtime:1.3.2' + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.0' + testImplementation 'org.junit.jupiter:junit-jupiter-params:5.10.0' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.0' } test { diff --git a/shared/config.gradle b/shared/config.gradle index 43300e26cc..b3c7781c84 100644 --- a/shared/config.gradle +++ b/shared/config.gradle @@ -9,11 +9,12 @@ nativeUtils.withCrossLinuxArm64() // Configure WPI dependencies. nativeUtils.wpi.configureDependencies { wpiVersion = wpilibVersion + wpimathVersion = wpimathVersion opencvYear = 'frc2024' opencvVersion = openCVversion - googleTestYear = "frc2023" + googleTestYear = "frc2024" + googleTestVersion = "1.14.0-1" niLibVersion = "2024.1.1" - googleTestVersion = "1.12.1-2" } // Configure warnings and errors diff --git a/shared/javacommon.gradle b/shared/javacommon.gradle index 6792f61c73..c4e0ad3b56 100644 --- a/shared/javacommon.gradle +++ b/shared/javacommon.gradle @@ -97,7 +97,31 @@ test { finalizedBy jacocoTestReport } +wpilibTools.deps.wpilibVersion = wpi.versions.wpilibVersion.get() + dependencies { + if(project.hasProperty('includePhotonTargeting')) { + implementation project(":photon-targeting") + } + + 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.wpilibOpenCvJava("frc" + wpi.frcYear.get(), 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(); + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.0' testImplementation 'org.junit.jupiter:junit-jupiter-params:5.10.0' testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.0' diff --git a/shared/publish.gradle b/shared/javacpp/publish.gradle similarity index 100% rename from shared/publish.gradle rename to shared/javacpp/publish.gradle diff --git a/shared/setupBuild.gradle b/shared/javacpp/setupBuild.gradle similarity index 68% rename from shared/setupBuild.gradle rename to shared/javacpp/setupBuild.gradle index b90f87e154..66106c6057 100644 --- a/shared/setupBuild.gradle +++ b/shared/javacpp/setupBuild.gradle @@ -5,6 +5,26 @@ apply plugin: 'edu.wpi.first.NativeUtils' apply from: "${rootDir}/shared/config.gradle" apply from: "${rootDir}/shared/javacommon.gradle" +wpilibTools.deps.wpilibVersion = wpi.versions.wpilibVersion.get() + +def nativeConfigName = 'wpilibNatives' +def nativeConfig = configurations.create(nativeConfigName) + +def nativeTasks = wpilibTools.createExtractionTasks { + configurationName = nativeConfigName +} + +nativeTasks.addToSourceSetResources(sourceSets.main) + +nativeConfig.dependencies.add wpilibTools.deps.wpilib("wpimath") +nativeConfig.dependencies.add wpilibTools.deps.wpilib("wpinet") +nativeConfig.dependencies.add wpilibTools.deps.wpilib("wpiutil") +nativeConfig.dependencies.add wpilibTools.deps.wpilib("ntcore") +nativeConfig.dependencies.add wpilibTools.deps.wpilib("cscore") +nativeConfig.dependencies.add wpilibTools.deps.wpilib("apriltag") +nativeConfig.dependencies.add wpilibTools.deps.wpilib("hal") +nativeConfig.dependencies.add wpilibTools.deps.wpilibOpenCv("frc" + wpi.frcYear.get(), wpi.versions.opencvVersion.get()) + // Windows specific functionality to export all symbols from a binary automatically nativeUtils { exportsConfigs { @@ -23,6 +43,9 @@ model { } exportedHeaders { srcDirs 'src/main/native/include' + if (project.hasProperty('generatedHeaders')) { + srcDir generatedHeaders + } include "**/*.h" } } @@ -73,4 +96,4 @@ model { } } -apply from: "${rootDir}/shared/publish.gradle" +apply from: "${rootDir}/shared/javacpp/publish.gradle"