diff --git a/.gitignore b/.gitignore index f70d814e5..70e5c3f9e 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ atlassian-ide-plugin.xml *.class .fleet/settings.json keys +.claude diff --git a/README.md b/README.md index 929762432..1cb873519 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@

-This is a port of the awesome [xerial/sqlite-jdbc](https://github.com/xerial/sqlite-jdbc/) to run in pure Java with SQLite compiled to WASM thanks to [Chicory](https://github.com/dylibso/chicory). +This is a port of the awesome [xerial/sqlite-jdbc](https://github.com/xerial/sqlite-jdbc/) to run in pure Java with SQLite compiled to WASM thanks to [Endive](https://github.com/bytecodealliance/endive). ## Why? @@ -30,7 +30,7 @@ Among the main reasons: There are a few steps to achieve the result: - compile SQLite to [WebAssembly](https://webassembly.org/) - - translate the SQLite payload to pure Java bytecode using [Chicory Compiler](https://chicory.dev/docs/usage/build-time-compiler) + - translate the SQLite payload to pure Java bytecode using [Endive Compiler](https://endive.run/docs/usage/build-time-compiler) - run SQLite similarly to how it's done using JNI in the original JDBC dirver, but all in pure Java - ship an extremely small and self contained `jar` that can run wherever the JVM can go! @@ -181,4 +181,4 @@ This project is building on the shoulders of giants. Special thanks to: - [xerial/sqlite-jdbc](https://github.com/xerial/sqlite-jdbc/) – the original JDBC driver - [ncruces/go-sqlite3](https://github.com/ncruces/go-sqlite3) – for prior work and invaluable help -- [dylibso/chicory](https://github.com/dylibso/chicory) – for the Wasm compiler to Java Bytecode +- [bytecodealliance/endive](https://github.com/bytecodealliance/endive) – for the Wasm compiler to Java Bytecode diff --git a/pom.xml b/pom.xml index 6c182b8b6..22abb0025 100644 --- a/pom.xml +++ b/pom.xml @@ -6,14 +6,14 @@ sqlite4j 9.9.9.9-SNAPSHOT Pure Java SQLite JDBC Driver - SQLite JDBC library running in Wasm thanks to Chicory + SQLite JDBC library running in Wasm thanks to Endive https://github.com/roastedroot/sqlite4j UTF-8 5.14.4 3.5.6 - 1.7.5 + 1.0.0 @@ -87,7 +87,7 @@ true - com.dylibso.chicory + run.endive annotations-processor @@ -151,9 +151,9 @@ - com.dylibso.chicory - chicory-compiler-maven-plugin - ${chicory.version} + run.endive + endive-compiler-maven-plugin + ${endive.version} compile-sqlite @@ -281,9 +281,9 @@ - com.dylibso.chicory + run.endive bom - ${chicory.version} + ${endive.version} pom import @@ -293,19 +293,19 @@ - com.dylibso.chicory + run.endive wasm - com.dylibso.chicory + run.endive runtime - com.dylibso.chicory + run.endive wasi - com.dylibso.chicory + run.endive annotations diff --git a/src/main/java/io/roastedroot/sqlite4j/core/WasmDB.java b/src/main/java/io/roastedroot/sqlite4j/core/WasmDB.java index 01b5b3bed..8f9a33168 100644 --- a/src/main/java/io/roastedroot/sqlite4j/core/WasmDB.java +++ b/src/main/java/io/roastedroot/sqlite4j/core/WasmDB.java @@ -3,14 +3,6 @@ import static io.roastedroot.sqlite4j.core.wasm.WasmDBExports.SQLITE_SERIALIZE_NOCOPY; import static io.roastedroot.sqlite4j.core.wasm.WasmDBExports.SQLITE_UTF8; -import com.dylibso.chicory.runtime.ByteArrayMemory; -import com.dylibso.chicory.runtime.ImportValues; -import com.dylibso.chicory.runtime.Instance; -import com.dylibso.chicory.runtime.Memory; -import com.dylibso.chicory.wasi.WasiOptions; -import com.dylibso.chicory.wasi.WasiPreview1; -import com.dylibso.chicory.wasm.WasmModule; -import com.dylibso.chicory.wasm.types.MemoryLimits; import io.roastedroot.sqlite4j.BusyHandler; import io.roastedroot.sqlite4j.Collation; import io.roastedroot.sqlite4j.Function; @@ -38,6 +30,14 @@ import java.nio.file.Path; import java.nio.file.StandardCopyOption; import java.sql.SQLException; +import run.endive.runtime.ByteArrayMemory; +import run.endive.runtime.ImportValues; +import run.endive.runtime.Instance; +import run.endive.runtime.Memory; +import run.endive.wasi.WasiOptions; +import run.endive.wasi.WasiPreview1; +import run.endive.wasm.WasmModule; +import run.endive.wasm.types.MemoryLimits; public class WasmDB extends DB implements WasmDBImports { public static final int PTR_SIZE = 4; diff --git a/src/main/java/io/roastedroot/sqlite4j/core/wasm/WasmDBExports.java b/src/main/java/io/roastedroot/sqlite4j/core/wasm/WasmDBExports.java index ac976c432..5d0634ecb 100644 --- a/src/main/java/io/roastedroot/sqlite4j/core/wasm/WasmDBExports.java +++ b/src/main/java/io/roastedroot/sqlite4j/core/wasm/WasmDBExports.java @@ -2,10 +2,10 @@ import static io.roastedroot.sqlite4j.core.Codes.SQLITE_NULL; -import com.dylibso.chicory.runtime.ExportFunction; -import com.dylibso.chicory.runtime.Instance; -import com.dylibso.chicory.wasm.types.Value; import java.nio.charset.StandardCharsets; +import run.endive.runtime.ExportFunction; +import run.endive.runtime.Instance; +import run.endive.wasm.types.Value; // Manually writing it to avoid passing through the Map lookup on every invocation public class WasmDBExports { diff --git a/src/main/java/io/roastedroot/sqlite4j/core/wasm/WasmDBImports.java b/src/main/java/io/roastedroot/sqlite4j/core/wasm/WasmDBImports.java index 8b79805b1..9050804e0 100644 --- a/src/main/java/io/roastedroot/sqlite4j/core/wasm/WasmDBImports.java +++ b/src/main/java/io/roastedroot/sqlite4j/core/wasm/WasmDBImports.java @@ -1,8 +1,8 @@ package io.roastedroot.sqlite4j.core.wasm; -import com.dylibso.chicory.runtime.HostFunction; -import com.dylibso.chicory.wasm.types.ValueType; import java.util.List; +import run.endive.runtime.HostFunction; +import run.endive.wasm.types.ValueType; public interface WasmDBImports { diff --git a/wasm-lib/build.sh b/wasm-lib/build.sh index 76e63bd18..149547d8f 100755 --- a/wasm-lib/build.sh +++ b/wasm-lib/build.sh @@ -17,10 +17,10 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) # Download the latest SQLite amalgamation 3.48.0 as of today # rm -rf sqlite-amalgamation -# wget https://www.sqlite.org/2026/sqlite-amalgamation-3530100.zip -# unzip sqlite-amalgamation-3530100.zip -# mv sqlite-amalgamation-3530100 sqlite-amalgamation -# rm sqlite-amalgamation-3530100.zip +# wget https://www.sqlite.org/2026/sqlite-amalgamation-3530300.zip +# unzip sqlite-amalgamation-3530300.zip +# mv sqlite-amalgamation-3530300 sqlite-amalgamation +# rm sqlite-amalgamation-3530300.zip # Download and install Binaryen for optimizations # rm -rf binaryen diff --git a/wasm-lib/libsqlite3.wasm b/wasm-lib/libsqlite3.wasm index 0e7d59839..24b987966 100755 Binary files a/wasm-lib/libsqlite3.wasm and b/wasm-lib/libsqlite3.wasm differ diff --git a/wasm-lib/prepare-ci.sh b/wasm-lib/prepare-ci.sh index 28cd780c4..525c2c7fa 100755 --- a/wasm-lib/prepare-ci.sh +++ b/wasm-lib/prepare-ci.sh @@ -9,10 +9,10 @@ mv wasi-sdk-25.0-x86_64-linux wasi-sdk rm wasi-sdk-25.0-x86_64-linux.tar.gz rm -rf sqlite-amalgamation -wget https://www.sqlite.org/2026/sqlite-amalgamation-3530100.zip -unzip sqlite-amalgamation-3530100.zip -mv sqlite-amalgamation-3530100 sqlite-amalgamation -rm sqlite-amalgamation-3530100.zip +wget https://www.sqlite.org/2026/sqlite-amalgamation-3530300.zip +unzip sqlite-amalgamation-3530300.zip +mv sqlite-amalgamation-3530300 sqlite-amalgamation +rm sqlite-amalgamation-3530300.zip rm -rf binaryen wget https://github.com/WebAssembly/binaryen/releases/download/version_121/binaryen-version_121-x86_64-linux.tar.gz