Skip to content

Commit

Permalink
Allow build.rs to succeed if git is not present (#203)
Browse files Browse the repository at this point in the history
Should fix #175 and #202.
  • Loading branch information
scouten-adobe committed Mar 19, 2024
1 parent 807b4b0 commit bda87d5
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,22 +375,17 @@ where
I: IntoIterator<Item = S>,
S: AsRef<OsStr>,
{
let output = std::process::Command::new("git")
.args(args)
.output()
.unwrap();

println!(
"--- stdout ---\n{}\n\n--- stderr ---\n{}\n\n",
String::from_utf8(output.stdout).unwrap(),
String::from_utf8(output.stderr).unwrap()
);

// When we run inside the docs.rs environment (and, presumably,
// any client that is building xmp-toolkit-rs as a dependency),
// the submodule doesn't exist, so we should ignore any
// error from git.
// assert_eq!(output.status.code().unwrap(), 0);
if let Ok(output) = std::process::Command::new("git").args(args).output() {
println!(
"--- stdout ---\n{}\n\n--- stderr ---\n{}\n\n",
String::from_utf8(output.stdout).unwrap(),
String::from_utf8(output.stderr).unwrap()
);
} else {
eprintln!("INFO: git command failed");
eprintln!(" If building from crates.io, this should be OK.");
eprintln!(" Otherwise, please manually ensure that submodules are up to date.");
}
}

fn compile_for_docs() {
Expand Down

0 comments on commit bda87d5

Please sign in to comment.