-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.rs
More file actions
executable file
·38 lines (32 loc) · 868 Bytes
/
Copy pathbuild.rs
File metadata and controls
executable file
·38 lines (32 loc) · 868 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#[cfg(windows)]
extern crate winres;
use std::process::Command;
#[cfg(windows)]
fn main() {
let version = git_semver();
set_env(&version);
let mut res = winres::WindowsResource::new();
res.set_icon("app.ico")
.set_language(0x0409)
.set("FileDescription", &format!("bincrypt {}", version));
res.compile().unwrap();
}
#[cfg(not(windows))]
fn main() {
set_env(&git_semver());
}
fn git_semver() -> String {
let cmd = Command::new("git")
.args(&["describe", "--always", "--dirty=-dirty"])
.output()
.unwrap();
assert!(cmd.status.success());
std::str::from_utf8(&cmd.stdout[..])
.unwrap()
.trim()
.to_string()
}
fn set_env(version: &str) {
println!("cargo:rustc-env=GIT_PKG_VERSION_SEMVER={}", version);
println!("cargo:rerun-if-changed=(nonexistentfile)");
}