Skip to content

Commit 0ce5cf0

Browse files
Fix a few accidental expectations
1 parent 545b92f commit 0ce5cf0

File tree

4 files changed

+32
-12
lines changed

4 files changed

+32
-12
lines changed

src/bootstrap/dist.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1480,7 +1480,7 @@ impl Step for Extended {
14801480
build.cp_r(&work.join(&format!("{}-{}", pkgname(build, name), target))
14811481
.join(dir),
14821482
&exe.join(name));
1483-
t!(fs::remove_file(exe.join(name).join("manifest.in")));
1483+
build.remove(&exe.join(name).join("manifest.in"));
14841484
};
14851485
prepare("rustc");
14861486
prepare("cargo");
@@ -1498,7 +1498,7 @@ impl Step for Extended {
14981498
build.install(&etc.join("exe/modpath.iss"), &exe, 0o644);
14991499
build.install(&etc.join("exe/upgrade.iss"), &exe, 0o644);
15001500
build.install(&etc.join("gfx/rust-logo.ico"), &exe, 0o644);
1501-
t!(t!(File::create(exe.join("LICENSE.txt"))).write_all(license.as_bytes()));
1501+
build.create(&exe.join("LICENSE.txt"), &license);
15021502

15031503
// Generate exe installer
15041504
let mut cmd = Command::new("iscc");
@@ -1633,7 +1633,7 @@ impl Step for Extended {
16331633
candle("GccGroup.wxs".as_ref());
16341634
}
16351635

1636-
t!(t!(File::create(exe.join("LICENSE.rtf"))).write_all(rtf.as_bytes()));
1636+
build.create(&exe.join("LICENSE.rtf"), &rtf);
16371637
build.install(&etc.join("gfx/banner.bmp"), &exe, 0o644);
16381638
build.install(&etc.join("gfx/dialogbg.bmp"), &exe, 0o644);
16391639

@@ -1665,7 +1665,9 @@ impl Step for Extended {
16651665

16661666
build.run(&mut cmd);
16671667

1668-
t!(fs::rename(exe.join(&filename), distdir(build).join(&filename)));
1668+
if !build.config.dry_run {
1669+
t!(fs::rename(exe.join(&filename), distdir(build).join(&filename)));
1670+
}
16691671
}
16701672
}
16711673
}
@@ -1717,6 +1719,9 @@ impl Step for HashSign {
17171719
fn run(self, builder: &Builder) {
17181720
let build = builder.build;
17191721
let mut cmd = builder.tool_cmd(Tool::BuildManifest);
1722+
if build.config.dry_run {
1723+
return;
1724+
}
17201725
let sign = build.config.dist_sign_folder.as_ref().unwrap_or_else(|| {
17211726
panic!("\n\nfailed to specify `dist.sign-folder` in `config.toml`\n\n")
17221727
});

src/bootstrap/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1178,6 +1178,11 @@ impl Build {
11781178
};
11791179
iter.map(|e| t!(e)).collect::<Vec<_>>().into_iter()
11801180
}
1181+
1182+
fn remove(&self, f: &Path) {
1183+
if self.config.dry_run { return; }
1184+
fs::remove_file(f).unwrap_or_else(|_| panic!("failed to remove {:?}", f));
1185+
}
11811186
}
11821187

11831188
#[cfg(unix)]

src/bootstrap/native.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,10 @@ fn check_llvm_version(build: &Build, llvm_config: &Path) {
235235
return
236236
}
237237

238+
if build.config.dry_run {
239+
return;
240+
}
241+
238242
let mut cmd = Command::new(llvm_config);
239243
let version = output(cmd.arg("--version"));
240244
let mut parts = version.split('.').take(2)

src/bootstrap/test.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -926,15 +926,17 @@ impl Step for Compiletest {
926926
target: build.config.build,
927927
emscripten: false,
928928
});
929-
let llvm_version = output(Command::new(&llvm_config).arg("--version"));
930-
cmd.arg("--llvm-version").arg(llvm_version);
929+
if !build.config.dry_run {
930+
let llvm_version = output(Command::new(&llvm_config).arg("--version"));
931+
cmd.arg("--llvm-version").arg(llvm_version);
932+
}
931933
if !build.is_rust_llvm(target) {
932934
cmd.arg("--system-llvm");
933935
}
934936

935937
// Only pass correct values for these flags for the `run-make` suite as it
936938
// requires that a C++ compiler was configured which isn't always the case.
937-
if suite == "run-make-fulldeps" {
939+
if !build.config.dry_run && suite == "run-make-fulldeps" {
938940
let llvm_components = output(Command::new(&llvm_config).arg("--components"));
939941
let llvm_cxxflags = output(Command::new(&llvm_config).arg("--cxxflags"));
940942
cmd.arg("--cc").arg(build.cc(target))
@@ -1177,11 +1179,15 @@ impl Step for ErrorIndex {
11771179

11781180
fn markdown_test(builder: &Builder, compiler: Compiler, markdown: &Path) -> bool {
11791181
let build = builder.build;
1180-
let mut file = t!(File::open(markdown));
1181-
let mut contents = String::new();
1182-
t!(file.read_to_string(&mut contents));
1183-
if !contents.contains("```") {
1184-
return true;
1182+
match File::open(markdown) {
1183+
Ok(mut file) => {
1184+
let mut contents = String::new();
1185+
t!(file.read_to_string(&mut contents));
1186+
if !contents.contains("```") {
1187+
return true;
1188+
}
1189+
}
1190+
Err(_) => {},
11851191
}
11861192

11871193
build.info(&format!("doc tests for: {}", markdown.display()));

0 commit comments

Comments
 (0)