Skip to content

Commit

Permalink
Fix build on nightly
Browse files Browse the repository at this point in the history
  • Loading branch information
spacey-sooty committed Jun 10, 2024
1 parent 239af97 commit cf9d942
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,7 @@ bin/


# End of https://www.gitignore.io/api/c++,java,linux,macos,gradle,windows,visualstudiocode

# clangd
/.cache
compile_commands.json
24 changes: 10 additions & 14 deletions src/main/java/org/littletonrobotics/urcl/URCLJNI.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
package org.littletonrobotics.urcl;

import java.io.IOException;
import java.lang.System;
import java.nio.ByteBuffer;
import java.util.concurrent.atomic.AtomicBoolean;

Expand All @@ -18,7 +19,6 @@
*/
public class URCLJNI {
static boolean libraryLoaded = false;
static RuntimeLoader<URCLJNI> loader = null;

/**
* Helper class for determining whether or not to load the driver on static
Expand All @@ -29,7 +29,7 @@ public static class Helper {

/**
* Get whether to load the driver on static init.
*
*
* @return true if the driver will load on static init
*/
public static boolean getExtractOnStaticLoad() {
Expand All @@ -38,7 +38,7 @@ public static boolean getExtractOnStaticLoad() {

/**
* Set whether to load the driver on static init.
*
*
* @param load the new value
*/
public static void setExtractOnStaticLoad(boolean load) {
Expand All @@ -49,9 +49,7 @@ public static void setExtractOnStaticLoad(boolean load) {
static {
if (Helper.getExtractOnStaticLoad()) {
try {
loader = new RuntimeLoader<>("URCLDriver", RuntimeLoader.getDefaultExtractionRoot(),
URCLJNI.class);
loader.loadLibrary();
RuntimeLoader.loadLibrary("URCLDriver");
} catch (IOException ex) {
ex.printStackTrace();
System.exit(1);
Expand All @@ -62,32 +60,30 @@ public static void setExtractOnStaticLoad(boolean load) {

/**
* Force load the library.
*
*
* @throws java.io.IOException thrown if the native library cannot be found
*/
public static synchronized void forceLoad() throws IOException {
if (libraryLoaded) {
return;
}
loader = new RuntimeLoader<>("URCLDriver", RuntimeLoader.getDefaultExtractionRoot(),
URCLJNI.class);
loader.loadLibrary();
RuntimeLoader.loadLibrary("URCLDriver");
libraryLoaded = true;
}

/** Start logging. */
public static native void start();

/**
/**
* Get the shared buffer with persistent data.
*
*
* @return The shared buffer
*/
public static native ByteBuffer getPersistentBuffer();

/**
/**
* Get the shared buffer with periodic data.
*
*
* @return The shared buffer
*/
public static native ByteBuffer getPeriodicBuffer();
Expand Down

0 comments on commit cf9d942

Please sign in to comment.