diff options
Diffstat (limited to 'ports/servoshell/build.rs')
-rw-r--r-- | ports/servoshell/build.rs | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/ports/servoshell/build.rs b/ports/servoshell/build.rs index 2bce85cdefb..43f62b1d9a1 100644 --- a/ports/servoshell/build.rs +++ b/ports/servoshell/build.rs @@ -8,7 +8,7 @@ use std::io::Write; use std::path::Path; use gl_generator::{Api, Fallbacks, Profile, Registry}; -use vergen::EmitBuilder; +use vergen_git2::{Emitter, Git2Builder}; // We can make this configurable in the future if different platforms start to have // different needs. @@ -20,6 +20,17 @@ fn generate_egl_bindings(out_dir: &Path) { println!("cargo:rustc-link-lib=EGL"); } +fn emit_git_sha() -> Result<(), String> { + let git_options = Git2Builder::default() + .sha(true /* short */) + .build() + .map_err(|e| e.to_string())?; + Emitter::default() + .add_instructions(&git_options) + .and_then(|emitter| emitter.fail_on_error().emit()) + .map_err(|e| e.to_string()) +} + fn main() -> Result<(), Box<dyn Error>> { println!("cargo::rustc-check-cfg=cfg(servo_production)"); println!("cargo::rustc-check-cfg=cfg(servo_do_not_use_in_production)"); @@ -76,11 +87,7 @@ fn main() -> Result<(), Box<dyn Error>> { generate_egl_bindings(out); } - if let Err(error) = EmitBuilder::builder() - .fail_on_error() - .git_sha(true /* short */) - .emit() - { + if let Err(error) = emit_git_sha() { println!( "cargo:warning=Could not generate git version information: {:?}", error |