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

View File

@ -1,7 +1,7 @@
{ {
"fileName": "ExampleVendorJson.json", "fileName": "ExampleVendorJson.json",
"name": "ExampleVendorDep", "name": "ExampleVendorDep",
"version": "0.0.1", "version": "${version}",
"frcYear": "2025", "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 "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": [ "mavenUrls": [
@ -10,21 +10,20 @@
"jsonUrl": "InsertSomeUrlHere", "jsonUrl": "InsertSomeUrlHere",
"javaDependencies": [ "javaDependencies": [
{ {
"groupId": "com.vendor.frc", "groupId": "${groupId}",
"artifactId": "Vendor-java", "artifactId": "${artifactId}-java",
"version": "0.0.1" "version": "${version}"
} }
], ],
"jniDependencies": [ "jniDependencies": [
{ {
"groupId": "com.vendor.frc", "groupId": "${groupId}",
"artifactId": "Vendor-driver", "artifactId": "${artifactId}-driver",
"version": "0.0.1", "version": "${version}",
"skipInvalidPlatforms": true, "skipInvalidPlatforms": true,
"isJar": false, "isJar": false,
"validPlatforms": [ "validPlatforms": [
"windowsx86-64", "windowsx86-64",
"windowsx86",
"linuxarm64", "linuxarm64",
"linuxx86-64", "linuxx86-64",
"linuxathena", "linuxathena",
@ -35,16 +34,15 @@
], ],
"cppDependencies": [ "cppDependencies": [
{ {
"groupId": "com.vendor.frc", "groupId": "${groupId}",
"artifactId": "Vendor-cpp", "artifactId": "${artifactId}-cpp",
"version": "0.0.1", "version": "${version}",
"libName": "Vendor", "libName": "Vendor",
"headerClassifier": "headers", "headerClassifier": "headers",
"sharedLibrary": false, "sharedLibrary": false,
"skipInvalidPlatforms": true, "skipInvalidPlatforms": true,
"binaryPlatforms": [ "binaryPlatforms": [
"windowsx86-64", "windowsx86-64",
"windowsx86",
"linuxarm64", "linuxarm64",
"linuxx86-64", "linuxx86-64",
"linuxathena", "linuxathena",
@ -53,16 +51,15 @@
] ]
}, },
{ {
"groupId": "com.vendor.frc", "groupId": "${groupId}",
"artifactId": "Vendor-driver", "artifactId": "${artifactId}-driver",
"version": "0.0.1", "version": "${version}",
"libName": "VendorDriver", "libName": "VendorDriver",
"headerClassifier": "headers", "headerClassifier": "headers",
"sharedLibrary": false, "sharedLibrary": false,
"skipInvalidPlatforms": true, "skipInvalidPlatforms": true,
"binaryPlatforms": [ "binaryPlatforms": [
"windowsx86-64", "windowsx86-64",
"windowsx86",
"linuxarm64", "linuxarm64",
"linuxx86-64", "linuxx86-64",
"linuxathena", "linuxathena",

View File

@ -1,13 +1,18 @@
import edu.wpi.first.toolchain.*
plugins { plugins {
id 'cpp' id 'cpp'
id 'java' id 'java'
id 'google-test' id 'google-test'
id 'edu.wpi.first.wpilib.repositories.WPILibRepositoriesPlugin' version '2020.2' id 'edu.wpi.first.wpilib.repositories.WPILibRepositoriesPlugin' version '2025.0'
id 'edu.wpi.first.NativeUtils' version '2025.3.0' id 'edu.wpi.first.NativeUtils' version '2025.9.0'
id 'edu.wpi.first.GradleJni' version '1.1.0' id 'edu.wpi.first.GradleJni' version '1.1.0'
id 'edu.wpi.first.GradleVsCode' version '2.1.0' id 'edu.wpi.first.GradleVsCode' version '2.1.0'
} }
// WPILib Version
ext.wpilibVersion = "2025.+"
repositories { repositories {
mavenCentral() mavenCentral()
} }
@ -21,25 +26,55 @@ java {
sourceCompatibility = JavaVersion.VERSION_17 sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17
} }
var javaVersion = "17"
// Apply C++ configuration // Apply C++ configuration
apply from: 'config.gradle' apply from: 'config.gradle'
// Apply Java configuration // Apply Java configuration
dependencies { dependencies {
implementation 'edu.wpi.first.cscore:cscore-java:2025.+' implementation "edu.wpi.first.cscore:cscore-java:$wpilibVersion"
implementation 'edu.wpi.first.cameraserver:cameraserver-java:2025.+' implementation "edu.wpi.first.cameraserver:cameraserver-java:$wpilibVersion"
implementation 'edu.wpi.first.ntcore:ntcore-java:2025.+' implementation "edu.wpi.first.ntcore:ntcore-java:$wpilibVersion"
implementation 'edu.wpi.first.wpilibj:wpilibj-java:2025.+' implementation "edu.wpi.first.wpilibj:wpilibj-java:$wpilibVersion"
implementation 'edu.wpi.first.wpiutil:wpiutil-java:2025.+' implementation "edu.wpi.first.wpiutil:wpiutil-java:$wpilibVersion"
implementation 'edu.wpi.first.wpimath:wpimath-java:2025.+' implementation "edu.wpi.first.wpimath:wpimath-java:$wpilibVersion"
implementation 'edu.wpi.first.wpiunits:wpiunits-java:2025.+' implementation "edu.wpi.first.wpiunits:wpiunits-java:$wpilibVersion"
implementation 'edu.wpi.first.hal:hal-java:2025.+' implementation "edu.wpi.first.hal:hal-java:$wpilibVersion"
implementation "org.ejml:ejml-simple:0.43.1" implementation "org.ejml:ejml-simple:0.43.1"
implementation "com.fasterxml.jackson.core:jackson-annotations:2.15.2" 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-core:2.15.2"
implementation "com.fasterxml.jackson.core:jackson-databind: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 // Set up exports properly
@ -57,6 +92,12 @@ nativeUtils {
} }
} }
ext.getCurrentArch = {
return NativePlatforms.desktop
}
def systemArch = getCurrentArch()
model { model {
components { components {
Vendor(NativeLibrarySpec) { Vendor(NativeLibrarySpec) {
@ -110,6 +151,15 @@ model {
binaries.all { binaries.all {
lib library: 'VendorDriver', linkage: 'shared' 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") nativeUtils.useRequiredLibrary(it, "wpilib_executable_shared", "googletest_static")
@ -122,7 +172,6 @@ model {
include '**/*.cpp' include '**/*.cpp'
} }
} }
nativeUtils.useRequiredLibrary(it, "wpilib_executable_shared", "googletest_static") nativeUtils.useRequiredLibrary(it, "wpilib_executable_shared", "googletest_static")
} }
} }
@ -131,5 +180,5 @@ model {
apply from: 'publish.gradle' apply from: 'publish.gradle'
wrapper { wrapper {
gradleVersion '8.10.2' gradleVersion '8.11'
} }

View File

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

View File

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists 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 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME 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' apply plugin: 'maven-publish'
ext.licenseFile = files("$rootDir/LICENSE.txt") ext.licenseFile = files("$rootDir/LICENSE.txt")
def templateVendorFile = "ExampleVendorJson.json"
def pubVersion = '0.0.1' def pubVersion = '0.0.1'
def outputsFolder = file("$buildDir/outputs") def outputsFolder = file("$buildDir/outputs")
@ -127,6 +132,32 @@ task outputJavadocJar(type: Jar, dependsOn: javadoc) {
from javadoc.destinationDir 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 { artifacts {
archives sourcesJar archives sourcesJar
archives javadocJar archives javadocJar
@ -138,10 +169,12 @@ artifacts {
addTaskToCopyAllOutputs(outputSourcesJar) addTaskToCopyAllOutputs(outputSourcesJar)
addTaskToCopyAllOutputs(outputJavadocJar) addTaskToCopyAllOutputs(outputJavadocJar)
addTaskToCopyAllOutputs(outputJar) addTaskToCopyAllOutputs(outputJar)
addTaskToCopyAllOutputs(vendordepJsonZip)
build.dependsOn outputSourcesJar build.dependsOn outputSourcesJar
build.dependsOn outputJavadocJar build.dependsOn outputJavadocJar
build.dependsOn outputJar build.dependsOn outputJar
build.dependsOn vendordepJsonZip
libraryBuild.dependsOn build libraryBuild.dependsOn build
@ -200,6 +233,14 @@ model {
groupId artifactGroupId groupId artifactGroupId
version pubVersion 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();
}
}