Compare commits

...

10 Commits

Author SHA1 Message Date
nobody5050
1599355b19
Remove x86 as a target from example json (#49)
Some checks failed
CI / Build - ${{ matrix.artifact-name }} (Arm32, -Ponlylinuxarm32, wpilib/raspbian-cross-ubuntu:bookworm-22.04) (push) Has been cancelled
CI / Build - ${{ matrix.artifact-name }} (Arm64, -Ponlylinuxarm64, wpilib/aarch64-cross-ubuntu:bookworm-22.04) (push) Has been cancelled
CI / Build - ${{ matrix.artifact-name }} (Athena, -Ponlylinuxathena, wpilib/roborio-cross-ubuntu:2025-22.04) (push) Has been cancelled
CI / Build - ${{ matrix.artifact-name }} (Linux, , wpilib/ubuntu-base:22.04) (push) Has been cancelled
CI / Build - ${{ matrix.artifact-name }} (aarch64, macOS, macos-14) (push) Has been cancelled
CI / Build - ${{ matrix.artifact-name }} (x64, Win64, windows-2022) (push) Has been cancelled
CI / Combine (push) Has been cancelled
2025-01-07 21:24:58 -08:00
Ryan Blue
ebbe7ed050
Update docker images for 2025 (#47) 2024-12-31 08:30:23 -08:00
Ryan Blue
2ee0e066e0
Add string concat and UTF-8 options from allwpilib (#48) 2024-12-31 08:29:03 -08:00
Tyler Veness
20364e3fd3
Upgrade to NativeUtils 2025.9.0 (#46) 2024-12-07 14:45:05 -08:00
Ryan Blue
e7a7440903
Various fixes (#45)
* update nativeutils to fix arm builds

* Pin CI to 22.04 and fix macos arch + target

* update opencv version
2024-12-07 14:09:48 -08:00
Thad House
9419c4cf30
Add JNI test support (#37)
* Add JNI test support

* Fix cross

* Fixes
2024-12-02 22:24:21 -08:00
T Grinch
93767cf757
Vendordep Templating. (#41)
* Added templating to the vendordep json.

* Fixed driver reference

* Moved copy to an artifact.

* Moved vendordep generation to `$buildDir/repos/` and added zip task. Maven publication commented out.

* Fixed zip function, uncommented maven publishing for vendordep.

* Update publish.gradle

* Change basename of vendordepJson

Added deps fix.

---------

Co-authored-by: thenetworkgrinch <thenetworkgrinch@users.noreply.github.com>
2024-12-02 22:23:23 -08:00
T Grinch
136fdda420
Add javadoc link to WPILib docs and oracle java docs. (#40)
* Added javadoc link to WPILib docs and oracle java docs.

* Update javadocs link to java17

* Update build.gradle

* Fix variable to integer.

---------

Co-authored-by: thenetworkgrinch <thenetworkgrinch@users.noreply.github.com>
2024-12-02 22:22:58 -08:00
T Grinch
464d8b6acc
Added variable to control wpilib version easier. (#42)
* Added wpilib version variable.

* Fixed find/replace mistake

* Update config.gradle

---------

Co-authored-by: thenetworkgrinch <thenetworkgrinch@users.noreply.github.com>
2024-12-02 22:17:36 -08:00
Tyler Veness
3bfbd91270
Upgrade to Gradle 8.11 (#44) 2024-12-02 18:51:05 -08:00
7 changed files with 138 additions and 40 deletions

View File

@ -8,20 +8,20 @@ jobs:
fail-fast: false
matrix:
include:
- container: wpilib/roborio-cross-ubuntu:2024-22.04
- container: wpilib/roborio-cross-ubuntu:2025-22.04
artifact-name: Athena
build-options: "-Ponlylinuxathena"
- container: wpilib/raspbian-cross-ubuntu:bullseye-22.04
- container: wpilib/raspbian-cross-ubuntu:bookworm-22.04
artifact-name: Arm32
build-options: "-Ponlylinuxarm32"
- container: wpilib/aarch64-cross-ubuntu:bullseye-22.04
- container: wpilib/aarch64-cross-ubuntu:bookworm-22.04
artifact-name: Arm64
build-options: "-Ponlylinuxarm64"
- container: wpilib/ubuntu-base:22.04
artifact-name: Linux
build-options: ""
name: "Build - ${{ matrix.artifact-name }}"
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
container: ${{ matrix.container }}
steps:
- uses: actions/checkout@v4
@ -40,7 +40,7 @@ jobs:
build-host:
env:
MACOSX_DEPLOYMENT_TARGET: 13
MACOSX_DEPLOYMENT_TARGET: 13.3
strategy:
fail-fast: false
matrix:
@ -50,7 +50,7 @@ jobs:
architecture: x64
- os: macos-14
artifact-name: macOS
architecture: x64
architecture: aarch64
name: "Build - ${{ matrix.artifact-name }}"
runs-on: ${{ matrix.os }}
steps:
@ -74,7 +74,7 @@ jobs:
combine:
name: Combine
needs: [build-docker, build-host]
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:

View File

@ -1,7 +1,7 @@
{
"fileName": "ExampleVendorJson.json",
"name": "ExampleVendorDep",
"version": "0.0.1",
"version": "${version}",
"frcYear": "2025",
"uuid": "Generate A Unique GUID https://guidgenerator.com/online-guid-generator.aspx and insert it here", This line is to purposely make this fail to parse
"mavenUrls": [
@ -10,21 +10,20 @@
"jsonUrl": "InsertSomeUrlHere",
"javaDependencies": [
{
"groupId": "com.vendor.frc",
"artifactId": "Vendor-java",
"version": "0.0.1"
"groupId": "${groupId}",
"artifactId": "${artifactId}-java",
"version": "${version}"
}
],
"jniDependencies": [
{
"groupId": "com.vendor.frc",
"artifactId": "Vendor-driver",
"version": "0.0.1",
"groupId": "${groupId}",
"artifactId": "${artifactId}-driver",
"version": "${version}",
"skipInvalidPlatforms": true,
"isJar": false,
"validPlatforms": [
"windowsx86-64",
"windowsx86",
"linuxarm64",
"linuxx86-64",
"linuxathena",
@ -35,16 +34,15 @@
],
"cppDependencies": [
{
"groupId": "com.vendor.frc",
"artifactId": "Vendor-cpp",
"version": "0.0.1",
"groupId": "${groupId}",
"artifactId": "${artifactId}-cpp",
"version": "${version}",
"libName": "Vendor",
"headerClassifier": "headers",
"sharedLibrary": false,
"skipInvalidPlatforms": true,
"binaryPlatforms": [
"windowsx86-64",
"windowsx86",
"linuxarm64",
"linuxx86-64",
"linuxathena",
@ -53,16 +51,15 @@
]
},
{
"groupId": "com.vendor.frc",
"artifactId": "Vendor-driver",
"version": "0.0.1",
"groupId": "${groupId}",
"artifactId": "${artifactId}-driver",
"version": "${version}",
"libName": "VendorDriver",
"headerClassifier": "headers",
"sharedLibrary": false,
"skipInvalidPlatforms": true,
"binaryPlatforms": [
"windowsx86-64",
"windowsx86",
"linuxarm64",
"linuxx86-64",
"linuxathena",

View File

@ -1,13 +1,18 @@
import edu.wpi.first.toolchain.*
plugins {
id 'cpp'
id 'java'
id 'google-test'
id 'edu.wpi.first.wpilib.repositories.WPILibRepositoriesPlugin' version '2020.2'
id 'edu.wpi.first.NativeUtils' version '2025.3.0'
id 'edu.wpi.first.wpilib.repositories.WPILibRepositoriesPlugin' version '2025.0'
id 'edu.wpi.first.NativeUtils' version '2025.9.0'
id 'edu.wpi.first.GradleJni' version '1.1.0'
id 'edu.wpi.first.GradleVsCode' version '2.1.0'
}
// WPILib Version
ext.wpilibVersion = "2025.+"
repositories {
mavenCentral()
}
@ -21,25 +26,55 @@ java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
var javaVersion = "17"
// Apply C++ configuration
apply from: 'config.gradle'
// Apply Java configuration
dependencies {
implementation 'edu.wpi.first.cscore:cscore-java:2025.+'
implementation 'edu.wpi.first.cameraserver:cameraserver-java:2025.+'
implementation 'edu.wpi.first.ntcore:ntcore-java:2025.+'
implementation 'edu.wpi.first.wpilibj:wpilibj-java:2025.+'
implementation 'edu.wpi.first.wpiutil:wpiutil-java:2025.+'
implementation 'edu.wpi.first.wpimath:wpimath-java:2025.+'
implementation 'edu.wpi.first.wpiunits:wpiunits-java:2025.+'
implementation 'edu.wpi.first.hal:hal-java:2025.+'
implementation "edu.wpi.first.cscore:cscore-java:$wpilibVersion"
implementation "edu.wpi.first.cameraserver:cameraserver-java:$wpilibVersion"
implementation "edu.wpi.first.ntcore:ntcore-java:$wpilibVersion"
implementation "edu.wpi.first.wpilibj:wpilibj-java:$wpilibVersion"
implementation "edu.wpi.first.wpiutil:wpiutil-java:$wpilibVersion"
implementation "edu.wpi.first.wpimath:wpimath-java:$wpilibVersion"
implementation "edu.wpi.first.wpiunits:wpiunits-java:$wpilibVersion"
implementation "edu.wpi.first.hal:hal-java:$wpilibVersion"
implementation "org.ejml:ejml-simple:0.43.1"
implementation "com.fasterxml.jackson.core:jackson-annotations:2.15.2"
implementation "com.fasterxml.jackson.core:jackson-core:2.15.2"
implementation "com.fasterxml.jackson.core:jackson-databind:2.15.2"
implementation 'edu.wpi.first.thirdparty.frc2024.opencv:opencv-java:4.8.0-4'
implementation 'edu.wpi.first.thirdparty.frc2025.opencv:opencv-java:4.10.0-2'
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.1'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}
// Set up java tests
test {
useJUnitPlatform()
systemProperty 'junit.jupiter.extensions.autodetection.enabled', 'true'
testLogging {
events "failed"
exceptionFormat "full"
}
}
if (project.hasProperty('onlylinuxathena') || project.hasProperty('onlylinuxarm32') || project.hasProperty('onlylinuxarm64') || project.hasProperty('onlywindowsarm64') || project.hasProperty('onlylinuxsystemcore')) {
test.enabled = false
}
tasks.withType(JavaCompile) {
options.compilerArgs.add '-XDstringConcat=inline'
options.encoding = 'UTF-8'
}
// Setup Javadocs to link back to WPILib docs
javadoc {
options {
links "https://docs.oracle.com/en/java/javase/$javaVersion/docs/api/", 'https://github.wpilib.org/allwpilib/docs/release/java/'
}
}
// Set up exports properly
@ -57,6 +92,12 @@ nativeUtils {
}
}
ext.getCurrentArch = {
return NativePlatforms.desktop
}
def systemArch = getCurrentArch()
model {
components {
Vendor(NativeLibrarySpec) {
@ -110,6 +151,15 @@ model {
binaries.all {
lib library: 'VendorDriver', linkage: 'shared'
def arch = it.targetPlatform.name
if (systemArch == arch && it.buildType.name == 'debug') {
def filePath = it.tasks.install.installDirectory.get().toString() + File.separatorChar + 'lib'
test.dependsOn it.tasks.install
test.systemProperty 'java.library.path', filePath
test.environment 'LD_LIBRARY_PATH', filePath
test.workingDir filePath
}
}
nativeUtils.useRequiredLibrary(it, "wpilib_executable_shared", "googletest_static")
@ -122,7 +172,6 @@ model {
include '**/*.cpp'
}
}
nativeUtils.useRequiredLibrary(it, "wpilib_executable_shared", "googletest_static")
}
}
@ -131,5 +180,5 @@ model {
apply from: 'publish.gradle'
wrapper {
gradleVersion '8.10.2'
gradleVersion '8.11'
}

View File

@ -8,10 +8,10 @@ nativeUtils.withCrossLinuxArm64()
nativeUtils {
wpi {
configureDependencies {
wpiVersion = "2025.+"
opencvYear = "frc2024"
wpiVersion = wpilibVersion
opencvYear = "frc2025"
niLibVersion = "2025.0.0"
opencvVersion = "4.8.0-4"
opencvVersion = "4.10.0-2"
}
}
}

View File

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME

View File

@ -1,7 +1,12 @@
import org.apache.tools.ant.filters.FixCrLfFilter
import org.apache.tools.ant.filters.ReplaceTokens
apply plugin: 'maven-publish'
ext.licenseFile = files("$rootDir/LICENSE.txt")
def templateVendorFile = "ExampleVendorJson.json"
def pubVersion = '0.0.1'
def outputsFolder = file("$buildDir/outputs")
@ -127,6 +132,32 @@ task outputJavadocJar(type: Jar, dependsOn: javadoc) {
from javadoc.destinationDir
}
// Apply template variables from the vendordep file.
// Replaces ${VARIABLE} with VARIABLE: value in expand()
task vendordepJson() {
description = 'Builds the vendordep json file.'
group = 'Build'
outputs.file("$buildDir/repos/$templateVendorFile")
copy {
from templateVendorFile
into "$buildDir/repos/"
expand(version: pubVersion,
groupId: artifactGroupId,
artifactId: baseArtifactId)
}
}
task vendordepJsonZip(type: Zip) {
destinationDirectory = outputsFolder
archiveBaseName = "vendordepJson"
from("$buildDir/repos/$templateVendorFile") {
into '/'
}
dependsOn vendordepJson
}
artifacts {
archives sourcesJar
archives javadocJar
@ -138,10 +169,12 @@ artifacts {
addTaskToCopyAllOutputs(outputSourcesJar)
addTaskToCopyAllOutputs(outputJavadocJar)
addTaskToCopyAllOutputs(outputJar)
addTaskToCopyAllOutputs(vendordepJsonZip)
build.dependsOn outputSourcesJar
build.dependsOn outputJavadocJar
build.dependsOn outputJar
build.dependsOn vendordepJsonZip
libraryBuild.dependsOn build
@ -200,6 +233,14 @@ model {
groupId artifactGroupId
version pubVersion
}
vendordep(MavenPublication) {
artifact vendordepJsonZip
artifactId = "${baseArtifactId}-vendordep"
groupId artifactGroupId
version pubVersion
}
}
}
}

View File

@ -0,0 +1,11 @@
package com.vendor.jni;
import org.junit.jupiter.api.Test;
public class VendorJNITest {
@Test
void jniLinkTest() {
// Test to verify that the JNI test link works correctly.
VendorJNI.initialize();
}
}