From c05f3eb18f8ccb5f892045dcbccda7cd24bd36ee Mon Sep 17 00:00:00 2001 From: Tom van Dinther <39470469+tvandinther@users.noreply.github.com> Date: Sun, 31 Aug 2025 15:32:40 +0200 Subject: [PATCH 1/3] update bindings script --- generate-bindings.sh | 49 +++++++++++++++++++++++++--------------- rust-bindings/.gitignore | 2 +- 2 files changed, 32 insertions(+), 19 deletions(-) diff --git a/generate-bindings.sh b/generate-bindings.sh index 7feceaf..7eaaec6 100755 --- a/generate-bindings.sh +++ b/generate-bindings.sh @@ -3,17 +3,30 @@ set -euo pipefail script_dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" -export LIBSQL_RS_VERSION="0.5.0" bindings_dir="${script_dir}/rust-bindings" force=false +commit="${LIBSQL_COMMIT:-libsql-0.9.21}" +remote="${LIBSQL_REMOTE:-https://github.com/tursodatabase/libsql.git}" +local_repo_path="" -# Parse command line arguments while [[ $# -gt 0 ]]; do case "$1" in --force) force=true shift ;; + --commit) + commit="$2" + shift 2 + ;; + --remote) + remote="$2" + shift 2 + ;; + --local) + local_repo_path="$2" + shift 2 + ;; *) echo "Unknown option: $1" exit 1 @@ -29,23 +42,23 @@ function run_if_force { run_if_force rm -rf "${bindings_dir}/libsql" run_if_force rm -rf "${bindings_dir}/target" -mkdir -p "${bindings_dir}/libsql" +mkdir -p "${bindings_dir}" -cd "${bindings_dir}/libsql" -git init 2> /dev/null +if [[ -n "${local_repo_path}" ]]; then + ln -sfn "${local_repo_path}" "${bindings_dir}/libsql" +else + mkdir -p "${bindings_dir}/libsql" + cd "${bindings_dir}/libsql" + git init 2> /dev/null + + if ! git config remote.origin.url &> /dev/null;then + git remote add --no-fetch origin "${remote}" + fi -if ! git config remote.origin.url &> /dev/null;then - git remote add --no-fetch origin "https://github.com/tursodatabase/libsql.git" + git fetch --quiet origin + git checkout "${commit}" + cd ../.. fi -# git sparse-checkout init -# git sparse-checkout set bindings/c bindings/wasm libsql libsql-sys -# ----- -# git fetch --quiet origin -# git checkout fb85262 -# ----- -git fetch --depth 1 origin tag libsql-rs-v${LIBSQL_RS_VERSION} -git reset --hard tags/libsql-rs-v${LIBSQL_RS_VERSION} - -cd .. -cargo build --release +cd "${bindings_dir}" +cargo build --lib --release diff --git a/rust-bindings/.gitignore b/rust-bindings/.gitignore index ca34ade..00bb527 100644 --- a/rust-bindings/.gitignore +++ b/rust-bindings/.gitignore @@ -1,4 +1,4 @@ -libsql/ +libsql target/ bindings/ Cargo.lock \ No newline at end of file From 88db960c3bbafa19c1a3e44c68a07f971ebd2de8 Mon Sep 17 00:00:00 2001 From: Tom van Dinther <39470469+tvandinther@users.noreply.github.com> Date: Sun, 31 Aug 2025 15:36:36 +0200 Subject: [PATCH 2/3] update Cargo.toml for new version --- rust-bindings/Cargo.toml | 14 +++++++++++++- rust-bindings/csharp-bindings/Cargo.toml | 8 ++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/rust-bindings/Cargo.toml b/rust-bindings/Cargo.toml index 7b05dd4..9de22c4 100644 --- a/rust-bindings/Cargo.toml +++ b/rust-bindings/Cargo.toml @@ -4,8 +4,19 @@ members = [ "libsql/bindings/c" ] +[workspace.package] +edition = "2021" +authors = ["the libSQL authors"] +version = "0.9.21" +license = "MIT" +repository = "https://github.com/tursodatabase/libsql" + [workspace.dependencies] -rusqlite = { package = "libsql-rusqlite", path = "libsql/vendored/rusqlite", version = "0.32", default-features = false, features = [ +libsql-ffi = { path = "libsql/libsql-ffi", version = "0.9.21" } +libsql-sys = { path = "libsql/libsql-sys", version = "0.9.21", default-features = false } +libsql-hrana = { path = "libsql/libsql-hrana", version = "0.9.21" } +libsql_replication = { path = "libsql/libsql-replication", version = "0.9.21" } +rusqlite = { package = "libsql-rusqlite", path = "libsql/vendored/rusqlite", version = "0.9.21", default-features = false, features = [ "libsql-experimental", "column_decltype", "load_extension", @@ -16,3 +27,4 @@ rusqlite = { package = "libsql-rusqlite", path = "libsql/vendored/rusqlite", ver ] } hyper = { version = "0.14" } tower = { version = "0.4.13" } +zerocopy = { version = "0.7.32", features = ["derive", "alloc"] } \ No newline at end of file diff --git a/rust-bindings/csharp-bindings/Cargo.toml b/rust-bindings/csharp-bindings/Cargo.toml index f66531d..740c3dd 100644 --- a/rust-bindings/csharp-bindings/Cargo.toml +++ b/rust-bindings/csharp-bindings/Cargo.toml @@ -9,11 +9,15 @@ path = "../libsql/bindings/c/src/lib.rs" doc = false [build-dependencies] -csbindgen = "1.2.0" +csbindgen = "1.9.5" [dependencies] bytes = "1.5.0" -libsql = { path = "../libsql/libsql" } lazy_static = "1.4.0" tokio = { version = "1.29.1", features = [ "rt-multi-thread" ] } hyper-rustls = { version = "0.25", features = ["webpki-roots"]} +tracing = "0.1.40" +tracing-subscriber = "0.3.18" +http = "1.1.0" +anyhow = "1.0.86" +libsql = { path = "../libsql/libsql", features = ["encryption"] } \ No newline at end of file From 217ac771731519ede1cd6a3c249f7317b4d2203d Mon Sep 17 00:00:00 2001 From: Tom van Dinther <39470469+tvandinther@users.noreply.github.com> Date: Sun, 31 Aug 2025 15:38:14 +0200 Subject: [PATCH 3/3] Fixup script --- .gitignore | 2 +- generate-bindings.sh | 4 ++-- rust-bindings/Cargo.toml | 2 +- rust-bindings/csharp-bindings/Cargo.toml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index fef1d19..e32e011 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,4 @@ bindings/ Cargo.lock *.db-shm -*.db-wal \ No newline at end of file +*.db-wal diff --git a/generate-bindings.sh b/generate-bindings.sh index 7eaaec6..45cd921 100755 --- a/generate-bindings.sh +++ b/generate-bindings.sh @@ -55,8 +55,8 @@ else git remote add --no-fetch origin "${remote}" fi - git fetch --quiet origin - git checkout "${commit}" + git fetch --quiet origin ${commit} --depth 1 + git checkout FETCH_HEAD cd ../.. fi diff --git a/rust-bindings/Cargo.toml b/rust-bindings/Cargo.toml index 9de22c4..60b68b7 100644 --- a/rust-bindings/Cargo.toml +++ b/rust-bindings/Cargo.toml @@ -27,4 +27,4 @@ rusqlite = { package = "libsql-rusqlite", path = "libsql/vendored/rusqlite", ver ] } hyper = { version = "0.14" } tower = { version = "0.4.13" } -zerocopy = { version = "0.7.32", features = ["derive", "alloc"] } \ No newline at end of file +zerocopy = { version = "0.7.32", features = ["derive", "alloc"] } diff --git a/rust-bindings/csharp-bindings/Cargo.toml b/rust-bindings/csharp-bindings/Cargo.toml index 740c3dd..3ba8922 100644 --- a/rust-bindings/csharp-bindings/Cargo.toml +++ b/rust-bindings/csharp-bindings/Cargo.toml @@ -20,4 +20,4 @@ tracing = "0.1.40" tracing-subscriber = "0.3.18" http = "1.1.0" anyhow = "1.0.86" -libsql = { path = "../libsql/libsql", features = ["encryption"] } \ No newline at end of file +libsql = { path = "../libsql/libsql", features = ["encryption"] }