diff --git a/README.md b/README.md index 941bdee..d8fecc1 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,8 @@ This is a Rust API of [Couchbase Lite][CBL], an embedded NoSQL document database ## Disclaimer -This library is **NOT SUPPORTED BY COUCHBASE**, it was forked from Couchbase Labs' repo [couchbase-lite-rust][CBL_RUST] and finalized. +This library is **NOT SUPPORTED BY COUCHBASE**, it was forked from Couchbase Labs' repo [couchbase-lite-rust][CBL_RUST] +and finalized. It is currently used and maintained by Doctolib. The supported platforms are Windows, macOS, Linux, Android and iOS. @@ -24,26 +25,16 @@ To upgrade the version, start by replacing all the necessary files in the folder For Android there is an extra step: stripping the libraries. Place your terminal to the root of this repo, then follow the instructions below. -Run Docker: - ``$ docker run --rm --platform linux/amd64 -it -v $(PWD):/build archlinux`` -Install strip: - ``$ pacman -Sy base-devel`` -Strip: - ``$ cd /build/libcblite-3.0.3/lib/x86_64-linux-android - $ strip libcblite.so -o libcblite.stripped.so - $ cd /build/libcblite-3.0.3/lib/i686-linux-android - $ strip libcblite.so -o libcblite.stripped.so`` - -Run docker: - ``$ docker run --rm --platform linux/arm64 -it -v $(PWD):/build debian`` -Install strip: - ``$ apt update && apt install binutils -y`` -Strip: - ``$ cd /build/libcblite-3.0.3/lib/aarch64-linux-android - $ strip libcblite.so -o libcblite.stripped.so - $ cd /build/libcblite-3.0.3/lib/arm-linux-androideabi - $ strip libcblite.so -o libcblite.stripped.so`` +### 2.1. Download +```shell +$ ./download.sh +``` + +### 2.2 Strip +```shell +$ DOCKER_BUILDKIT=1 docker build --file Dockerfile -t strip --output libcblite . +``` ### 3. Fix The Skanky Hardcoded Paths @@ -52,7 +43,9 @@ This tells the crate where to find Couchbase Lite's headers and library, and the ### 4. Build! - $ cargo build +```shell +$ cargo build +``` ### 5. Test @@ -60,19 +53,20 @@ This tells the crate where to find Couchbase Lite's headers and library, and the counting the number of extant Couchbase Lite objects before and after it runs, and failing if the number increases. That works only if a single test runs at a time. - $ LEAK_CHECK=y cargo test -- --test-threads 1 +```shell +$ LEAK_CHECK=y cargo test -- --test-threads 1 +``` ### 6. Sanitizer - $ LSAN_OPTIONS=suppressions=san.supp RUSTFLAGS="-Zsanitizer=address" cargo +nightly test - -**To diag flaky test** +```shell +$ LSAN_OPTIONS=suppressions=san.supp RUSTFLAGS="-Zsanitizer=address" cargo +nightly test +``` - $ LSAN_OPTIONS=suppressions=san.supp RUSTFLAGS="-Zsanitizer=address" cargo +nightly test --verbose --features=flaky-test flaky +**To diag flaky test** -### 7. Strip libraries -``` -DOCKER_BUILDKIT=1 docker build --file Dockerfile -t strip --output libcblite . +```shell +$ LSAN_OPTIONS=suppressions=san.supp RUSTFLAGS="-Zsanitizer=address" cargo +nightly test --verbose --features=flaky-test flaky ``` ## Learning @@ -85,14 +79,23 @@ The Rust API is mostly method-for-method compatible with the languages documente down at the document property level (dictionaries, arrays, etc.) where I haven't yet written compatible bindings. For those APIs you can check out the document "[Using Fleece][FLEECE]". -(FYI, if you want to see what bindgen's Rust translation of the C API looks like, it's in the file `bindings.rs` in `build/couchbase-lite-*/out`, where "`*`" will be some hex string. This is super unlikely to be useful unless you want to work on improving the high-level bindings themselves.) +(FYI, if you want to see what bindgen's Rust translation of the C API looks like, it's in the file `bindings.rs` in +`build/couchbase-lite-*/out`, where "`*`" will be some hex string. This is super unlikely to be useful unless you want +to work on improving the high-level bindings themselves.) [RUST]: https://www.rust-lang.org + [CBL]: https://www.couchbase.com/products/lite + [CBL_C]: https://github.com/couchbase/couchbase-lite-C + [CBL_RUST]: https://github.com/couchbaselabs/couchbase-lite-rust + [CBLDOCS]: https://docs.couchbase.com/couchbase-lite/current/introduction.html + [FLEECE]: https://github.com/couchbaselabs/fleece/wiki/Using-Fleece + [BINDGEN]: https://rust-lang.github.io/rust-bindgen/ + [BINDGEN_INSTALL]: https://rust-lang.github.io/rust-bindgen/requirements.html diff --git a/download.sh b/download.sh index 64d354a..33aa325 100755 --- a/download.sh +++ b/download.sh @@ -57,7 +57,7 @@ function download() { fi } -download ubuntu20.04-x86_64.tar.gz +download linux-x86_64.tar.gz download windows-x86_64.zip download macos.zip download android.zip