Skip to content

Commit 84842a8

Browse files
committed
New update script
1 parent 5287fa5 commit 84842a8

File tree

3 files changed

+296
-103
lines changed

3 files changed

+296
-103
lines changed

README.md

Lines changed: 41 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,52 +2,57 @@
22

33
This is a Rust API of [Couchbase Lite][CBL], an embedded NoSQL document database engine with sync.
44

5+
The crate wraps the [couchbase-lite-C][CBL_C] releases with an idiomatic Rust API.
6+
57
## Disclaimer
68

7-
This library is **NOT SUPPORTED BY COUCHBASE**, it was forked from Couchbase Labs' repo [couchbase-lite-rust][CBL_RUST]
8-
and finalized.
9-
It is currently used and maintained by Doctolib.
9+
This library is **NOT SUPPORTED BY COUCHBASE**, it was forked from Couchbase Labs' repo [couchbase-lite-rust][CBL_RUST] and finalized.
10+
It is currently used and maintained by [Doctolib][DOCTOLIB] ([GitHub][DOCTOLIB_GH]).
11+
1012
The supported platforms are Windows, macOS, Linux, Android and iOS.
1113

1214
## Building
1315

1416
### 1. Install LLVM/Clang
1517

16-
In addition to [Rust][RUST], you'll need to install LLVM and Clang, which are required by the
17-
[bindgen][BINDGEN] tool that generates Rust FFI APIs from C headers.
18+
In addition to [Rust][RUST], you'll need to install LLVM and Clang, which are required by the [bindgen][BINDGEN] tool that generates Rust FFI APIs from C headers.
1819
Installation instructions are [here][BINDGEN_INSTALL].
1920

20-
### 2. Couchbase Lite For C
21+
### 2. Build!
22+
23+
```shell
24+
$ cargo build
25+
```
26+
27+
## Maintaining
28+
29+
### Couchbase Lite For C
2130

2231
The Couchbase Lite For C shared library and headers ([Git repo][CBL_C]) are already embedded in this repo.
23-
To upgrade the version, start by replacing all the necessary files in the folder libcblite-3.0.3
32+
They are present in the directory `libcblite`.
2433

25-
For Android there is an extra step: stripping the libraries.
26-
Place your terminal to the root of this repo, then follow the instructions below.
34+
### Upgrade Couchbase Lite C
2735

28-
### 2.1. Download
29-
```shell
30-
$ ./download.sh
31-
```
36+
The different releases can be found in [this page][CBL_DOWNLOAD_PAGE].
3237

33-
### 2.2 Strip
38+
Running the following script will download and setup the libraries locally:
3439

3540
```shell
36-
$ DOCKER_BUILDKIT=1 docker build --file Dockerfile -t strip --output libcblite .
41+
$ ./update_cblite_c.sh
3742
```
3843

39-
### 3. Fix The Skanky Hardcoded Paths
40-
41-
Now edit the file `CouchbaseLite/build.rs` and edit the hardcoded paths on lines 32-37.
42-
This tells the crate where to find Couchbase Lite's headers and library, and the Clang libraries.
43-
44-
### 4. Build!
44+
If the command fails on MacOS when downloading the packages, you might need to install wget or a recent bash version:
4545

4646
```shell
47-
$ cargo build
47+
$ brew install wget
48+
$ brew install bash
4849
```
4950

50-
### 5. Test
51+
After that, fix the compilation & tests and you can create a pull request.
52+
53+
New features should also be added to the Rust API at some point.
54+
55+
### Test
5156

5257
**The unit tests must be run single-threaded.** This is because each test case checks for leaks by
5358
counting the number of extant Couchbase Lite objects before and after it runs, and failing if the
@@ -57,7 +62,7 @@ number increases. That works only if a single test runs at a time.
5762
$ LEAK_CHECK=y cargo test -- --test-threads 1
5863
```
5964

60-
### 6. Sanitizer
65+
### Sanitizer
6166

6267
```shell
6368
$ LSAN_OPTIONS=suppressions=san.supp RUSTFLAGS="-Zsanitizer=address" cargo +nightly test
@@ -71,31 +76,34 @@ $ LSAN_OPTIONS=suppressions=san.supp RUSTFLAGS="-Zsanitizer=address" cargo +nigh
7176

7277
## Learning
7378

74-
I've copied the doc-comments from the C API into the Rust files. But Couchbase Lite is fairly
75-
complex, so if you're not already familiar with it, you'll want to start by reading through
76-
the [official documentation][CBLDOCS].
79+
[Official Couchbase Lite documentation][CBL_DOCS]
80+
81+
[C API reference][CBL_API_REFERENCE]
7782

7883
The Rust API is mostly method-for-method compatible with the languages documented there, except
7984
down at the document property level (dictionaries, arrays, etc.) where I haven't yet written
8085
compatible bindings. For those APIs you can check out the document "[Using Fleece][FLEECE]".
8186

82-
(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
83-
`build/couchbase-lite-*/out`, where "`*`" will be some hex string. This is super unlikely to be useful unless you want
84-
to work on improving the high-level bindings themselves.)
85-
86-
8787
[RUST]: https://www.rust-lang.org
8888

8989
[CBL]: https://www.couchbase.com/products/lite
9090

91+
[CBL_DOWNLOAD_PAGE]: https://www.couchbase.com/downloads/?family=couchbase-lite
92+
9193
[CBL_C]: https://github.com/couchbase/couchbase-lite-C
9294

9395
[CBL_RUST]: https://github.com/couchbaselabs/couchbase-lite-rust
9496

95-
[CBLDOCS]: https://docs.couchbase.com/couchbase-lite/current/introduction.html
97+
[CBL_DOCS]: https://docs.couchbase.com/couchbase-lite/current/introduction.html
98+
99+
[CBL_API_REFERENCE]: https://docs.couchbase.com/mobile/3.2.1/couchbase-lite-c/C/html/modules.html
96100

97101
[FLEECE]: https://github.com/couchbaselabs/fleece/wiki/Using-Fleece
98102

99103
[BINDGEN]: https://rust-lang.github.io/rust-bindgen/
100104

101105
[BINDGEN_INSTALL]: https://rust-lang.github.io/rust-bindgen/requirements.html
106+
107+
[DOCTOLIB]: https://www.doctolib.fr/
108+
109+
[DOCTOLIB_GH]: https://github.com/doctolib

download.sh

Lines changed: 0 additions & 70 deletions
This file was deleted.

0 commit comments

Comments
 (0)