mirror of
https://github.com/servo/servo.git
synced 2025-09-30 00:29:14 +01:00
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>
This commit is contained in:
parent
09684a3501
commit
0a849adfa1
3 changed files with 82 additions and 11 deletions
|
@ -22,7 +22,7 @@ bench = false
|
|||
# since build-scripts can't detect the cargo target os at build-time, we
|
||||
# must unconditionally add these dependencies. See https://github.com/rust-lang/cargo/issues/4932
|
||||
[build-dependencies]
|
||||
vergen = { version = "8.3.2", features = ["git", "git2"] }
|
||||
vergen-git2 = { version = "1.0.1", features = ["build"] }
|
||||
# Android and OpenHarmony
|
||||
gl_generator = "0.14"
|
||||
# MacOS only
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue