parent
93767cf757
commit
9419c4cf30
35
build.gradle
35
build.gradle
@ -1,3 +1,5 @@
|
||||
import edu.wpi.first.toolchain.*
|
||||
|
||||
plugins {
|
||||
id 'cpp'
|
||||
id 'java'
|
||||
@ -44,6 +46,23 @@ dependencies {
|
||||
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'
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
// Setup Javadocs to link back to WPILib docs
|
||||
@ -68,6 +87,12 @@ nativeUtils {
|
||||
}
|
||||
}
|
||||
|
||||
ext.getCurrentArch = {
|
||||
return NativePlatforms.desktop
|
||||
}
|
||||
|
||||
def systemArch = getCurrentArch()
|
||||
|
||||
model {
|
||||
components {
|
||||
Vendor(NativeLibrarySpec) {
|
||||
@ -121,6 +146,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")
|
||||
@ -133,7 +167,6 @@ model {
|
||||
include '**/*.cpp'
|
||||
}
|
||||
}
|
||||
|
||||
nativeUtils.useRequiredLibrary(it, "wpilib_executable_shared", "googletest_static")
|
||||
}
|
||||
}
|
||||
|
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