cargo-deluxe is a seamless wrapper over Rust's cargo, altering (enhancing)
its functionality.
This project is a clean reimplementation of a bunch of shell script wrappers and hacks that I keep needing in dev environments and CIs of Rust projects I work with.
This is primarily a private project that supports a couple of dev teams and our projects. But as long as this goal is not compromised, and I'm happy to support external users as well as I can.
It's a direct rewrite of shell scripts that we've been using for more than a year now.
If you're planning to use it, please expect some rough edges. The source code is small and simple.
This repo is a standard Rust project, with a Nix flake included. If you're thinking about using it, you should know how to handle it already.
Set env RUST_LOG=cargo-deluxe=trace for some basic logging.
cargo-delux provides cargo and rustc binaries, that need to be added
to the PATH before the original ones from the Rust toolchain.
cargo wrapper binary uses a neat interception logic to look up all cargo
binaries in the PATH, and call the one after itself. See bin-intercept crate
for the implementation.
In a sane and well-designed CI pipeline, one of the first steps is building the source
code, after which point no invocation of cargo should require any further compilation.
Accidentally breaking this structure can cause surprising and hard to debug issues. E.g.
parallelized cargo test invocations to run a subset of test, would easily overwhelm
the building system if they all started to re-compile the project.
With cargo-delux, setting CARGO_DENY_BUILD=1 will cause all cargo commands that
would lead to compilation to return an error immediately.
A lot -sys dependencies require setting various environment variables to control
the compilation process. Unfortunately oftentimes different target architectures
require different settings, with the build.rs script of the -sys dependency
implementing no ability to set them independently.
With cargo-deluxe, it is possible to set:
CARGO_TARGET_SPECIFIC_ENVS=FOO_target,BAR_target_BAZ
FOO_x86_64_unknown_linux_gnu=bar
BAR_aarch64_linux_android_BAZ=woo
This will cause FOO=bar only when compiling for x86_64 architecture target,
and BAR_BAZ=woo when compiling for aarch64 android target.
Now that I have a reusable and easy to extend implementation, I might add various other features, similar to "Cargo presets", etc.