Skip to content

Commit be60ecb

Browse files
copy build.rs from jcli crate
1 parent 502f473 commit be60ecb

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

jcli-lib/build.rs

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
fn main() {
2+
let pkg_version = if let Ok(date) = std::env::var("DATE") {
3+
format!("{}.{}", env!("CARGO_PKG_VERSION"), date)
4+
} else {
5+
env!("CARGO_PKG_VERSION").to_string()
6+
};
7+
8+
println!("cargo:rustc-env=CARGO_PKG_VERSION={}", pkg_version);
9+
10+
let version = versionisator::Version::new(
11+
env!("CARGO_MANIFEST_DIR"),
12+
env!("CARGO_PKG_NAME").to_string(),
13+
pkg_version,
14+
);
15+
16+
println!("cargo:rustc-env=FULL_VERSION={}", version.full());
17+
println!("cargo:rustc-env=SIMPLE_VERSION={}", version.simple());
18+
println!("cargo:rustc-env=SOURCE_VERSION={}", version.hash());
19+
}

0 commit comments

Comments
 (0)