Auto merge of #31620 - alexcrichton:fix-out-of-tree-builds, r=brson

This removes creating some extraneous directories and also fixes some submodule management with out of tree builds.

Closes #31619
This commit is contained in:
bors 2016-02-20 08:47:25 +00:00
commit df128bdc4c
2 changed files with 93 additions and 88 deletions

4
configure vendored
View File

@ -1327,6 +1327,8 @@ then
fi
fi
if [ -z "$CFG_ENABLE_RUSTBUILD" ]; then
step_msg "making directories"
for i in \
@ -1419,6 +1421,8 @@ do
make_dir $h/test/rustdoc
done
fi
# Configure submodules
step_msg "configuring submodules"

View File

@ -160,23 +160,24 @@ impl Build {
if fs::metadata(self.src.join(".git")).is_err() {
return
}
let out = output(Command::new("git").arg("submodule").arg("status"));
let git_submodule = || {
let mut cmd = Command::new("git");
cmd.current_dir(&self.src).arg("submodule");
return cmd
};
let out = output(git_submodule().arg("status"));
if !out.lines().any(|l| l.starts_with("+") || l.starts_with("-")) {
return
}
self.run(Command::new("git").arg("submodule").arg("sync"));
self.run(Command::new("git").arg("submodule").arg("init"));
self.run(Command::new("git").arg("submodule").arg("update"));
self.run(Command::new("git").arg("submodule").arg("update")
.arg("--recursive"));
self.run(Command::new("git").arg("submodule").arg("status")
.arg("--recursive"));
self.run(Command::new("git").arg("submodule").arg("foreach")
.arg("--recursive")
self.run(git_submodule().arg("sync"));
self.run(git_submodule().arg("init"));
self.run(git_submodule().arg("update"));
self.run(git_submodule().arg("update").arg("--recursive"));
self.run(git_submodule().arg("status").arg("--recursive"));
self.run(git_submodule().arg("foreach").arg("--recursive")
.arg("git").arg("clean").arg("-fdx"));
self.run(Command::new("git").arg("submodule").arg("foreach")
.arg("--recursive")
self.run(git_submodule().arg("foreach").arg("--recursive")
.arg("git").arg("checkout").arg("."));
}