[][src]Crate build_info_build

Begin by adding build-info as a [dependency] and build-info-build as a [build-dependency] to your Cargo.toml. Please make sure that both dependencies use the same version!

If it does not already exist, add a build.rs to your project's root, where you call build_info_build::build_script(). This will collect build information at compile time.

Then, either use the build_info! macro to add a function that returns version information at runtime:

build_info::build_info!(fn version);

or use build_info::format! to generate a string at compile time:

// sample output: "{sample v0.0.6 built with rustc version 1.43.1 8d69840ab92ea7f4d323420088dd8c9775f180cd at 2020-05-28 20:09:40.379213639Z}"
build_info::format!("{{{.crate_info.name} v{.crate_info.version} built with rustc version {.compiler.version} {.compiler.commit_id} at {.timestamp}}}")

You can also check out the sample project that shows both variants.

Features

The ´build-info-build` crate has the following features:

  • git (enabled by default): Enables git support. A git repository will only be detected if this feature is available.

Functions

build_script

Call this function in your build.rs script to generate the data consumed by the build_info crate.