Commit Graph

21 Commits

Author SHA1 Message Date
Adrian Duke caee776c38 log: New crate for logger implementations
Move logging-related module `radicle::logging` into its own crate.

While at it, remove the "logger" feature flag from `radicle`.

Co-authored-by: Lorenz Leutgeb <lorenz.leutgeb@radicle.dev>
2026-05-11 16:44:37 +01:00
Lorenz Leutgeb 9ea040ccd0 rust/msrv: 1.85.0 → 1.88.0
`cargo check` fails because `human-panic` and `sysinfo` require at least
1.88.0.

    +++ command cargo check --release --locked --all-targets
    error: rustc 1.85.0 is not supported by the following packages:
      human-panic@2.0.6 requires rustc 1.88
      sysinfo@0.37.2 requires rustc 1.88

Bump MSRV to fix this.

1.88.0 introduced [let chains], which in turn has `clippy` warn about
nested if statements. All of these sites are fixed in this change.

1.87.0 introduced [`is_multiple_of`], which is a more readable version
of `x % y == 0`.

[let chains]: https://blog.rust-lang.org/2025/06/26/Rust-1.88.0/#let-chains
[`is_multiple_of`]: https://doc.rust-lang.org/std/primitive.usize.html#method.is_multiple_of
2026-05-11 11:23:18 +01:00
Lorenz Leutgeb ca732015fb
clippy: Disallow lints `collapsible_*`
The three lints `collapsible_{if,else_if,match}` are disallowed.
2026-04-15 10:06:05 +02:00
Richard Levitte adfd89f609 cli-test: Respect `CARGO_TARGET_DIR`
`radicle-cli-test` initiates `cargo` builds under the assumption
that the target directory is always within the source directory.
However, the user may have a different idea, specified with the
environment variable `CARGO_TARGET_DIR` (supported by `cargo`, see
https://doc.rust-lang.org/cargo/reference/environment-variables.html).

Add support for `CARGO_TARGET_DIR`, with a fallback to 'target'
at the top of the source tree if `CARGO_TARGET_DIR` is undefined.
2026-04-15 00:18:39 +02:00
Lorenz Leutgeb 119445ce6c
cli-test: Move `let mut args` closer to its uses
In case a `cd` command is to be processed, no replacement of
environment variables in arguments is performed. This means that the
definition of `let mut args` and the replacement itself can be moved
closer to where `args` is then actually used, which is easier to
reason about.
2026-02-17 20:19:26 +01:00
Lorenz Leutgeb 56ece480ee
cli-test: Remove special handling for `rad`
The special handling for `rad` was introduced in commit
`e63f33489055962845c70976bd9a40d0d84c6b1c` without further comment.

Since we control the `$PATH` for spawning `rad`, and it is clear
that `rad` must be on the path, we do not need any special handing.

See also:
 - https://doc.rust-lang.org/std/process/struct.Command.html#method.new
 - https://github.com/rust-lang/rust/issues/15149
 - https://github.com/rust-lang/rust/issues/37519
2026-02-17 20:16:29 +01:00
Lorenz Leutgeb 3cd1af1dd5
cli-test: Configure `escargot` properly
Configuration calls to `escargot` were removed in commit `4894657b`.
An unintentional consequence are spurious failures to invoke freshly
compiled binaries in CLI tests.

Bring back the explicit configuration to remedy.
2026-02-17 18:59:59 +01:00
Lorenz Leutgeb 5aca9bf16a
cli-test: Refactor Path Handling
In the previous refactoring in commit `4894657b`, the order of entries
in `$PATH` was changed unintentionally. Revisit the order and use
nicer APIs to handle paths.
2026-02-17 18:59:59 +01:00
Lorenz Leutgeb ed2b36cf9c cli-test: Log line of assertion being executed 2026-02-16 08:39:55 +00:00
Lorenz Leutgeb 9055a2043c cli-test: Add placeholder for executable extension
Help text generated by `clap` contains the full file name (including
extension) of the binary. On Unix-like systems, binaries commonly do not
have any file extension. On Windows, ".exe" is common.

To allow testing such output, introduce a new marker "[EXE]" that is 
substituted accordingly. The idea and syntax is taken from
https://docs.rs/trycmd/1.0.0/trycmd/#toml
2026-02-16 08:39:55 +00:00
Lorenz Leutgeb e831aeb57b cli-test: Do not store `bins` 2026-02-16 08:39:55 +00:00
Lorenz Leutgeb 8fbdd46ce4 cli-test: Cheat to find coreutils on Windows 2026-02-16 08:39:55 +00:00
Lorenz Leutgeb 4894657bcb cli-test: Simplify cargo path handling 2026-02-16 08:39:55 +00:00
Lorenz Leutgeb 25d1974c60 cli-test: Deduplicate populating `bins` 2026-02-16 08:39:55 +00:00
Lorenz Leutgeb 44f52f4c18 cli-test: Fix uses of `PATH_SEPARATOR`
Some occurrences of ":" literals were missed earlier.
2026-02-16 08:39:55 +00:00
Lorenz Leutgeb 930ec175f1
term, cli: `winsplit` over `shlex` on Windows
Command line parsing differs on Windows vs. POSIX compliant operating
systems (just consider the differences in handling `\` for paths vs. as
a marker for escape sequences). Thus, on Windows use `winsplit` to
split command arguments instead of `shlex` for Unix-like OSes.

`winsplit` is a small crate with no other dependencies.
2026-02-11 10:26:22 +01:00
Lorenz Leutgeb ffbbb374c1 cli-test: Path separation compatible with Windows
Running tests on Windows requires separating the path to executables by
`;`.
2026-02-10 09:55:46 +00:00
Yaroslav Halchenko 32d77641ab chore: Fix spelling errors with codespell 2025-11-01 12:11:02 +01:00
Lorenz Leutgeb fd5043d572 radicle-cli-test: Prepare testing with `jj`
Most of this is taken from Jujutsu's own testing setup, see:
98d884827e/cli/tests/common/test_environment.rs (L106-L150)

Not all features are preserved, but this is good enough.
2025-09-26 12:03:01 +01:00
Lorenz Leutgeb d7b48b9e29 radicle: Move logging setup calls to binaries 2025-08-07 08:30:59 +01:00
Lorenz Leutgeb 5bc2dc677b repo: Move workspace crates into `crates` subdirectory
This keeps the top level of the repo cleaner, e.g.
<https://github.com/radicle-dev/heartwood> scrolls less and
<https://app.radicle.xyz/nodes/rosa.radicle.xyz/rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5/>
might show more files at the top level.

This way we also don't have to explicitly name all crates in
`Cargo.toml`.
2025-06-09 15:09:21 +02:00
Renamed from radicle-cli-test/src/lib.rs (Browse further)