-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplifies getting the information we actually need, without using another dependency. Ref #1035
- Loading branch information
1 parent
dbd7bfb
commit 26e9937
Showing
5 changed files
with
36 additions
and
93 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 |
---|---|---|
@@ -1,6 +1,25 @@ | ||
use std::io; | ||
|
||
use duct::cmd; | ||
|
||
fn main() { | ||
build_data::set_GIT_COMMIT(); | ||
build_data::set_RUSTC_VERSION(); | ||
build_data::set_SOURCE_TIMESTAMP(); | ||
build_data::no_debug_rebuilds(); | ||
// Git commit | ||
println!("cargo:rustc-env=GIT_COMMIT={}", get_git_commit().unwrap()); | ||
|
||
// Rustc version | ||
println!( | ||
"cargo:rustc-env=RUSTC_VERSION={}", | ||
get_rustc_version().unwrap() | ||
); | ||
} | ||
|
||
fn get_git_commit() -> std::io::Result<String> { | ||
cmd!("git", "rev-parse", "HEAD").read() | ||
} | ||
|
||
fn get_rustc_version() -> io::Result<String> { | ||
let rustc_var = std::env::var_os("RUSTC") | ||
.filter(|s| !s.is_empty()) | ||
.ok_or_else(|| io::Error::new(io::ErrorKind::Other, "RUSTC env var is not set"))?; | ||
cmd!(rustc_var, "--version").read() | ||
} |
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