#build-script #version #information #display #handy

build versionisator

Tool for build.rs script to display handy version information

6 stable releases

1.2.0 Jul 23, 2022
1.1.0 Oct 22, 2021
1.0.3 Dec 18, 2020
1.0.2 Oct 7, 2019
1.0.1 Sep 1, 2019

#375 in Build Utils

Download history 72/week @ 2024-07-25 49/week @ 2024-08-01 31/week @ 2024-08-08 46/week @ 2024-08-15 18/week @ 2024-08-22 28/week @ 2024-08-29 11/week @ 2024-09-05 28/week @ 2024-09-12 59/week @ 2024-09-19 59/week @ 2024-09-26 86/week @ 2024-10-03 28/week @ 2024-10-10 62/week @ 2024-10-17 14/week @ 2024-10-24 73/week @ 2024-10-31 19/week @ 2024-11-07

175 downloads per month

MIT/Apache

11KB
206 lines

Versionator: version information for build script

Crates.io

Documentation

Usage

First, add this to your Cargo.toml:

[dependencies]
versionisator = "1.0"

Next, add this to your build script (build.rs):

extern crate versionisator;

fn main() {
    let version = versionisator::Version::new(
        env!("CARGO_MANIFEST_DIR"),
        env!("CARGO_PKG_NAME").to_string(),
        env!("CARGO_PKG_VERSION").to_string()
    );

    println!("cargo:rustc-env=FULL_VERSION={}", version.full());
    println!("cargo:rustc-env=SIMPLE_VERSION={}", version.simple());
    println!("cargo:rustc-env=SOURCE_VERSION={}", version.hash());
}

FULL_VERSION will give you:

versionator 1.0.0 (master-3326b9b+, debug, mac [x86_64]) - [rustc 1.37.0 (eae3437df 2019-08-13)]
\_________/ \___/  \____/ \_____/|  \___/  \_/  \____/      \_________________________________/
 |           |      |      |     |   |      |      |           |
 |           |      |      |     |   |      |      |           +- rustc --version
 |           |      |      |     |   |      |      +- std::env::consts::ARCH
 |           |      |      |     |   |      +- std::env::consts::OS
 |           |      |      |     |   +- Checks debug_assertions
 |           |      |      |     +- Adds a "+" if the working tree is not clean
 |           |      |      +- Commit hash
 |           |      +- Current branch name
 |           +- Package version from Cargo.toml
 +- Package name from Cargo.toml

Credits

This package is inspired from input-output-hk/jormungandr/719 itself inspired from https://vallentin.io/2019/06/06/versioning which served as guide for the idea and the code.

License

This project is licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in bawawa by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~195KB