Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow build.rs to succeed if git is not present #203

Merged
merged 1 commit into from
Mar 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading