-
-
Notifications
You must be signed in to change notification settings - Fork 584
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
encode nightly version, commit, date into binary
- Loading branch information
1 parent
92e0fac
commit 89e9f85
Showing
8 changed files
with
84 additions
and
46 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
fn get_git_hash() -> String { | ||
use std::process::Command; | ||
|
||
let commit = Command::new("git") | ||
.arg("rev-parse") | ||
.arg("--short") | ||
.arg("--verify") | ||
.arg("HEAD") | ||
.output(); | ||
if let Ok(commit_output) = commit { | ||
let commit_string = | ||
String::from_utf8_lossy(&commit_output.stdout); | ||
|
||
return commit_string.lines().next().unwrap_or("").into(); | ||
} | ||
|
||
panic!("Can not get git commit: {}", commit.unwrap_err()); | ||
} | ||
|
||
fn main() { | ||
let build_name = if std::env::var("GITUI_RELEASE").is_ok() { | ||
format!( | ||
"{} {} ({})", | ||
env!("CARGO_PKG_VERSION"), | ||
compile_time::date_str!(), | ||
get_git_hash() | ||
) | ||
} else { | ||
format!( | ||
"nightly {} ({})", | ||
compile_time::date_str!(), | ||
get_git_hash() | ||
) | ||
}; | ||
|
||
println!("cargo:warning=buildname '{}'", build_name); | ||
println!("cargo:rustc-env=GITUI_BUILD_NAME={}", build_name); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.