Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ bindings/
Cargo.lock

*.db-shm
*.db-wal
*.db-wal
49 changes: 31 additions & 18 deletions generate-bindings.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 ${commit} --depth 1
git checkout FETCH_HEAD
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
2 changes: 1 addition & 1 deletion rust-bindings/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
libsql/
libsql
target/
bindings/
Cargo.lock
14 changes: 13 additions & 1 deletion rust-bindings/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"] }
8 changes: 6 additions & 2 deletions rust-bindings/csharp-bindings/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }