Bosion
Gather build information for verbose versions flags.
- API documentation.
- Licensed under Apache 2.0 or MIT.
- Status: maintained.
Quick start
In your Cargo.toml:
[]
= "1.1.3"
In your build.rs:
In your src/main.rs:
include!;
Advanced usage
Generating a struct with public visibility:
// build.rs
gather_pub;
Customising the output file and struct names:
// build.rs
gather_to;
Outputting build-time environment variables instead of source:
// build.rs
gather_to_env;
// src/main.rs
Custom env prefix:
// build.rs
gather_to_env_with_prefix;
Features
reproducible: readsSOURCE_DATE_EPOCH(default).git: enables gathering git information (default).std: enables thelong_version_withmethod (default). Specifically, this is about the downstream crate's std support, not Bosion's, which always requires std.
Why not...?
- bugreport: runtime library, for bug information.
- git-testament: uses the
gitCLI instead of gitoxide. - human-panic: runtime library, for panics.
- shadow-rs: uses libgit2 instead of gitoxide, doesn't rebuild on git changes.
- vergen: uses the
gitCLI instead of gitoxide.
Bosion also requires no dependencies outside of build.rs, and was specifically made for crates
installed in a variety of ways, like with cargo install, from pre-built binary, from source with
git, or from source without git (like a tarball), on a variety of platforms. Its default output with
clap is almost exactly like rustc -Vv.
Examples
The examples directory contains a practical and runnable clap-based example, as well as several other crates which are actually used for integration testing.
Here is the output for the Watchexec CLI:
watchexec 1.21.1 (5026793 2023-03-05)
commit-hash: 5026793a12ff895edf2dafb92111e7bd1767650e
commit-date: 2023-03-05
build-date: 2023-03-05
release: 1.21.1
features:
For comparison, here's rustc -Vv:
rustc 1.67.1 (d5a82bbd2 2023-02-07)
binary: rustc
commit-hash: d5a82bbd26e1ad8b7401f6a718a9c57c96905483
commit-date: 2023-02-07
host: x86_64-unknown-linux-gnu
release: 1.67.1
LLVM version: 15.0.6