Compare commits
10 Commits
74e7147c31
...
1599355b19
Author | SHA1 | Date | |
---|---|---|---|
|
1599355b19 | ||
|
ebbe7ed050 | ||
|
2ee0e066e0 | ||
|
20364e3fd3 | ||
|
e7a7440903 | ||
|
9419c4cf30 | ||
|
93767cf757 | ||
|
136fdda420 | ||
|
464d8b6acc | ||
|
3bfbd91270 |
14
.github/workflows/ci.yml
vendored
14
.github/workflows/ci.yml
vendored
@ -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:
|
||||
|
@ -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",
|
||||
|
75
build.gradle
75
build.gradle
@ -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'
|
||||
}
|
||||
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -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
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
11
src/test/java/com/vendor/jni/VendorJNITest.java
vendored
Normal file
11
src/test/java/com/vendor/jni/VendorJNITest.java
vendored
Normal 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();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user