1
Fork 0

Fix a few accidental expectations

This commit is contained in:
Mark Simulacrum 2018-03-31 19:21:14 -06:00
parent 545b92f46d
commit 0ce5cf0697
4 changed files with 32 additions and 12 deletions

View file

@ -1480,7 +1480,7 @@ impl Step for Extended {
build.cp_r(&work.join(&format!("{}-{}", pkgname(build, name), target))
.join(dir),
&exe.join(name));
t!(fs::remove_file(exe.join(name).join("manifest.in")));
build.remove(&exe.join(name).join("manifest.in"));
};
prepare("rustc");
prepare("cargo");
@ -1498,7 +1498,7 @@ impl Step for Extended {
build.install(&etc.join("exe/modpath.iss"), &exe, 0o644);
build.install(&etc.join("exe/upgrade.iss"), &exe, 0o644);
build.install(&etc.join("gfx/rust-logo.ico"), &exe, 0o644);
t!(t!(File::create(exe.join("LICENSE.txt"))).write_all(license.as_bytes()));
build.create(&exe.join("LICENSE.txt"), &license);
// Generate exe installer
let mut cmd = Command::new("iscc");
@ -1633,7 +1633,7 @@ impl Step for Extended {
candle("GccGroup.wxs".as_ref());
}
t!(t!(File::create(exe.join("LICENSE.rtf"))).write_all(rtf.as_bytes()));
build.create(&exe.join("LICENSE.rtf"), &rtf);
build.install(&etc.join("gfx/banner.bmp"), &exe, 0o644);
build.install(&etc.join("gfx/dialogbg.bmp"), &exe, 0o644);
@ -1665,7 +1665,9 @@ impl Step for Extended {
build.run(&mut cmd);
t!(fs::rename(exe.join(&filename), distdir(build).join(&filename)));
if !build.config.dry_run {
t!(fs::rename(exe.join(&filename), distdir(build).join(&filename)));
}
}
}
}
@ -1717,6 +1719,9 @@ impl Step for HashSign {
fn run(self, builder: &Builder) {
let build = builder.build;
let mut cmd = builder.tool_cmd(Tool::BuildManifest);
if build.config.dry_run {
return;
}
let sign = build.config.dist_sign_folder.as_ref().unwrap_or_else(|| {
panic!("\n\nfailed to specify `dist.sign-folder` in `config.toml`\n\n")
});

View file

@ -1178,6 +1178,11 @@ impl Build {
};
iter.map(|e| t!(e)).collect::<Vec<_>>().into_iter()
}
fn remove(&self, f: &Path) {
if self.config.dry_run { return; }
fs::remove_file(f).unwrap_or_else(|_| panic!("failed to remove {:?}", f));
}
}
#[cfg(unix)]

View file

@ -235,6 +235,10 @@ fn check_llvm_version(build: &Build, llvm_config: &Path) {
return
}
if build.config.dry_run {
return;
}
let mut cmd = Command::new(llvm_config);
let version = output(cmd.arg("--version"));
let mut parts = version.split('.').take(2)

View file

@ -926,15 +926,17 @@ impl Step for Compiletest {
target: build.config.build,
emscripten: false,
});
let llvm_version = output(Command::new(&llvm_config).arg("--version"));
cmd.arg("--llvm-version").arg(llvm_version);
if !build.config.dry_run {
let llvm_version = output(Command::new(&llvm_config).arg("--version"));
cmd.arg("--llvm-version").arg(llvm_version);
}
if !build.is_rust_llvm(target) {
cmd.arg("--system-llvm");
}
// Only pass correct values for these flags for the `run-make` suite as it
// requires that a C++ compiler was configured which isn't always the case.
if suite == "run-make-fulldeps" {
if !build.config.dry_run && suite == "run-make-fulldeps" {
let llvm_components = output(Command::new(&llvm_config).arg("--components"));
let llvm_cxxflags = output(Command::new(&llvm_config).arg("--cxxflags"));
cmd.arg("--cc").arg(build.cc(target))
@ -1177,11 +1179,15 @@ impl Step for ErrorIndex {
fn markdown_test(builder: &Builder, compiler: Compiler, markdown: &Path) -> bool {
let build = builder.build;
let mut file = t!(File::open(markdown));
let mut contents = String::new();
t!(file.read_to_string(&mut contents));
if !contents.contains("```") {
return true;
match File::open(markdown) {
Ok(mut file) => {
let mut contents = String::new();
t!(file.read_to_string(&mut contents));
if !contents.contains("```") {
return true;
}
}
Err(_) => {},
}
build.info(&format!("doc tests for: {}", markdown.display()));