From 60c9ea8892f4d235e8148c3be25a345d44ac88e7 Mon Sep 17 00:00:00 2001 From: Matt M Date: Wed, 29 May 2024 10:16:12 -0400 Subject: [PATCH] Backport maven changes --- .github/workflows/build.yml | 109 +----------------- build.gradle | 17 ++- .../vision/pipe/impl/Calibrate3dPipe.java | 18 +-- .../src/generate/native/cpp/PhotonVersion.cpp | 34 ++++++ photonlib-cpp-examples/build.gradle | 2 +- photonlib-java-examples/build.gradle | 2 +- shared/javacommon.gradle | 2 +- shared/javacpp/publish.gradle | 2 +- 8 files changed, 61 insertions(+), 125 deletions(-) create mode 100644 photon-lib/src/generate/native/cpp/PhotonVersion.cpp diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dabd8e9cf4..933d4acce7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,7 +2,9 @@ name: Build on: push: - branches: [ master ] + branches: + - master + - backports/* tags: - 'v*' pull_request: @@ -336,108 +338,3 @@ jobs: # our image better have java installed already commands: | java -jar ${{ matrix.extraOpts }} *.jar --smoketest - - build-image: - needs: [build-package] - - if: ${{ github.event_name != 'pull_request' }} - - strategy: - fail-fast: false - matrix: - include: - - os: ubuntu-latest - artifact-name: LinuxArm64 - image_suffix: RaspberryPi - image_url: https://github.com/PhotonVision/photon-image-modifier/releases/download/v2024.0.4/photonvision_raspi.img.xz - cpu: cortex-a7 - image_additional_mb: 0 - - os: ubuntu-latest - artifact-name: LinuxArm64 - image_suffix: limelight2 - image_url: https://github.com/PhotonVision/photon-image-modifier/releases/download/v2024.0.4/photonvision_limelight.img.xz - cpu: cortex-a7 - image_additional_mb: 0 - - os: ubuntu-latest - artifact-name: LinuxArm64 - image_suffix: limelight3 - image_url: https://github.com/PhotonVision/photon-image-modifier/releases/download/v2024.0.5/photonvision_limelight3.img.xz - cpu: cortex-a7 - image_additional_mb: 0 - - os: ubuntu-latest - artifact-name: LinuxArm64 - image_suffix: orangepi5 - image_url: https://github.com/PhotonVision/photon-image-modifier/releases/download/v2024.0.10/photonvision_opi5.img.xz - cpu: cortex-a8 - image_additional_mb: 4096 - - os: ubuntu-latest - artifact-name: LinuxArm64 - image_suffix: orangepi5plus - image_url: https://github.com/PhotonVision/photon-image-modifier/releases/download/v2024.0.10/photonvision_opi5plus.img.xz - cpu: cortex-a8 - image_additional_mb: 4096 - - runs-on: ${{ matrix.os }} - name: "Build image - ${{ matrix.image_url }}" - - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - uses: actions/download-artifact@v4 - with: - name: jar-${{ matrix.artifact-name }} - - uses: pguyot/arm-runner-action@v2 - name: Generate image - id: generate_image - with: - base_image: ${{ matrix.image_url }} - image_additional_mb: ${{ matrix.image_additional_mb }} - optimize_image: yes - cpu: ${{ matrix.cpu }} - # We do _not_ wanna copy photon into the image. Bind mount instead - bind_mount_repository: true - commands: | - chmod +x scripts/armrunner.sh - ./scripts/armrunner.sh - - name: Compress image - run: | - new_jar=$(realpath $(find . -name photonvision\*-linuxarm64.jar)) - new_image_name=$(basename "${new_jar/.jar/_${{ matrix.image_suffix }}.img}") - mv ${{ steps.generate_image.outputs.image }} $new_image_name - sudo xz -T 0 -v $new_image_name - - uses: actions/upload-artifact@v4 - name: Upload image - with: - name: image-${{ matrix.image_suffix }} - path: photonvision*.xz - release: - needs: [build-package, build-image] - runs-on: ubuntu-22.04 - steps: - # Download literally every single artifact. This also downloads client and docs, - # but the filtering below won't pick these up (I hope) - - uses: actions/download-artifact@v4 - - run: find - # Push to dev release - - uses: pyTooling/Actions/releaser@r0 - with: - token: ${{ secrets.GITHUB_TOKEN }} - tag: 'Dev' - rm: true - files: | - **/*.xz - **/*.jar - **/photonlib*.json - if: github.event_name == 'push' - # Upload all jars and xz archives - - uses: softprops/action-gh-release@v1 - with: - files: | - **/*.xz - **/*.jar - **/photonlib*.json - if: startsWith(github.ref, 'refs/tags/v') - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/build.gradle b/build.gradle index a370546047..f0170fbf1e 100644 --- a/build.gradle +++ b/build.gradle @@ -13,8 +13,9 @@ allprojects { repositories { mavenCentral() mavenLocal() - maven { url = "https://maven.photonvision.org/repository/internal/" } - maven { url = "https://maven.photonvision.org/repository/snapshots/" } + maven { url = "https://maven.photonvision.org/releases" } + maven { url = "https://maven.photonvision.org/snapshots" } + maven { url = "https://jogamp.org/deployment/maven/" } } wpilibRepositories.addAllReleaseRepositories(it) wpilibRepositories.addAllDevelopmentRepositories(it) @@ -27,12 +28,12 @@ ext { wpilibVersion = "2024.3.2" wpimathVersion = wpilibVersion openCVversion = "4.8.0-2" - joglVersion = "2.4.0-rc-20200307" + joglVersion = "2.4.0" javalinVersion = "5.6.2" - photonGlDriverLibVersion = "dev-v2023.1.0-9-g75fc678" - rknnVersion = "dev-v2024.0.0-64-gc0836a6" + photonGlDriverLibVersion = "dev-v2023.1.0-11-g2b7036f" + rknnVersion = "dev-v2024.0.1-4-g0db16ac" frcYear = "2024" - mrcalVersion = "dev-v2024.0.0-18-gb903a09"; + mrcalVersion = "dev-v2024.0.0-24-gc1efcf0"; pubVersion = versionString @@ -50,6 +51,10 @@ ext { println("Building for platform " + jniPlatform + " wpilib: " + wpilibNativeName) println("Using Wpilib: " + wpilibVersion) println("Using OpenCV: " + openCVversion) + + + photonMavenURL = 'https://maven.photonvision.org/' + (isDev ? 'snapshots' : 'releases'); + println("Publishing Photonlib to " + photonMavenURL) } spotless { diff --git a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/Calibrate3dPipe.java b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/Calibrate3dPipe.java index 019ea176ee..2eae87f08c 100644 --- a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/Calibrate3dPipe.java +++ b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/Calibrate3dPipe.java @@ -189,15 +189,15 @@ protected CameraCalibrationCoefficients calibrateMrcal( int imageWidth = (int) in.get(0).size.width; int imageHeight = (int) in.get(0).size.height; - MrCalResult result = - MrCalJNI.calibrateCamera( - corner_locations, - params.boardWidth, - params.boardHeight, - params.squareSize, - imageWidth, - imageHeight, - (fxGuess + fyGuess) / 2.0); + MrCalResult result = null; + // MrCalJNI.calibrateCamera( + // corner_locations, + // params.boardWidth, + // params.boardHeight, + // params.squareSize, + // imageWidth, + // imageHeight, + // (fxGuess + fyGuess) / 2.0); // intrinsics are fx fy cx cy from mrcal JsonMatOfDouble cameraMatrixMat = diff --git a/photon-lib/src/generate/native/cpp/PhotonVersion.cpp b/photon-lib/src/generate/native/cpp/PhotonVersion.cpp new file mode 100644 index 0000000000..3bfcfdbbf4 --- /dev/null +++ b/photon-lib/src/generate/native/cpp/PhotonVersion.cpp @@ -0,0 +1,34 @@ +/* + * Copyright (C) Photon Vision. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include +#include + +/* + * Autogenerated file! Do not manually edit this file. This version is + * regenerated any time the publish task is run, or when this file is deleted. + */ + +static const char* dev_ = "dev"; + +namespace photon { + namespace PhotonVersion { + const char* versionString = "dev-v2024.3.1-22-g38e2fdef"; + const char* buildDate = "2024-5-29 10:05:11"; + const bool isRelease = strncmp(dev_, versionString, strlen(dev_)) != 0; + } +} diff --git a/photonlib-cpp-examples/build.gradle b/photonlib-cpp-examples/build.gradle index 0d262a1504..6404a00c56 100644 --- a/photonlib-cpp-examples/build.gradle +++ b/photonlib-cpp-examples/build.gradle @@ -6,7 +6,7 @@ allprojects { repositories { mavenCentral() mavenLocal() - maven { url = "https://maven.photonvision.org/repository/internal/" } + maven { url = "https://maven.photonvision.org/releases" } } } diff --git a/photonlib-java-examples/build.gradle b/photonlib-java-examples/build.gradle index 35f533e690..270e2ab600 100644 --- a/photonlib-java-examples/build.gradle +++ b/photonlib-java-examples/build.gradle @@ -8,7 +8,7 @@ allprojects { repositories { mavenCentral() mavenLocal() - maven { url = "https://maven.photonvision.org/repository/internal/" } + maven { url = "https://maven.photonvision.org/releases" } } } diff --git a/shared/javacommon.gradle b/shared/javacommon.gradle index 49a998e198..14ea2753d5 100644 --- a/shared/javacommon.gradle +++ b/shared/javacommon.gradle @@ -79,7 +79,7 @@ publishing { repositories { maven { - url ('https://maven.photonvision.org/repository/' + (isDev ? 'snapshots' : 'internal')) + url(photonMavenURL) credentials { username 'ghactions' password System.getenv("ARTIFACTORY_API_KEY") diff --git a/shared/javacpp/publish.gradle b/shared/javacpp/publish.gradle index 22389e2342..4a2ec250cb 100644 --- a/shared/javacpp/publish.gradle +++ b/shared/javacpp/publish.gradle @@ -70,7 +70,7 @@ model { repositories { maven { - url ('https://maven.photonvision.org/repository/' + (isDev ? 'snapshots' : 'internal')) + url(photonMavenURL) credentials { username 'ghactions' password System.getenv("ARTIFACTORY_API_KEY")