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 7feceaf..45cd921 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 ${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 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 diff --git a/rust-bindings/Cargo.toml b/rust-bindings/Cargo.toml index 7b05dd4..60b68b7 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"] } diff --git a/rust-bindings/csharp-bindings/Cargo.toml b/rust-bindings/csharp-bindings/Cargo.toml index f66531d..3ba8922 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"] }