Skip to content

Commit

Permalink
chore(BIC-9999): update download.sh and README.md (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
xdm67x authored Oct 2, 2024
1 parent cde9aba commit 46c2d77
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 31 deletions.
63 changes: 33 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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

Expand All @@ -52,27 +43,30 @@ This tells the crate where to find Couchbase Lite's headers and library, and the

### 4. Build!

$ cargo build
```shell
$ cargo build
```

### 5. Test

**The unit tests must be run single-threaded.** This is because each test case checks for leaks by
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
Expand All @@ -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
2 changes: 1 addition & 1 deletion download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 46c2d77

Please sign in to comment.