build_metadata

Crates.iobuild_metadata
lib.rsbuild_metadata
version0.1.0
sourcesrc
created_at2017-08-28 10:34:04.93278
updated_at2017-08-28 10:34:04.93278
descriptionembed repository metadata in your code at compile time
homepage
repositoryhttps://github.com/Geal/build-metadata
max_upload_size
id29570
size5,696
Geoffroy Couprie (Geal)

documentation

http://docs.rs/build-metadata/

README

Build metadata

use this crate to embed repository and build metadata at compile time

This project uses procedural macros to provide you with this metadata, exposing three macros:

  • head!(): the name of the current git branch or tag you are in
  • commit!(): short git commit id
  • time!(): UTC build time. This value is cached, so it will stay the same for every call in one crate. Note that using this makes the build non reproducible (since the resulting binary will change depending on build time)

Usage

Import it with cargo from crates.io by adding this to you Cargo.toml` file:

[dependencies]
build_metadata = "^0.1"
#![feature(plugin)]
#![plugin(build_metadata)]

fn main() {
    println!("build time: {}", time!());
    println!("head: {}", head!());
    println!("commit id: {}", commit!());
}
Commit count: 11

cargo fmt