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

36
configure vendored
View File

@ -1327,27 +1327,29 @@ then
fi fi
fi fi
step_msg "making directories" if [ -z "$CFG_ENABLE_RUSTBUILD" ]; then
for i in \ step_msg "making directories"
for i in \
doc doc/std doc/extra \ doc doc/std doc/extra \
dl tmp dist dl tmp dist
do do
make_dir $i make_dir $i
done done
for t in $CFG_HOST for t in $CFG_HOST
do do
make_dir $t/llvm make_dir $t/llvm
done done
for t in $CFG_HOST for t in $CFG_HOST
do do
make_dir $t/rustllvm make_dir $t/rustllvm
done done
for t in $CFG_TARGET for t in $CFG_TARGET
do do
make_dir $t/rt make_dir $t/rt
for s in 0 1 2 3 for s in 0 1 2 3
do do
@ -1361,10 +1363,10 @@ do
make_dir $t/rt/stage$s/$i make_dir $t/rt/stage$s/$i
done done
done done
done done
for h in $CFG_HOST for h in $CFG_HOST
do do
for t in $CFG_TARGET for t in $CFG_TARGET
do do
# host bin dir stage0 # host bin dir stage0
@ -1417,7 +1419,9 @@ do
make_dir $h/test/codegen make_dir $h/test/codegen
make_dir $h/test/codegen-units make_dir $h/test/codegen-units
make_dir $h/test/rustdoc make_dir $h/test/rustdoc
done done
fi
# Configure submodules # Configure submodules
step_msg "configuring submodules" step_msg "configuring submodules"

View File

@ -160,23 +160,24 @@ impl Build {
if fs::metadata(self.src.join(".git")).is_err() { if fs::metadata(self.src.join(".git")).is_err() {
return 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("-")) { if !out.lines().any(|l| l.starts_with("+") || l.starts_with("-")) {
return return
} }
self.run(Command::new("git").arg("submodule").arg("sync")); self.run(git_submodule().arg("sync"));
self.run(Command::new("git").arg("submodule").arg("init")); self.run(git_submodule().arg("init"));
self.run(Command::new("git").arg("submodule").arg("update")); self.run(git_submodule().arg("update"));
self.run(Command::new("git").arg("submodule").arg("update") self.run(git_submodule().arg("update").arg("--recursive"));
.arg("--recursive")); self.run(git_submodule().arg("status").arg("--recursive"));
self.run(Command::new("git").arg("submodule").arg("status") self.run(git_submodule().arg("foreach").arg("--recursive")
.arg("--recursive"));
self.run(Command::new("git").arg("submodule").arg("foreach")
.arg("--recursive")
.arg("git").arg("clean").arg("-fdx")); .arg("git").arg("clean").arg("-fdx"));
self.run(Command::new("git").arg("submodule").arg("foreach") self.run(git_submodule().arg("foreach").arg("--recursive")
.arg("--recursive")
.arg("git").arg("checkout").arg(".")); .arg("git").arg("checkout").arg("."));
} }