diff --git a/crates/solidity/build.rs b/crates/solidity/build.rs new file mode 100644 index 00000000..abbf2e4c --- /dev/null +++ b/crates/solidity/build.rs @@ -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()); +} diff --git a/crates/solidity/src/resolc/main.rs b/crates/solidity/src/resolc/main.rs index 52ca7642..b004ca19 100644 --- a/crates/solidity/src/resolc/main.rs +++ b/crates/solidity/src/resolc/main.rs @@ -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(()); }