diff options
author | Jonathan Schwender <55576758+jschwe@users.noreply.github.com> | 2024-11-19 07:47:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-19 06:47:15 +0000 |
commit | 0a849adfa118ff8e76518cc390edd3d1551469d0 (patch) | |
tree | 2e397a0f044614f0d192fe395ba7c8f9ce4aac18 /ports/servoshell/build.rs | |
parent | 09684a350121db480959959832162b7cd03fbab8 (diff) | |
download | servo-0a849adfa118ff8e76518cc390edd3d1551469d0.tar.gz servo-0a849adfa118ff8e76518cc390edd3d1551469d0.zip |
Update vergen to v9 (#34283)
Vergen v9 was split into multiple different crates.
See https://github.com/rustyhorde/vergen/blob/master/MIGRATING_v8_to_v9.md
Since we used the git2 backend, we migrate to vergen-git2.
We only use `VERGEN_GIT_SHA`, so no need to enable any
of the other possible instructions.
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
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 |