Skip to content

Commit 1193126

Browse files
authored
Update libsql to 0.9.21 (#35)
* update bindings script * update Cargo.toml for new version * Fixup script
1 parent af5259d commit 1193126

5 files changed

Lines changed: 52 additions & 23 deletions

File tree

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ bindings/
1010
Cargo.lock
1111

1212
*.db-shm
13-
*.db-wal
13+
*.db-wal

generate-bindings.sh

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,30 @@ set -euo pipefail
33

44
script_dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
55

6-
export LIBSQL_RS_VERSION="0.5.0"
76
bindings_dir="${script_dir}/rust-bindings"
87
force=false
8+
commit="${LIBSQL_COMMIT:-libsql-0.9.21}"
9+
remote="${LIBSQL_REMOTE:-https://github.com/tursodatabase/libsql.git}"
10+
local_repo_path=""
911

10-
# Parse command line arguments
1112
while [[ $# -gt 0 ]]; do
1213
case "$1" in
1314
--force)
1415
force=true
1516
shift
1617
;;
18+
--commit)
19+
commit="$2"
20+
shift 2
21+
;;
22+
--remote)
23+
remote="$2"
24+
shift 2
25+
;;
26+
--local)
27+
local_repo_path="$2"
28+
shift 2
29+
;;
1730
*)
1831
echo "Unknown option: $1"
1932
exit 1
@@ -29,23 +42,23 @@ function run_if_force {
2942

3043
run_if_force rm -rf "${bindings_dir}/libsql"
3144
run_if_force rm -rf "${bindings_dir}/target"
32-
mkdir -p "${bindings_dir}/libsql"
45+
mkdir -p "${bindings_dir}"
3346

34-
cd "${bindings_dir}/libsql"
35-
git init 2> /dev/null
47+
if [[ -n "${local_repo_path}" ]]; then
48+
ln -sfn "${local_repo_path}" "${bindings_dir}/libsql"
49+
else
50+
mkdir -p "${bindings_dir}/libsql"
51+
cd "${bindings_dir}/libsql"
52+
git init 2> /dev/null
53+
54+
if ! git config remote.origin.url &> /dev/null;then
55+
git remote add --no-fetch origin "${remote}"
56+
fi
3657

37-
if ! git config remote.origin.url &> /dev/null;then
38-
git remote add --no-fetch origin "https://github.com/tursodatabase/libsql.git"
58+
git fetch --quiet origin ${commit} --depth 1
59+
git checkout FETCH_HEAD
60+
cd ../..
3961
fi
4062

41-
# git sparse-checkout init
42-
# git sparse-checkout set bindings/c bindings/wasm libsql libsql-sys
43-
# -----
44-
# git fetch --quiet origin
45-
# git checkout fb85262
46-
# -----
47-
git fetch --depth 1 origin tag libsql-rs-v${LIBSQL_RS_VERSION}
48-
git reset --hard tags/libsql-rs-v${LIBSQL_RS_VERSION}
49-
50-
cd ..
51-
cargo build --release
63+
cd "${bindings_dir}"
64+
cargo build --lib --release

rust-bindings/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
libsql/
1+
libsql
22
target/
33
bindings/
44
Cargo.lock

rust-bindings/Cargo.toml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,19 @@ members = [
44
"libsql/bindings/c"
55
]
66

7+
[workspace.package]
8+
edition = "2021"
9+
authors = ["the libSQL authors"]
10+
version = "0.9.21"
11+
license = "MIT"
12+
repository = "https://github.com/tursodatabase/libsql"
13+
714
[workspace.dependencies]
8-
rusqlite = { package = "libsql-rusqlite", path = "libsql/vendored/rusqlite", version = "0.32", default-features = false, features = [
15+
libsql-ffi = { path = "libsql/libsql-ffi", version = "0.9.21" }
16+
libsql-sys = { path = "libsql/libsql-sys", version = "0.9.21", default-features = false }
17+
libsql-hrana = { path = "libsql/libsql-hrana", version = "0.9.21" }
18+
libsql_replication = { path = "libsql/libsql-replication", version = "0.9.21" }
19+
rusqlite = { package = "libsql-rusqlite", path = "libsql/vendored/rusqlite", version = "0.9.21", default-features = false, features = [
920
"libsql-experimental",
1021
"column_decltype",
1122
"load_extension",
@@ -16,3 +27,4 @@ rusqlite = { package = "libsql-rusqlite", path = "libsql/vendored/rusqlite", ver
1627
] }
1728
hyper = { version = "0.14" }
1829
tower = { version = "0.4.13" }
30+
zerocopy = { version = "0.7.32", features = ["derive", "alloc"] }

rust-bindings/csharp-bindings/Cargo.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,15 @@ path = "../libsql/bindings/c/src/lib.rs"
99
doc = false
1010

1111
[build-dependencies]
12-
csbindgen = "1.2.0"
12+
csbindgen = "1.9.5"
1313

1414
[dependencies]
1515
bytes = "1.5.0"
16-
libsql = { path = "../libsql/libsql" }
1716
lazy_static = "1.4.0"
1817
tokio = { version = "1.29.1", features = [ "rt-multi-thread" ] }
1918
hyper-rustls = { version = "0.25", features = ["webpki-roots"]}
19+
tracing = "0.1.40"
20+
tracing-subscriber = "0.3.18"
21+
http = "1.1.0"
22+
anyhow = "1.0.86"
23+
libsql = { path = "../libsql/libsql", features = ["encryption"] }

0 commit comments

Comments
 (0)