Skip to content

Commit

Permalink
display the git revision version information (#105)
Browse files Browse the repository at this point in the history
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
  • Loading branch information
xermicus authored Oct 30, 2024
1 parent 36d9317 commit 68564f9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
9 changes: 9 additions & 0 deletions crates/solidity/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
fn main() {
let git_rev = std::process::Command::new("git")
.args(["rev-parse", "--short", "HEAD"])
.output()
.map(|out| String::from_utf8(out.stdout).unwrap_or_default())
.unwrap_or("unknown".to_owned());

println!("cargo:rustc-env=GIT_COMMIT_HASH={}", git_rev.trim());
}
5 changes: 3 additions & 2 deletions crates/solidity/src/resolc/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ fn main_inner() -> anyhow::Result<()> {

if arguments.version {
println!(
"{} v{} (LLVM build {:?})",
"{} version {}+commit.{} (LLVM build {:?})",
env!("CARGO_PKG_DESCRIPTION"),
env!("CARGO_PKG_VERSION"),
inkwell::support::get_llvm_version()
env!("GIT_COMMIT_HASH"),
inkwell::support::get_llvm_version(),
);
return Ok(());
}
Expand Down

0 comments on commit 68564f9

Please sign in to comment.