mirror of
https://github.com/PhotonVision/photonvision
synced 2026-07-04 03:11:40 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
56e2da5504 | ||
|
|
587ac478f4 | ||
|
|
bad676f67c | ||
|
|
71128d1569 |
266
.github/workflows/build.yml
vendored
266
.github/workflows/build.yml
vendored
@@ -2,100 +2,14 @@ name: Build
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ master ]
|
branches:
|
||||||
|
- master
|
||||||
tags:
|
tags:
|
||||||
- 'v*'
|
- 'v*'
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ master ]
|
branches: [ master ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-client:
|
|
||||||
name: "PhotonClient Build"
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
working-directory: photon-client
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: Setup Node.js
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: 18
|
|
||||||
- name: Install Dependencies
|
|
||||||
run: npm ci
|
|
||||||
- name: Build Production Client
|
|
||||||
run: npm run build
|
|
||||||
- uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: built-client
|
|
||||||
path: photon-client/dist/
|
|
||||||
build-examples:
|
|
||||||
name: "Build Examples"
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
- name: Fetch tags
|
|
||||||
run: git fetch --tags --force
|
|
||||||
- name: Install Java 17
|
|
||||||
uses: actions/setup-java@v4
|
|
||||||
with:
|
|
||||||
java-version: 17
|
|
||||||
distribution: temurin
|
|
||||||
# Need to publish to maven local first, so that C++ sim can pick it up
|
|
||||||
# Still haven't figured out how to make the vendordep file be copied before trying to build examples
|
|
||||||
- name: Publish photonlib to maven local
|
|
||||||
run: |
|
|
||||||
chmod +x gradlew
|
|
||||||
./gradlew publishtomavenlocal -x check
|
|
||||||
- name: Build Java examples
|
|
||||||
working-directory: photonlib-java-examples
|
|
||||||
run: |
|
|
||||||
chmod +x gradlew
|
|
||||||
./gradlew copyPhotonlib -x check
|
|
||||||
./gradlew build -x check --max-workers 2
|
|
||||||
- name: Build C++ examples
|
|
||||||
working-directory: photonlib-cpp-examples
|
|
||||||
run: |
|
|
||||||
chmod +x gradlew
|
|
||||||
./gradlew copyPhotonlib -x check
|
|
||||||
./gradlew build -x check --max-workers 2
|
|
||||||
build-gradle:
|
|
||||||
name: "Gradle Build"
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
steps:
|
|
||||||
# Checkout code.
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
- name: Fetch tags
|
|
||||||
run: git fetch --tags --force
|
|
||||||
- name: Install Java 17
|
|
||||||
uses: actions/setup-java@v3
|
|
||||||
with:
|
|
||||||
java-version: 17
|
|
||||||
distribution: temurin
|
|
||||||
- name: Install mrcal deps
|
|
||||||
run: sudo apt-get update && sudo apt-get install -y libcholmod3 liblapack3 libsuitesparseconfig5
|
|
||||||
- name: Gradle Build
|
|
||||||
run: |
|
|
||||||
chmod +x gradlew
|
|
||||||
./gradlew build -x check --max-workers 2
|
|
||||||
- name: Gradle Tests
|
|
||||||
run: ./gradlew testHeadless -i --max-workers 1 --stacktrace
|
|
||||||
- name: Gradle Coverage
|
|
||||||
run: ./gradlew jacocoTestReport --max-workers 1
|
|
||||||
- name: Publish Coverage Report
|
|
||||||
uses: codecov/codecov-action@v3
|
|
||||||
with:
|
|
||||||
file: ./photon-server/build/reports/jacoco/test/jacocoTestReport.xml
|
|
||||||
- name: Publish Core Coverage Report
|
|
||||||
uses: codecov/codecov-action@v3
|
|
||||||
with:
|
|
||||||
file: ./photon-core/build/reports/jacoco/test/jacocoTestReport.xml
|
|
||||||
build-offline-docs:
|
build-offline-docs:
|
||||||
name: "Build Offline Docs"
|
name: "Build Offline Docs"
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
@@ -188,179 +102,3 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
ARTIFACTORY_API_KEY: ${{ secrets.ARTIFACTORY_API_KEY }}
|
ARTIFACTORY_API_KEY: ${{ secrets.ARTIFACTORY_API_KEY }}
|
||||||
if: github.event_name == 'push'
|
if: github.event_name == 'push'
|
||||||
build-package:
|
|
||||||
needs: [build-client, build-gradle, build-offline-docs]
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- os: windows-latest
|
|
||||||
artifact-name: Win64
|
|
||||||
architecture: x64
|
|
||||||
arch-override: none
|
|
||||||
- os: macos-latest
|
|
||||||
artifact-name: macOS
|
|
||||||
architecture: x64
|
|
||||||
arch-override: none
|
|
||||||
- os: ubuntu-latest
|
|
||||||
artifact-name: Linux
|
|
||||||
architecture: x64
|
|
||||||
arch-override: none
|
|
||||||
- os: macos-latest
|
|
||||||
artifact-name: macOSArm
|
|
||||||
architecture: x64
|
|
||||||
arch-override: macarm64
|
|
||||||
- os: ubuntu-latest
|
|
||||||
artifact-name: LinuxArm32
|
|
||||||
architecture: x64
|
|
||||||
arch-override: linuxarm32
|
|
||||||
- os: ubuntu-latest
|
|
||||||
artifact-name: LinuxArm64
|
|
||||||
architecture: x64
|
|
||||||
arch-override: linuxarm64
|
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
name: "Build fat JAR - ${{ matrix.artifact-name }}"
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
- name: Install Java 17
|
|
||||||
uses: actions/setup-java@v4
|
|
||||||
with:
|
|
||||||
java-version: 17
|
|
||||||
distribution: temurin
|
|
||||||
- run: |
|
|
||||||
rm -rf photon-server/src/main/resources/web/*
|
|
||||||
mkdir -p photon-server/src/main/resources/web/docs
|
|
||||||
if: ${{ (matrix.os) != 'windows-latest' }}
|
|
||||||
- run: |
|
|
||||||
del photon-server\src\main\resources\web\*.*
|
|
||||||
mkdir photon-server\src\main\resources\web\docs
|
|
||||||
if: ${{ (matrix.os) == 'windows-latest' }}
|
|
||||||
- uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: built-client
|
|
||||||
path: photon-server/src/main/resources/web/
|
|
||||||
- uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: built-docs
|
|
||||||
path: photon-server/src/main/resources/web/docs
|
|
||||||
- run: |
|
|
||||||
chmod +x gradlew
|
|
||||||
./gradlew photon-server:shadowJar --max-workers 2 -PArchOverride=${{ matrix.arch-override }}
|
|
||||||
if: ${{ (matrix.arch-override != 'none') }}
|
|
||||||
- run: |
|
|
||||||
chmod +x gradlew
|
|
||||||
./gradlew photon-server:shadowJar --max-workers 2
|
|
||||||
if: ${{ (matrix.arch-override == 'none') }}
|
|
||||||
- uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: jar-${{ matrix.artifact-name }}
|
|
||||||
path: photon-server/build/libs
|
|
||||||
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.9/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.9/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 }}
|
|
||||||
|
|||||||
86
.github/workflows/documentation.yml
vendored
86
.github/workflows/documentation.yml
vendored
@@ -1,86 +0,0 @@
|
|||||||
name: Documentation
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
# For now, run on all commits to master
|
|
||||||
branches: [ master ]
|
|
||||||
# and also all tags starting with v
|
|
||||||
tags:
|
|
||||||
- 'v*'
|
|
||||||
|
|
||||||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
pages: write
|
|
||||||
id-token: write
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-client:
|
|
||||||
name: "PhotonClient Build"
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
working-directory: photon-client
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: Setup Node.js
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: 18
|
|
||||||
- name: Install Dependencies
|
|
||||||
run: npm ci
|
|
||||||
- name: Build Production Client
|
|
||||||
run: npm run build-demo
|
|
||||||
- uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: built-client
|
|
||||||
path: photon-client/dist/
|
|
||||||
|
|
||||||
run_docs:
|
|
||||||
runs-on: "ubuntu-22.04"
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
- name: Fetch tags
|
|
||||||
run: git fetch --tags --force
|
|
||||||
- name: Install Java 17
|
|
||||||
uses: actions/setup-java@v3
|
|
||||||
with:
|
|
||||||
java-version: 17
|
|
||||||
distribution: temurin
|
|
||||||
|
|
||||||
- name: Build javadocs/doxygen
|
|
||||||
run: |
|
|
||||||
chmod +x gradlew
|
|
||||||
./gradlew docs:generateJavaDocs docs:doxygen
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: built-docs
|
|
||||||
path: docs/build/docs
|
|
||||||
|
|
||||||
release:
|
|
||||||
needs: [build-client, run_docs]
|
|
||||||
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
steps:
|
|
||||||
|
|
||||||
# Download literally every single artifact.
|
|
||||||
- uses: actions/download-artifact@v4
|
|
||||||
|
|
||||||
- run: find .
|
|
||||||
- name: copy file via ssh password
|
|
||||||
uses: appleboy/scp-action@v0.1.7
|
|
||||||
with:
|
|
||||||
host: ${{ secrets.WEBMASTER_SSH_HOST }}
|
|
||||||
username: ${{ secrets.WEBMASTER_SSH_USERNAME }}
|
|
||||||
password: ${{ secrets.WEBMASTER_SSH_KEY }}
|
|
||||||
port: ${{ secrets.WEBMASTER_SSH_PORT }}
|
|
||||||
source: "*"
|
|
||||||
target: /var/www/html/photonvision-docs/
|
|
||||||
88
.github/workflows/lint-format.yml
vendored
88
.github/workflows/lint-format.yml
vendored
@@ -1,88 +0,0 @@
|
|||||||
name: Lint and Format
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ master ]
|
|
||||||
tags:
|
|
||||||
- 'v*'
|
|
||||||
pull_request:
|
|
||||||
branches: [ master ]
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
wpiformat:
|
|
||||||
name: "wpiformat"
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- name: Fetch all history and metadata
|
|
||||||
run: |
|
|
||||||
git fetch --prune --unshallow
|
|
||||||
git checkout -b pr
|
|
||||||
git branch -f master origin/master
|
|
||||||
- name: Set up Python 3.8
|
|
||||||
uses: actions/setup-python@v4
|
|
||||||
with:
|
|
||||||
python-version: 3.8
|
|
||||||
- name: Install wpiformat
|
|
||||||
run: pip3 install wpiformat
|
|
||||||
- name: Run
|
|
||||||
run: wpiformat
|
|
||||||
- name: Check output
|
|
||||||
run: git --no-pager diff --exit-code HEAD
|
|
||||||
- name: Generate diff
|
|
||||||
run: git diff HEAD > wpiformat-fixes.patch
|
|
||||||
if: ${{ failure() }}
|
|
||||||
- uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: wpiformat fixes
|
|
||||||
path: wpiformat-fixes.patch
|
|
||||||
if: ${{ failure() }}
|
|
||||||
javaformat:
|
|
||||||
name: "Java Formatting"
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
- uses: actions/setup-java@v3
|
|
||||||
with:
|
|
||||||
java-version: 17
|
|
||||||
distribution: temurin
|
|
||||||
- run: |
|
|
||||||
chmod +x gradlew
|
|
||||||
./gradlew spotlessCheck
|
|
||||||
|
|
||||||
client-lint-format:
|
|
||||||
name: "PhotonClient Lint and Formatting"
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
working-directory: photon-client
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- name: Setup Node.js
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: 18
|
|
||||||
- name: Install Dependencies
|
|
||||||
run: npm ci
|
|
||||||
- name: Check Linting
|
|
||||||
run: npm run lint-ci
|
|
||||||
- name: Check Formatting
|
|
||||||
run: npm run format-ci
|
|
||||||
server-index:
|
|
||||||
name: "Check server index.html not changed"
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- name: Fetch all history and metadata
|
|
||||||
run: |
|
|
||||||
git fetch --prune --unshallow
|
|
||||||
git checkout -b pr
|
|
||||||
git branch -f master origin/master
|
|
||||||
- name: Check index.html not changed
|
|
||||||
run: git --no-pager diff --exit-code origin/master photon-server/src/main/resources/web/index.html
|
|
||||||
60
.github/workflows/python.yml
vendored
60
.github/workflows/python.yml
vendored
@@ -1,60 +0,0 @@
|
|||||||
name: Build and Distribute PhotonLibPy
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ master ]
|
|
||||||
tags:
|
|
||||||
- 'v*'
|
|
||||||
pull_request:
|
|
||||||
branches: [ master ]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
buildAndDeploy:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Set up Python
|
|
||||||
uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version: 3.11
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
python -m pip install --upgrade pip
|
|
||||||
pip install setuptools wheel pytest
|
|
||||||
|
|
||||||
- name: Build wheel
|
|
||||||
working-directory: ./photon-lib/py
|
|
||||||
run: |
|
|
||||||
python setup.py sdist bdist_wheel
|
|
||||||
|
|
||||||
- name: Run Unit Tests
|
|
||||||
working-directory: ./photon-lib/py
|
|
||||||
run: |
|
|
||||||
pip install --no-cache-dir dist/*.whl
|
|
||||||
pytest
|
|
||||||
|
|
||||||
|
|
||||||
- name: Upload artifacts
|
|
||||||
uses: actions/upload-artifact@master
|
|
||||||
with:
|
|
||||||
name: dist
|
|
||||||
path: ./photon-lib/py/dist/
|
|
||||||
|
|
||||||
- name: Publish package distributions to TestPyPI
|
|
||||||
# Only upload on tags
|
|
||||||
if: startsWith(github.ref, 'refs/tags/v')
|
|
||||||
uses: pypa/gh-action-pypi-publish@release/v1
|
|
||||||
with:
|
|
||||||
packages_dir: ./photon-lib/py/dist/
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
|
|
||||||
17
build.gradle
17
build.gradle
@@ -13,8 +13,9 @@ allprojects {
|
|||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
maven { url = "https://maven.photonvision.org/repository/internal/" }
|
maven { url = "https://maven.photonvision.org/releases" }
|
||||||
maven { url = "https://maven.photonvision.org/repository/snapshots/" }
|
maven { url = "https://maven.photonvision.org/snapshots" }
|
||||||
|
maven { url = "https://jogamp.org/deployment/maven/" }
|
||||||
}
|
}
|
||||||
wpilibRepositories.addAllReleaseRepositories(it)
|
wpilibRepositories.addAllReleaseRepositories(it)
|
||||||
wpilibRepositories.addAllDevelopmentRepositories(it)
|
wpilibRepositories.addAllDevelopmentRepositories(it)
|
||||||
@@ -27,12 +28,12 @@ ext {
|
|||||||
wpilibVersion = "2024.3.1"
|
wpilibVersion = "2024.3.1"
|
||||||
wpimathVersion = wpilibVersion
|
wpimathVersion = wpilibVersion
|
||||||
openCVversion = "4.8.0-2"
|
openCVversion = "4.8.0-2"
|
||||||
joglVersion = "2.4.0-rc-20200307"
|
joglVersion = "2.4.0"
|
||||||
javalinVersion = "5.6.2"
|
javalinVersion = "5.6.2"
|
||||||
photonGlDriverLibVersion = "dev-v2023.1.0-9-g75fc678"
|
photonGlDriverLibVersion = "dev-v2023.1.0-11-g2b7036f"
|
||||||
rknnVersion = "dev-v2024.0.0-64-gc0836a6"
|
rknnVersion = "dev-v2024.0.1-4-g0db16ac"
|
||||||
frcYear = "2024"
|
frcYear = "2024"
|
||||||
mrcalVersion = "dev-v2024.0.0-7-gc976aaa";
|
mrcalVersion = "dev-v2024.0.0-24-gc1efcf0";
|
||||||
|
|
||||||
|
|
||||||
pubVersion = versionString
|
pubVersion = versionString
|
||||||
@@ -50,6 +51,10 @@ ext {
|
|||||||
println("Building for platform " + jniPlatform + " wpilib: " + wpilibNativeName)
|
println("Building for platform " + jniPlatform + " wpilib: " + wpilibNativeName)
|
||||||
println("Using Wpilib: " + wpilibVersion)
|
println("Using Wpilib: " + wpilibVersion)
|
||||||
println("Using OpenCV: " + openCVversion)
|
println("Using OpenCV: " + openCVversion)
|
||||||
|
|
||||||
|
|
||||||
|
photonMavenURL = 'https://maven.photonvision.org/' + (isDev ? 'snapshots' : 'releases');
|
||||||
|
println("Publishing Photonlib to " + photonMavenURL)
|
||||||
}
|
}
|
||||||
|
|
||||||
spotless {
|
spotless {
|
||||||
|
|||||||
@@ -23,5 +23,6 @@ public enum LogGroup {
|
|||||||
VisionModule,
|
VisionModule,
|
||||||
Data,
|
Data,
|
||||||
General,
|
General,
|
||||||
Config
|
Config,
|
||||||
|
CSCore,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ public class Logger {
|
|||||||
levelMap.put(LogGroup.Data, LogLevel.INFO);
|
levelMap.put(LogGroup.Data, LogLevel.INFO);
|
||||||
levelMap.put(LogGroup.VisionModule, LogLevel.INFO);
|
levelMap.put(LogGroup.VisionModule, LogLevel.INFO);
|
||||||
levelMap.put(LogGroup.Config, LogLevel.INFO);
|
levelMap.put(LogGroup.Config, LogLevel.INFO);
|
||||||
|
levelMap.put(LogGroup.CSCore, LogLevel.TRACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
@@ -194,7 +195,7 @@ public class Logger {
|
|||||||
return logLevel.code <= levelMap.get(group).code;
|
return logLevel.code <= levelMap.get(group).code;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void log(String message, LogLevel level) {
|
void log(String message, LogLevel level) {
|
||||||
if (shouldLog(level)) {
|
if (shouldLog(level)) {
|
||||||
log(message, level, group, className);
|
log(message, level, group, className);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
* 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 <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.photonvision.common.logging;
|
||||||
|
|
||||||
|
import edu.wpi.first.cscore.CameraServerJNI;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
|
||||||
|
/** Redirect cscore logs to our logger */
|
||||||
|
public class PvCSCoreLogger {
|
||||||
|
private static PvCSCoreLogger INSTANCE;
|
||||||
|
|
||||||
|
public static PvCSCoreLogger getInstance() {
|
||||||
|
if (INSTANCE == null) {
|
||||||
|
INSTANCE = new PvCSCoreLogger();
|
||||||
|
}
|
||||||
|
return INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Logger logger;
|
||||||
|
|
||||||
|
private PvCSCoreLogger() {
|
||||||
|
CameraServerJNI.setLogger(this::logMsg, 7);
|
||||||
|
this.logger = new Logger(getClass(), LogGroup.CSCore);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void logMsg(int level, String file, int line, String msg) {
|
||||||
|
if (level == 20) {
|
||||||
|
logger.info(msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
file = Path.of(file).getFileName().toString();
|
||||||
|
|
||||||
|
String levelmsg;
|
||||||
|
LogLevel pvlevel;
|
||||||
|
if (level >= 50) {
|
||||||
|
levelmsg = "CRITICAL";
|
||||||
|
pvlevel = LogLevel.ERROR;
|
||||||
|
} else if (level >= 40) {
|
||||||
|
levelmsg = "ERROR";
|
||||||
|
pvlevel = LogLevel.ERROR;
|
||||||
|
} else if (level >= 30) {
|
||||||
|
levelmsg = "WARNING";
|
||||||
|
pvlevel = LogLevel.WARN;
|
||||||
|
} else if (level >= 20) {
|
||||||
|
levelmsg = "INFO";
|
||||||
|
pvlevel = LogLevel.INFO;
|
||||||
|
} else {
|
||||||
|
levelmsg = "DEBUG";
|
||||||
|
pvlevel = LogLevel.DEBUG;
|
||||||
|
}
|
||||||
|
logger.log(
|
||||||
|
"CS: " + levelmsg + " " + level + ": " + msg + " (" + file + ":" + line + ")", pvlevel);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -35,6 +35,7 @@ import org.photonvision.common.hardware.Platform;
|
|||||||
import org.photonvision.common.logging.LogGroup;
|
import org.photonvision.common.logging.LogGroup;
|
||||||
import org.photonvision.common.logging.LogLevel;
|
import org.photonvision.common.logging.LogLevel;
|
||||||
import org.photonvision.common.logging.Logger;
|
import org.photonvision.common.logging.Logger;
|
||||||
|
import org.photonvision.common.logging.PvCSCoreLogger;
|
||||||
import org.photonvision.common.networking.NetworkManager;
|
import org.photonvision.common.networking.NetworkManager;
|
||||||
import org.photonvision.common.util.TestUtils;
|
import org.photonvision.common.util.TestUtils;
|
||||||
import org.photonvision.common.util.numbers.IntegerCouple;
|
import org.photonvision.common.util.numbers.IntegerCouple;
|
||||||
@@ -65,6 +66,7 @@ public class Main {
|
|||||||
private static final boolean isRelease = PhotonVersion.isRelease;
|
private static final boolean isRelease = PhotonVersion.isRelease;
|
||||||
|
|
||||||
private static boolean isTestMode = false;
|
private static boolean isTestMode = false;
|
||||||
|
private static boolean isSmoketest = false;
|
||||||
private static Path testModeFolder = null;
|
private static Path testModeFolder = null;
|
||||||
private static boolean printDebugLogs;
|
private static boolean printDebugLogs;
|
||||||
|
|
||||||
@@ -90,6 +92,11 @@ public class Main {
|
|||||||
"clear-config",
|
"clear-config",
|
||||||
false,
|
false,
|
||||||
"Clears PhotonVision pipeline and networking settings. Preserves log files");
|
"Clears PhotonVision pipeline and networking settings. Preserves log files");
|
||||||
|
options.addOption(
|
||||||
|
"s",
|
||||||
|
"smoketest",
|
||||||
|
false,
|
||||||
|
"Exit Photon after loading native libraries and camera configs, but before starting up camera runners");
|
||||||
|
|
||||||
CommandLineParser parser = new DefaultParser();
|
CommandLineParser parser = new DefaultParser();
|
||||||
CommandLine cmd = parser.parse(options, args);
|
CommandLine cmd = parser.parse(options, args);
|
||||||
@@ -127,6 +134,10 @@ public class Main {
|
|||||||
if (cmd.hasOption("clear-config")) {
|
if (cmd.hasOption("clear-config")) {
|
||||||
ConfigManager.getInstance().clearConfig();
|
ConfigManager.getInstance().clearConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cmd.hasOption("smoketest")) {
|
||||||
|
isSmoketest = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -337,11 +348,17 @@ public class Main {
|
|||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
try {
|
try {
|
||||||
TestUtils.loadLibraries();
|
boolean success = TestUtils.loadLibraries();
|
||||||
logger.info("Native libraries loaded.");
|
|
||||||
|
if (!success) {
|
||||||
|
logger.error("Failed to load native libraries! Giving up :(");
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("Failed to load native libraries!", e);
|
logger.error("Failed to load native libraries!", e);
|
||||||
|
System.exit(1);
|
||||||
}
|
}
|
||||||
|
logger.info("Native libraries loaded.");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (Platform.isRaspberryPi()) {
|
if (Platform.isRaspberryPi()) {
|
||||||
@@ -393,6 +410,8 @@ public class Main {
|
|||||||
+ Platform.getPlatformName()
|
+ Platform.getPlatformName()
|
||||||
+ (Platform.isRaspberryPi() ? (" (Pi " + PiVersion.getPiVersion() + ")") : ""));
|
+ (Platform.isRaspberryPi() ? (" (Pi " + PiVersion.getPiVersion() + ")") : ""));
|
||||||
|
|
||||||
|
PvCSCoreLogger.getInstance();
|
||||||
|
|
||||||
logger.debug("Loading ConfigManager...");
|
logger.debug("Loading ConfigManager...");
|
||||||
ConfigManager.getInstance().load(); // init config manager
|
ConfigManager.getInstance().load(); // init config manager
|
||||||
ConfigManager.getInstance().requestSave();
|
ConfigManager.getInstance().requestSave();
|
||||||
@@ -412,6 +431,11 @@ public class Main {
|
|||||||
NeuralNetworkModelManager.getInstance()
|
NeuralNetworkModelManager.getInstance()
|
||||||
.initialize(ConfigManager.getInstance().getModelsDirectory());
|
.initialize(ConfigManager.getInstance().getModelsDirectory());
|
||||||
|
|
||||||
|
if (isSmoketest) {
|
||||||
|
logger.info("PhotonVision base functionality loaded -- smoketest complete");
|
||||||
|
System.exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
if (!isTestMode) {
|
if (!isTestMode) {
|
||||||
logger.debug("Loading VisionSourceManager...");
|
logger.debug("Loading VisionSourceManager...");
|
||||||
VisionSourceManager.getInstance()
|
VisionSourceManager.getInstance()
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ allprojects {
|
|||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
maven { url = "https://maven.photonvision.org/repository/internal/" }
|
maven { url = "https://maven.photonvision.org/releases" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ allprojects {
|
|||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
maven { url = "https://maven.photonvision.org/repository/internal/" }
|
maven { url = "https://maven.photonvision.org/releases" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ publishing {
|
|||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
url ('https://maven.photonvision.org/repository/' + (isDev ? 'snapshots' : 'internal'))
|
url(photonMavenURL)
|
||||||
credentials {
|
credentials {
|
||||||
username 'ghactions'
|
username 'ghactions'
|
||||||
password System.getenv("ARTIFACTORY_API_KEY")
|
password System.getenv("ARTIFACTORY_API_KEY")
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ model {
|
|||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
url ('https://maven.photonvision.org/repository/' + (isDev ? 'snapshots' : 'internal'))
|
url(photonMavenURL)
|
||||||
credentials {
|
credentials {
|
||||||
username 'ghactions'
|
username 'ghactions'
|
||||||
password System.getenv("ARTIFACTORY_API_KEY")
|
password System.getenv("ARTIFACTORY_API_KEY")
|
||||||
|
|||||||
Reference in New Issue
Block a user