feat: add shadow-rs
This commit is contained in:
39
__misc/shadowrs/src/main.rs
Normal file
39
__misc/shadowrs/src/main.rs
Normal file
@@ -0,0 +1,39 @@
|
||||
#[macro_use]
|
||||
extern crate shadow_rs;
|
||||
|
||||
shadow!(build);
|
||||
|
||||
fn main() {
|
||||
|
||||
//shadow-rs built in function
|
||||
println!("{}", shadow_rs::is_debug()); // check if this is a debug build
|
||||
println!("{}", shadow_rs::branch()); // get current project git branch. e.g.'master'
|
||||
println!("{}", shadow_rs::tag()); // get current project git head tag. e.g.'v1.5.3'
|
||||
|
||||
//shadow-rs built in const
|
||||
println!("{}", build::version()); // the version (description binary detail information)
|
||||
println!("{}", build::clap_version()); // usually used by clap crates version() (description binary detail information)
|
||||
println!("{}", build::PKG_VERSION); // current package version. e.g. '1.3.15-beta2'
|
||||
println!("{}", build::PKG_VERSION_MAJOR); //current package major version. e.g. '1'
|
||||
println!("{}", build::PKG_VERSION_MINOR); //current package minor version. e.g. '3'
|
||||
println!("{}", build::PKG_VERSION_PATCH); //current package minor version. e.g. '15'
|
||||
println!("{}", build::PKG_VERSION_PRE); //current package minor version. e.g. 'beta2'
|
||||
println!("{}", build::BRANCH); // the branch, e.g. 'master'
|
||||
println!("{}", build::TAG); // the tag, e.g. 'v1.0.0'
|
||||
println!("{}", build::SHORT_COMMIT); // short commit hash, e.g. '8405e28e'
|
||||
println!("{}", build::COMMIT_HASH); // full commit hash, e.g. '8405e28e64080a09525a6cf1b07c22fcaf71a5c5'
|
||||
println!("{}", build::COMMIT_DATE); // commit date, e.g. '2020-08-16 11:52:47'
|
||||
println!("{}", build::COMMIT_AUTHOR); // commit author, e.g. 'baoyachi'
|
||||
println!("{}", build::COMMIT_EMAIL); // commit email, e.g. 'example@gmail.com'
|
||||
|
||||
println!("{}", build::BUILD_OS); // the OS that built the binary, e.g. 'macos-x86_64'
|
||||
println!("{}", build::RUST_VERSION); // rustc version e.g. 'rustc 1.45.0 (5c1f21c3b 2020-07-13)'
|
||||
println!("{}", build::RUST_CHANNEL); // rust toolchain e.g. 'stable-x86_64-apple-darwin (default)'
|
||||
println!("{}", build::CARGO_VERSION); // cargo version e.g. 'cargo 1.45.0 (744bd1fbb 2020-06-15)'
|
||||
println!("{}", build::CARGO_TREE); // e.g. the output of '$ cargo tree'
|
||||
|
||||
println!("{}", build::PROJECT_NAME); // your project name, e.g. 'shadow-rs'
|
||||
println!("{}", build::BUILD_TIME); // time when start build occurred, e.g. '2020-08-16 14:50:25'
|
||||
println!("{}", build::BUILD_RUST_CHANNEL); // e.g. 'debug'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user