Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
0210740
detections work
TheTripleV Dec 29, 2025
4af212d
zero copy
TheTripleV Dec 29, 2025
2c45546
cleanup stale dylibs before build
TheTripleV Dec 29, 2025
d3bbc35
fix building on non-mac?
TheTripleV Dec 29, 2025
f28c436
format
TheTripleV Dec 29, 2025
15d73ec
include photon-apple on all platforms
TheTripleV Dec 29, 2025
5a50d03
use macos 26 and java 24 on mac
TheTripleV Dec 29, 2025
8eb5d96
split java version - 17 for photonlib, 24 for photonvision
TheTripleV Dec 29, 2025
9d66eba
fix ci builds - java 24 for app, exclude swift samples, add stub
TheTripleV Dec 29, 2025
e270c17
force photon-apple stubs for photonlib builds
TheTripleV Dec 29, 2025
3d0e7e3
upgrade jacoco to 0.8.13 for java 24 support
TheTripleV Dec 29, 2025
bb41408
spotless
TheTripleV Dec 30, 2025
5c52cd9
upgrade to java 25 (lts) from java 24
TheTripleV Dec 30, 2025
a5cf88e
revert to java 24 and force swiftkit to use java 24
TheTripleV Dec 30, 2025
666a48a
use java 25 on macos, java 24 on linux/windows
TheTripleV Dec 30, 2025
74ff655
fix gradle 8 running on java 25 - install java 24 first
TheTripleV Dec 30, 2025
a41a4b7
fix java installation order - install 25 first, then 24
TheTripleV Dec 30, 2025
7be648b
fix photon-apple java 24/25 compatibility for dependency resolution
TheTripleV Dec 30, 2025
39baf38
exclude all swift-java samples from CI build
TheTripleV Dec 30, 2025
9f0e1ad
update docs with java 24/25 compatibility details
TheTripleV Dec 30, 2025
6822efc
the jar works
TheTripleV Dec 30, 2025
5436dc9
Update swift-java submodule to fe857f6
TheTripleV Dec 30, 2025
ac6d387
jar works locally
TheTripleV Dec 30, 2025
adf7076
some review comments
TheTripleV Dec 31, 2025
d1817eb
build fixes and docs
TheTripleV Dec 31, 2025
b701fe1
use java 17 for all non-macos
TheTripleV Dec 31, 2025
21134f4
dont hardcode java 24
TheTripleV Dec 31, 2025
6c49c07
stub memorysegment
TheTripleV Dec 31, 2025
e70d036
use swift 6.2
TheTripleV Dec 31, 2025
a58dfab
use arm64 java
TheTripleV Dec 31, 2025
4299732
update submodule
TheTripleV Dec 31, 2025
4ec3f9c
use java 25 for smoketest on macos
TheTripleV Dec 31, 2025
0103070
Add GitHub Actions caching for Swift build artifacts on macOS
claude Jan 1, 2026
f4c6616
Trigger second CI run to test Swift build cache
claude Jan 1, 2026
c3d32bf
Add debug output to inspect Swift build directory locations
claude Jan 1, 2026
44adc6e
cache path
TheTripleV Jan 1, 2026
61a539a
changes
TheTripleV Jan 1, 2026
eaa52e7
Optimize macOS CI build caching with architecture-specific keys
TheTripleV Jan 1, 2026
86e162c
build examples on old macos
TheTripleV Jan 1, 2026
0174b21
bump
TheTripleV Jan 1, 2026
dab64ef
yaml anchors
TheTripleV Jan 1, 2026
cc59c89
bump
TheTripleV Jan 1, 2026
111678b
don't spam from swift as much
TheTripleV Jan 2, 2026
25480bd
Merge remote-tracking branch 'origin/main' into mac
TheTripleV Feb 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 98 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jobs:
uses: actions/checkout@v6
with:
fetch-depth: 0
submodules: recursive
- name: Fetch tags
run: git fetch --tags --force
- name: Install Java 17
Expand Down Expand Up @@ -240,21 +241,22 @@ jobs:
- uses: actions/checkout@v6
with:
fetch-depth: 0
submodules: recursive
- name: Install Java 17
uses: actions/setup-java@v5
with:
java-version: 17
distribution: temurin
- run: git fetch --tags --force
- run: ./gradlew photon-targeting:build photon-lib:build
- run: ./gradlew photon-targeting:build photon-lib:build -PphotonAppleForceStubs
name: Build with Gradle
- run: ./gradlew photon-lib:publish photon-targeting:publish
- run: ./gradlew photon-lib:publish photon-targeting:publish -PphotonAppleForceStubs
name: Publish
env:
ARTIFACTORY_API_KEY: ${{ secrets.ARTIFACTORY_API_KEY }}
if: github.event_name == 'push' && github.repository_owner == 'photonvision'
# Copy artifacts to build/outputs/maven
- run: ./gradlew photon-lib:publish photon-targeting:publish -PcopyOfflineArtifacts
- run: ./gradlew photon-lib:publish photon-targeting:publish -PcopyOfflineArtifacts -PphotonAppleForceStubs
- uses: actions/upload-artifact@v6
with:
name: maven-${{ matrix.artifact-name }}
Expand Down Expand Up @@ -417,6 +419,90 @@ jobs:

steps: *build-package-steps

build-package-macos:
needs: [build-gradle, build-offline-docs]

strategy:
fail-fast: false
matrix:
include:
- os: macos-26
artifact-name: macOS
architecture: aarch64
arch-override: macarm64

runs-on: ${{ matrix.os }}
name: "Build fat JAR - ${{ matrix.artifact-name }}"

steps: &build-package-steps-macos
- uses: actions/checkout@v6
with:
fetch-depth: 0
submodules: recursive
- name: Install Java 25 (macOS toolchain for SwiftKit)
uses: actions/setup-java@v5
if: runner.os == 'macOS'
with:
java-version: 25
distribution: temurin
architecture: ${{ matrix.architecture }}
- name: Install Java 24 (for Gradle on macOS)
uses: actions/setup-java@v5
if: runner.os == 'macOS'
with:
java-version: 24
distribution: temurin
architecture: ${{ matrix.architecture }}
- name: Install Java 17 (for Gradle on non-macOS)
uses: actions/setup-java@v5
if: runner.os != 'macOS'
with:
java-version: 17
distribution: temurin
architecture: ${{ matrix.architecture }}
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 22
cache: pnpm
cache-dependency-path: photon-client/pnpm-lock.yaml
- name: Cache Swift build artifacts (macOS only)
uses: actions/cache@v4
if: runner.os == 'macOS'
with:
path: photon-apple/.build
key: ${{ matrix.artifact-name }}-photon-apple-build-${{ hashFiles('photon-apple/swift-java/Package.swift', 'photon-apple/swift-java/gradle.properties', 'photon-apple/swift-java/settings.gradle') }}
restore-keys: |
${{ matrix.artifact-name }}-photon-apple-build-
- name: Publish SwiftKit to Maven Local (macOS only)
if: runner.os == 'macOS'
run: |
cd photon-apple/swift-java
./gradlew publishToMavenLocal -PskipSamples=true
- name: Install Arm64 Toolchain
run: ./gradlew installArm64Toolchain
if: ${{ (matrix.artifact-name) == 'LinuxArm64' }}
- uses: actions/download-artifact@v6
with:
name: built-docs
path: photon-server/src/main/resources/web/docs
- run: ./gradlew photon-targeting:jar photon-server:shadowJar -PArchOverride=${{ matrix.arch-override }}
if: ${{ (matrix.arch-override != 'none') }}
- run: ./gradlew photon-server:shadowJar
if: ${{ (matrix.arch-override == 'none') }}
- uses: actions/upload-artifact@v6
with:
name: jar-${{ matrix.artifact-name }}
path: photon-server/build/libs
- uses: actions/upload-artifact@v6
with:
name: photon-targeting_jar-${{ matrix.artifact-name }}
path: photon-targeting/build/libs

run-smoketest-native:
needs: [build-package-linux, build-package-macos, build-package-windows]

Expand All @@ -429,14 +515,21 @@ jobs:
extraOpts: -Djdk.lang.Process.launchMechanism=vfork
- os: windows-latest
artifact-name: jar-Win64
- os: macos-latest
- os: macos-26
artifact-name: jar-macOS

runs-on: ${{ matrix.os }}

steps:
- name: Install Java 17
- name: Install Java 25 (macOS)
uses: actions/setup-java@v5
if: runner.os == 'macOS'
with:
java-version: 25
distribution: temurin
- name: Install Java 17 (non-macOS)
uses: actions/setup-java@v5
if: runner.os != 'macOS'
with:
java-version: 17
distribution: temurin
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,5 @@ photon-client/playwright-report/
photon-client/blob-report/
photon-client/playwright/.cache/
photon-client/playwright/.auth/

.build/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "photon-apple/swift-java"]
path = photon-apple/swift-java
url = https://github.com/swiftlang/swift-java.git
3 changes: 3 additions & 0 deletions .wpiformat
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ modifiableFileExclude {
photon-lib/py/photonlibpy/generated/
photon-targeting/src/generated/
photon-targeting/src/main/native/cpp/photon/constrained_solvepnp/generate/
.build/
photon-apple/.build/
photon-apple/swift-java/
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ PhotonVision is the free, fast, and easy-to-use computer vision solution for the

The latest release of platform-specific jars and images is found [here](https://github.com/PhotonVision/photonvision/releases).

If you are interested in contributing code or documentation to the project, please [read our getting started page for contributors](https://docs.photonvision.org/en/latest/docs/contributing/index.html) and **[join the Discord](https://discord.gg/wYxTwym) to introduce yourself!** We hope to provide a welcoming community to anyone who is interested in helping.
If you are interested in contributing code or documentation to the project, please [read our getting started page for contributors](https://docs.photonvision.org/en/latest/docs/contributing/index.html) and **[join the Discord](https://discord.gg/wYxTwym) to introduce yourself!** We hope to provide a welcoming community to anyone who is interested in helping out.

## Documentation

Expand Down
26 changes: 23 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,23 @@ allprojects {
}
wpilibRepositories.addAllReleaseRepositories(it)
wpilibRepositories.addAllDevelopmentRepositories(it)

// Allow Java 25 dependencies (SwiftKit) to be consumed by Java 24 projects
// This is needed because photon-apple requires SwiftKit which needs Java 25,
// but photon-server runs on Java 24
dependencies {
components {
all { ComponentMetadataDetails details ->
if (details.id.group == 'org.swift.swiftkit') {
details.allVariants { VariantMetadata variant ->
variant.attributes {
attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 24)
}
}
}
}
}
}
}

ext.localMavenURL = file("$project.buildDir/outputs/maven")
Expand Down Expand Up @@ -62,7 +79,8 @@ spotless {
java {
target fileTree('.') {
include '**/*.java'
exclude '**/build/**', '**/build-*/**', '**/src/generated/**'
exclude '**/build/**', '**/build-*/**', '**/src/generated/**',
'**/.build/**', '**/photon-apple/swift-java/**'
}
toggleOffOn()
googleJavaFormat()
Expand All @@ -75,7 +93,8 @@ spotless {
groovyGradle {
target fileTree('.') {
include '**/*.gradle'
exclude '**/build/**', '**/build-*/**'
exclude '**/build/**', '**/build-*/**',
'**/.build/**', '**/photon-apple/swift-java/**'
}
greclipse()
indentWithSpaces(4)
Expand All @@ -85,7 +104,8 @@ spotless {
format 'misc', {
target fileTree('.') {
include '**/*.md', '**/.gitignore'
exclude '**/build/**', '**/build-*/**', '**/node_modules/**'
exclude '**/build/**', '**/build-*/**', '**/node_modules/**',
'**/.build/**', '**/photon-apple/swift-java/**'
}
trimTrailingWhitespace()
indentWithSpaces(2)
Expand Down
53 changes: 52 additions & 1 deletion docs/source/docs/contributing/building-photon.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,18 @@ This section contains the build instructions from the source code available at [

**Java Development Kit:**

This project requires Java Development Kit (JDK) 17 to be compiled. This is the same Java version that comes with WPILib for 2026+. **Windows Users must use the JDK that ships with WPILib.** For other platforms, you can follow the instructions to install JDK 17 for your platform [here](https://bell-sw.com/pages/downloads/#jdk-17-lts).
PhotonLib requires Java Development Kit (JDK) 17 to be compiled. This is the same Java version that comes with WPILib for 2026+. **Windows Users must use the JDK that ships with WPILib.** For other platforms, you can follow the instructions to install JDK 17 for your platform [here](https://bell-sw.com/pages/downloads/#jdk-17-lts).

The PhotonVision server application requires JDK 17 to be compiled on Windows and Linux.
On macOS, it requires JDK 24 and JDK 25 (both JDK 24 and JDK 25 must be installed with JAVA_HOME pointing at JDK 24).

**JDK Version Split**

WPILib uses JDK 17 for the 2026 season. Photonlib must be built with JDK 17 compatibility.

PhotonVision on macOS uses a library (swift-java) to wrap swift code in java for CoreML based object detection.
swift-java requires Java 25 to build. Photonvision and WPILib use Gradle 8. Gradle 8 does not support Java 25. Gradle 9 is required for Java 25. So we build swift-java using Gradle 9 and Java 25 then use Gradle 8 and Java 24 to build photonvision.


**Node JS:**

Expand Down Expand Up @@ -57,6 +68,41 @@ pnpm run dev

This allows you to make UI changes quickly without having to spend time rebuilding the jar. Hot reload is enabled, so changes that you make and save are reflected in the UI immediately. Running this command will give you the URL for accessing the UI, which is on a different port than normal. You must use the printed URL to use hot reload.

### One time build the UI

To build the UI once and have it be served directly by PhotonVision, issue the following command in the root directory:

```{eval-rst}
.. tab-set::

.. tab-item:: Linux
:sync: linux

``./gradlew buildAndCopyUI``

.. tab-item:: macOS
:sync: macos

``./gradlew buildAndCopyUI``

.. tab-item:: Windows (cmd)
:sync: windows

``gradlew buildAndCopyUI``
```

### macOS only - Compile swift-java

On macOS, before building PhotonVision, it is required to build swift-java one time.

To build swift-java, issue the following from the root directory:

```bash
git submodule update --init --recursive
cd photon-apple/swift-java
./gradlew publishToMavenLocal -x :Samples:build
```

### Build and Run PhotonVision

To compile and run the project, issue the following command in the root directory:
Expand Down Expand Up @@ -308,3 +354,8 @@ build action, which can be found [here](https://github.com/PhotonVision/photonvi
In order to force the Object Detection interface to be visible, it's necessary to hardcode the platform that `Platform.java` returns. This can be done by changing the function that detects the RK3588S/QCS6490 platform to always return true, and changing the `getCurrentPlatform()` function to always return the RK3588S/QCS6490 architecture.
Alternatively, it's possible to modify the frontend code by changing all instances of `useSettingsStore().general.supportedBackends.length > 0` to `true`, which will force the card to render.
Make sure to revert these changes before submitting a Pull Request.

#### Building platform specific native code in the monorepo

Platform specific native code can be built in the monorepo by isolating the native code to a new subfolder with its own build.gradle.
On the desired platform, CI will build the native code and the java wrappers for it. On other platforms, configure the project to use stubs. See photon-apple/build.gradle.
51 changes: 51 additions & 0 deletions photon-apple/Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading