diff --git a/build.rs b/build.rs index 06ac3d57..6c57d3b6 100644 --- a/build.rs +++ b/build.rs @@ -8,11 +8,19 @@ fn vergen() -> Result<(), Box> { let git2 = Git2Builder::all_git()?; let cargo = CargoBuilder::all_cargo()?; - Emitter::default() + let status = Emitter::default() .add_instructions(&build)? .add_instructions(&git2)? .add_instructions(&cargo)? - .emit()?; + .fail_on_error() + .emit(); + + // set the env variable myself if the status failed + if status.is_err() { + eprintln!("Failed to get version information from git"); + eprintln!("Likely building a published version from cargo or bioconda."); + std::env::set_var("VERGEN_GIT_DESCRIBE", "unknown"); + } Ok(()) }