From 9d773e947bf10da95817b6d7812a685693211754 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20DOUIN?= Date: Sat, 11 Jan 2025 08:53:13 +0100 Subject: [PATCH] docs(contributing): add dependencies overriding section Refs: --- CONTRIBUTING.md | 65 ++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 56 insertions(+), 9 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4ad0fa0f..fb5f8773 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,19 +4,66 @@ Thank you for investing your time in contributing to Himalaya CLI! ## Development -The development environment is managed by [Nix](https://nixos.org/download.html). Running `nix-shell` will spawn a shell with everything you need to get started with the lib: `cargo`, `cargo-watch`, `rust-bin`, `rust-analyzer`, `notmuch`… +The development environment is managed by [Nix](https://nixos.org/download.html). +Running `nix-shell` will spawn a shell with everything you need to get started with the lib. -```sh -# Start a Nix shell -$ nix-shell +If you do not want to use Nix, you can either use [rustup](https://rust-lang.github.io/rustup/index.html): -# then build the CLI -$ cargo build - -# run the CLI -$ cargo run --feature pgp-gpg -- envelope list +```text +rustup update ``` +or install manually the following dependencies: + +- [cargo](https://doc.rust-lang.org/cargo/) (`v1.82`) +- [rustc](https://doc.rust-lang.org/stable/rustc/platform-support.html) (`v1.82`) + +## Build + +```text +cargo build +``` + +You can disable default [features](https://doc.rust-lang.org/cargo/reference/features.html) with `--no-default-features` and enable features with `--features feat1,feat2,feat3`. + +Finally, you can build a release with `--release`: + +```text +cargo build --no-default-features --features imap,smtp,keyring --release +``` + +## Override dependencies + +If you want to build Himalaya CLI with a dependency installed locally (for example `email-lib`), then you can [override it](https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html) by adding the following lines at the end of `Cargo.toml`: + +```toml +[patch.crates-io] +email-lib = { path = "/path/to/email-lib" } +``` + +If you get the following error: + +```text +note: perhaps two different versions of crate email are being used? +``` + +then you may need to override more Pimalaya's sub-dependencies: + +```toml +[patch.crates-io] +email-lib.path = "/path/to/core/email" +imap-client.path = "/path/to/imap-client" +keyring-lib.path = "/path/to/core/keyring" +mml-lib.path = "/path/to/core/mml" +oauth-lib.path = "/path/to/core/oauth" +pgp-lib.path = "/path/to/core/pgp" +pimalaya-tui.path = "/path/to/tui" +process-lib.path = "/path/to/core/process" +secret-lib.path = "/path/to/core/secret" +``` + +*See [pimalaya/core#32](https://github.com/pimalaya/core/issues/32) for more information.* + ## Commit style Starting from the `v1.0.0`, Himalaya CLI tries to adopt the [conventional commits specification](https://github.com/conventional-commits/conventionalcommits.org).