A small tool to help you generate version information for packages installed from a git repo
Add a build.rs
file to your repo and list it in Cargo.toml
toml
build = "build.rs"
List rustctoolsutil as regular AND build dependency. ````toml [dependencies] rustctoolsutil = "0.3.0"
[build-dependencies] rustctoolsutil = "0.3.0" ````
In build.rs
, generate the data in your main()
rust
fn main() {
rustc_tools_util::setup_version_info!();
}
Use the version information in your main.rs
rust
fn show_version() {
let version_info = rustc_tools_util::get_version_info!();
println!("{}", version_info);
}
This gives the following output in clippy:
clippy 0.1.66 (a28f3c8 2022-11-20)
This project is part of the rust-lang/rust-clippy repository. The source code
can be found under ./rustc_tools_util/
.
The changelog for rustc_tools_util
is available under:
rustc_tools_util/CHANGELOG.md
Copyright 2014-2022 The Rust Project Developers
Licensed under the Apache License, Version 2.0