| Name | Date | Size | #Lines | LOC | ||
|---|---|---|---|---|---|---|
| .. | - | - | ||||
| .cargo/ | 03-May-2024 | - | 15 | 10 | ||
| connections/ukey2/ | 03-May-2024 | - | 14,042 | 10,526 | ||
| crypto/ | 03-May-2024 | - | 14,543 | 10,938 | ||
| presence/ | 03-May-2024 | - | 87,673 | 77,253 | ||
| scripts/ | 03-May-2024 | - | 2,927 | 2,777 | ||
| .dockerignore | D | 03-May-2024 | 357 | 18 | 16 | |
| .gitignore | D | 03-May-2024 | 48 | 6 | 5 | |
| Android.bp | D | 03-May-2024 | 4.9 KiB | 195 | 186 | |
| Cargo.lock | D | 03-May-2024 | 53.5 KiB | 2,268 | 2,030 | |
| Cargo.toml | D | 03-May-2024 | 3.2 KiB | 97 | 90 | |
| Dockerfile | D | 03-May-2024 | 2.1 KiB | 57 | 47 | |
| README.android | D | 03-May-2024 | 1.1 KiB | 22 | 16 | |
| README.md | D | 03-May-2024 | 3.4 KiB | 159 | 106 | |
| cargo2android.json | D | 03-May-2024 | 180 | 9 | 8 | |
| deny.toml | D | 03-May-2024 | 9.6 KiB | 219 | 208 |
README.android
1# Import process 2 31. `git pull` to pull a new version from sso://team/beto-rust-devs/beto-rust 4 5## If the dependency tree did not change significantly 6 72. It will be easier to manually update the Android.bp file to include the new dependencies. 8 For each new library that is needed, add it to the `rustlibs` section of the build rule. The 9 build rule is typically `lib<crate_name>`, but sometimes variants with different features exist, 10 in which case you will have to look up the target name in the relevent `Android.bp` file in code 11 search. 12 13## If the dependency tree changed significantly 14 152. Locally check out the `beto-core-staging` project, and run `scripts/prepare-boringssl.sh`. 164. Modify `.cargo/config.toml` to point to the external `rust-openssl` and `bssl-sys` crates. 175. Run `cargo2android.py --config cargo2android.json` 186. There are probably going to be merge conflicts. Fix them manually. Remove the 19 "Do not modify this file" comment added by cargo2android.json 207. Also modify `patches/Android.bp.patch` to include your manual changes. 218. Remove `cargo.out` and `target.tmp`, as those should not be checked in 22
README.md
1# Nearby Rust 2 3## Folder Structure 4 5Root repo of the nearby Rust components, folder structure: 6 7`/connections` nearby connections rust components 8 9`/crypto` shared crypto components 10 11`/presence` nearby presence rust components 12 13## Setup 14 15### Toolchain 16 17If you don't already have a Rust toolchain, see [rustup.rs](https://rustup.rs/). 18 19### Cargo 20 21Install [`cargo-deny`](https://github.com/EmbarkStudios/cargo-deny) 22and [`cargo-fuzz`](https://github.com/rust-fuzz/cargo-fuzz): 23 24``` 25cargo install --locked cargo-deny 26cargo install cargo-fuzz 27``` 28 29### Setting up a Docker dev environment 30 31Our project requires specific versions of system dependencies like OpenSSL and 32protobuf in order to build correctly. To make the setup of this easier you can 33use Docker to handle setting up the environment in a container. 34 35First install Docker then build and run the image: 36 37``` 38sudo docker build -t nearby_rust:v1.0 . 39sudo docker run --rm -it nearby_rust:v1.0 40``` 41 42Building the image creates a snapshot of the environment that has all of the 43system dependencies needed to start building and running all of the artifacts in 44the codebase. 45 46Running the image runs check-everything.sh to verify all of the targets can 47successfully build and all of the tests pass in your new container environment. 48 49To open a bash shell from the container environment: 50 51``` 52sudo docker run -it nearby_rust:v1.0 bash 53``` 54 55You can also setup VSCode 56to [develop in a Docker container on a remote host](https://code.visualstudio.com/remote/advancedcontainers/develop-remote-host) 57that way you can make code changes and test them in the same environment without 58having to re-build the image. 59 60### Installing addlicense Tool 61 62This tool helps lint the project for the correct header files being present and 63is run in check_everything.sh 64 65install go: 66 67```sh 68brew install go 69``` 70 71Then install the addlicense tool to `$HOME/go/bin`: 72 73```sh 74go install github.com/google/addlicense@latest 75``` 76 77Optionally, if you prefer to avoid Go's default `bin` dir that holds build 78output for all go projects, specify the `GOPATH` env var to be the directory to 79install to, e.g. `~/local/addlicense`: 80 81```sh 82GOPATH=~/local/addlicense go install github.com/google/addlicense@latest 83``` 84 85This will put the binary at `~/local/addlicense/bin/addlicense` instead 86of `~/go/bin/addlicense`. 87 88Verify that it works: 89 90```sh 91$HOME/go/bin/addlicense -h 92``` 93 94Then to auto generate the headers run: 95 96```sh 97$HOME/go/bin/addlicense -c "Google LLC" -l apache . 98``` 99 100For more detailed commands see: https://github.com/google/addlicense 101 102## Common tasks 103 104Check everything: 105 106``` 107./scripts/check-everything.sh 108``` 109 110Build everything: 111 112``` 113cargo build --workspace --all-targets 114``` 115 116Run tests: 117 118``` 119cargo test --workspace 120``` 121 122Generate Docs: 123 124``` 125cargo doc --no-deps --workspace --open 126``` 127 128Run linter on dependencies as configured in `deny.toml` <br> 129This will make sure all of our dependencies are using valid licenses and check 130for known existing security 131vulnerabilities, bugs and deprecated versions 132 133``` 134cargo deny --workspace check 135``` 136 137Update dependencies in `Cargo.lock` to their latest in the currently specified 138version ranges (i.e. transitive deps): 139 140``` 141cargo update 142``` 143 144Check for outdated dependencies 145with [cargo-outdated](https://github.com/kbknapp/cargo-outdated): 146 147``` 148cargo outdated 149``` 150 151## Benchmarks 152 153Benchmarks are in `benches`, and use 154[Criterion](https://bheisler.github.io/criterion.rs/book/getting_started.html) . 155 156``` 157cargo bench --workspace 158``` 159