#build #git #git-version #version #extra

build z1info_rust

Add extra information to the binary package through cargo run [...] z1info=extra_information

4 releases

0.1.4 May 24, 2021
0.1.3 May 24, 2021
0.1.2 May 24, 2021
0.1.1 May 24, 2021
0.1.0 May 23, 2021

#591 in Build Utils

MIT/Apache

11KB
127 lines

z1info_rust

Add extra information to the binary package through cargo run [...] z1info=extra_information

Use

add dependencies

  • z1info_rust = "0.1.3"

add code

fn main() {
    z1info_rust::run("z1template");
    // z1info_test::run("z1_info:{z1_info},git_info:{git_info},build_time:{build_time}");
}

run command

z1info= must be placed at the end of the command line,cargo runwill write extra information to tmp file.

  • cargo run p1 p2 z1info=version:1.2.3,compiler:myzero1

build

  • cargo clean && cargo build
  • OR cargo clean && cargo build --release

Result

run command or run builded binary package

  • cargo clean && cargo run p1 p2
  • OR run builded binary package

The Result


=============== z1info extended data ====================
| Extended data added to binary file through z1info.
|--------------- z1info parameter ----------------------
| z1info=version:1.2.3,compiler:myzero1
|--------------- git info ------------------------------
| commit id: 94896476ea1696f9b8764cd845f225e4af586bc4
|--------------- build time ----------------------------
| 1621770625
=========================================================

No runtime deps