Skip to content

Commit

Permalink
Merge pull request #492 from fuzzland/feat-add-git-version-2
Browse files Browse the repository at this point in the history
add feature info
  • Loading branch information
publicqi authored May 27, 2024
2 parents 4499b6c + 83bcee9 commit f0195c6
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/target
**/target
/.git
/.idea
*.log
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ COPY tests ./tests
COPY .git ./.git

# build offchain binary
RUN cargo build --release --features "cmp dataflow evm print_txn_corpus full_trace" --no-default-features
RUN cargo build --release --features "cmp dataflow evm print_txn_corpus full_trace force_cache real_balance" --no-default-features
RUN cp target/release/ityfuzz /bins/cli_offchain

# build onchain binary
Expand Down
14 changes: 13 additions & 1 deletion src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,17 @@ fn main() {
// taken from https://stackoverflow.com/questions/43753491/include-git-commit-hash-as-string-into-rust-program
let output = Command::new("git").args(["rev-parse", "HEAD"]).output().unwrap();
let git_hash = String::from_utf8(output.stdout).unwrap();
println!("cargo:rustc-env=GIT_HASH=commit {}", git_hash);

let features = {
let mut features = String::new();

for (k, v) in std::env::vars() {
if k.starts_with("CARGO_FEATURE_") && v == "1" {
features.push_str(&format!("{},", &k[14..]));
}
}
features.to_ascii_lowercase()
};

println!("cargo:rustc-env=GIT_VERSION_INFO={}[{:?}]", git_hash.trim(), features);
}
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub fn init_sentry() {
}

#[derive(Parser)]
#[command(author, version=env!("GIT_HASH"), about)]
#[command(author, version=env!("GIT_VERSION_INFO"), about)]
struct Cli {
#[command(subcommand)]
command: Commands,
Expand Down

0 comments on commit f0195c6

Please sign in to comment.