Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: update to GraalVM 23 #922

Merged
merged 5 commits into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,15 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
java: [ 11, 17 ]
java: [ '17.0.7', '20.0.1' ]
gotson marked this conversation as resolved.
Show resolved Hide resolved
profiles: ['native', 'native,native-exported']
exclude: # Exclusions can be removed from GraalVM 23.0: https://github.com/oracle/graal/pull/5932
- os: ubuntu-latest
profiles: 'native,native-exported'
- os: macos-latest
profiles: 'native,native-exported'
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: graalvm/setup-graalvm@v1
with:
version: '22.3.0'
java-version: ${{ matrix.java }}
components: 'native-image'
distribution: 'graalvm-community'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Test
run: mvn --batch-mode --no-transfer-progress -P ${{ matrix.profiles }} integration-test
Expand Down
17 changes: 17 additions & 0 deletions src/main/java/org/sqlite/SQLiteJDBCLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,17 @@ private static boolean loadNativeLibrary(String path, String name) {
}
}

private static boolean loadNativeLibraryJdk() {
try {
System.loadLibrary(LibraryLoaderUtil.NATIVE_LIB_BASE_NAME);
return true;
} catch (UnsatisfiedLinkError e) {
System.err.println("Failed to load native library through System.loadLibrary");
e.printStackTrace();
return false;
}
}

/**
* Loads SQLite native library using given path and name of the library.
*
Expand Down Expand Up @@ -358,6 +369,12 @@ private static void loadSQLiteNativeLibrary() throws Exception {
}
}

// As an ultimate last resort, try loading through System.loadLibrary
if (loadNativeLibraryJdk()) {
extracted = true;
return;
}

extracted = false;
throw new Exception(
String.format(
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/org/sqlite/util/LibraryLoaderUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
import org.sqlite.SQLiteJDBCLoader;

public class LibraryLoaderUtil {

public static final String NATIVE_LIB_BASE_NAME = "sqlitejdbc";

/**
* Get the OS-specific resource directory within the jar, where the relevant sqlitejdbc native
* library is located.
Expand All @@ -15,7 +18,7 @@ public static String getNativeLibResourcePath() {

/** Get the OS-specific name of the sqlitejdbc native library. */
public static String getNativeLibName() {
return System.mapLibraryName("sqlitejdbc");
return System.mapLibraryName(NATIVE_LIB_BASE_NAME);
}

public static boolean hasNativeLib(String path, String libraryName) {
Expand Down