-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #427 from egraphs-good/build-info
Display build info when running egglog
- Loading branch information
Showing
4 changed files
with
29 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,19 @@ | ||
use std::{env, process::Command}; | ||
|
||
#[allow(clippy::disallowed_macros)] // for println! | ||
fn main() { | ||
lalrpop::process_root().unwrap(); | ||
let git_hash = Command::new("git2") | ||
.args(["rev-parse", "--short", "HEAD"]) | ||
.output() | ||
.map(|output| { | ||
String::from_utf8(output.stdout) | ||
.map(|s| "_".to_owned() + &s) | ||
.unwrap_or_default() | ||
}) | ||
.unwrap_or_default(); | ||
let build_date = chrono::Utc::now().format("%Y-%m-%d"); | ||
let version = env::var("CARGO_PKG_VERSION").unwrap(); | ||
let full_version = format!("{}_{}{}", version, build_date, git_hash); | ||
println!("cargo:rustc-env=FULL_VERSION={}", full_version); | ||
} |
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