Skip to content

Commit a182450

Browse files
committed
Gate on clippy on CI
1 parent dae90c1 commit a182450

File tree

4 files changed

+33
-60
lines changed

4 files changed

+33
-60
lines changed

src/bootstrap/dist.rs

Lines changed: 28 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,7 +1330,7 @@ pub struct Clippy {
13301330
}
13311331

13321332
impl Step for Clippy {
1333-
type Output = Option<PathBuf>;
1333+
type Output = PathBuf;
13341334
const ONLY_HOSTS: bool = true;
13351335

13361336
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
@@ -1348,7 +1348,7 @@ impl Step for Clippy {
13481348
});
13491349
}
13501350

1351-
fn run(self, builder: &Builder<'_>) -> Option<PathBuf> {
1351+
fn run(self, builder: &Builder<'_>) -> PathBuf {
13521352
let compiler = self.compiler;
13531353
let target = self.target;
13541354
assert!(builder.config.extended);
@@ -1368,16 +1368,10 @@ impl Step for Clippy {
13681368
// state for clippy isn't testing.
13691369
let clippy = builder
13701370
.ensure(tool::Clippy { compiler, target, extra_features: Vec::new() })
1371-
.or_else(|| {
1372-
missing_tool("clippy", builder.build.config.missing_tools);
1373-
None
1374-
})?;
1371+
.expect("clippy expected to build - essential tool");
13751372
let cargoclippy = builder
13761373
.ensure(tool::CargoClippy { compiler, target, extra_features: Vec::new() })
1377-
.or_else(|| {
1378-
missing_tool("cargo clippy", builder.build.config.missing_tools);
1379-
None
1380-
})?;
1374+
.expect("clippy expected to build - essential tool");
13811375

13821376
builder.install(&clippy, &image.join("bin"), 0o755);
13831377
builder.install(&cargoclippy, &image.join("bin"), 0o755);
@@ -1416,7 +1410,7 @@ impl Step for Clippy {
14161410
builder.info(&format!("Dist clippy stage{} ({})", compiler.stage, target));
14171411
let _time = timeit(builder);
14181412
builder.run(&mut cmd);
1419-
Some(distdir(builder).join(format!("{}-{}.tar.gz", name, target)))
1413+
distdir(builder).join(format!("{}-{}.tar.gz", name, target))
14201414
}
14211415
}
14221416

@@ -1683,7 +1677,7 @@ impl Step for Extended {
16831677
tarballs.push(rustc_installer);
16841678
tarballs.push(cargo_installer);
16851679
tarballs.extend(rls_installer.clone());
1686-
tarballs.extend(clippy_installer.clone());
1680+
tarballs.push(clippy_installer);
16871681
tarballs.extend(miri_installer.clone());
16881682
tarballs.extend(rustfmt_installer.clone());
16891683
tarballs.extend(llvm_tools_installer);
@@ -1761,9 +1755,6 @@ impl Step for Extended {
17611755
if rls_installer.is_none() {
17621756
contents = filter(&contents, "rls");
17631757
}
1764-
if clippy_installer.is_none() {
1765-
contents = filter(&contents, "clippy");
1766-
}
17671758
if miri_installer.is_none() {
17681759
contents = filter(&contents, "miri");
17691760
}
@@ -1805,13 +1796,11 @@ impl Step for Extended {
18051796
prepare("rust-docs");
18061797
prepare("rust-std");
18071798
prepare("rust-analysis");
1799+
prepare("clippy");
18081800

18091801
if rls_installer.is_some() {
18101802
prepare("rls");
18111803
}
1812-
if clippy_installer.is_some() {
1813-
prepare("clippy");
1814-
}
18151804
if miri_installer.is_some() {
18161805
prepare("miri");
18171806
}
@@ -1863,12 +1852,10 @@ impl Step for Extended {
18631852
prepare("rust-analysis");
18641853
prepare("rust-docs");
18651854
prepare("rust-std");
1855+
prepare("clippy");
18661856
if rls_installer.is_some() {
18671857
prepare("rls");
18681858
}
1869-
if clippy_installer.is_some() {
1870-
prepare("clippy");
1871-
}
18721859
if miri_installer.is_some() {
18731860
prepare("miri");
18741861
}
@@ -1989,25 +1976,23 @@ impl Step for Extended {
19891976
.arg(etc.join("msi/remove-duplicates.xsl")),
19901977
);
19911978
}
1992-
if clippy_installer.is_some() {
1993-
builder.run(
1994-
Command::new(&heat)
1995-
.current_dir(&exe)
1996-
.arg("dir")
1997-
.arg("clippy")
1998-
.args(&heat_flags)
1999-
.arg("-cg")
2000-
.arg("ClippyGroup")
2001-
.arg("-dr")
2002-
.arg("Clippy")
2003-
.arg("-var")
2004-
.arg("var.ClippyDir")
2005-
.arg("-out")
2006-
.arg(exe.join("ClippyGroup.wxs"))
2007-
.arg("-t")
2008-
.arg(etc.join("msi/remove-duplicates.xsl")),
2009-
);
2010-
}
1979+
builder.run(
1980+
Command::new(&heat)
1981+
.current_dir(&exe)
1982+
.arg("dir")
1983+
.arg("clippy")
1984+
.args(&heat_flags)
1985+
.arg("-cg")
1986+
.arg("ClippyGroup")
1987+
.arg("-dr")
1988+
.arg("Clippy")
1989+
.arg("-var")
1990+
.arg("var.ClippyDir")
1991+
.arg("-out")
1992+
.arg(exe.join("ClippyGroup.wxs"))
1993+
.arg("-t")
1994+
.arg(etc.join("msi/remove-duplicates.xsl")),
1995+
);
20111996
if miri_installer.is_some() {
20121997
builder.run(
20131998
Command::new(&heat)
@@ -2073,6 +2058,7 @@ impl Step for Extended {
20732058
.arg("-dCargoDir=cargo")
20742059
.arg("-dStdDir=rust-std")
20752060
.arg("-dAnalysisDir=rust-analysis")
2061+
.arg("-dClippyDir=clippy")
20762062
.arg("-arch")
20772063
.arg(&arch)
20782064
.arg("-out")
@@ -2083,9 +2069,6 @@ impl Step for Extended {
20832069
if rls_installer.is_some() {
20842070
cmd.arg("-dRlsDir=rls");
20852071
}
2086-
if clippy_installer.is_some() {
2087-
cmd.arg("-dClippyDir=clippy");
2088-
}
20892072
if miri_installer.is_some() {
20902073
cmd.arg("-dMiriDir=miri");
20912074
}
@@ -2101,12 +2084,10 @@ impl Step for Extended {
21012084
candle("DocsGroup.wxs".as_ref());
21022085
candle("CargoGroup.wxs".as_ref());
21032086
candle("StdGroup.wxs".as_ref());
2087+
candle("ClippyGroup.wxs".as_ref());
21042088
if rls_installer.is_some() {
21052089
candle("RlsGroup.wxs".as_ref());
21062090
}
2107-
if clippy_installer.is_some() {
2108-
candle("ClippyGroup.wxs".as_ref());
2109-
}
21102091
if miri_installer.is_some() {
21112092
candle("MiriGroup.wxs".as_ref());
21122093
}
@@ -2138,14 +2119,12 @@ impl Step for Extended {
21382119
.arg("CargoGroup.wixobj")
21392120
.arg("StdGroup.wixobj")
21402121
.arg("AnalysisGroup.wixobj")
2122+
.arg("ClippyGroup.wixobj")
21412123
.current_dir(&exe);
21422124

21432125
if rls_installer.is_some() {
21442126
cmd.arg("RlsGroup.wixobj");
21452127
}
2146-
if clippy_installer.is_some() {
2147-
cmd.arg("ClippyGroup.wixobj");
2148-
}
21492128
if miri_installer.is_some() {
21502129
cmd.arg("MiriGroup.wixobj");
21512130
}

src/bootstrap/install.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,10 +214,8 @@ install!((self, builder, _config),
214214
}
215215
};
216216
Clippy, "clippy", Self::should_build(_config), only_hosts: true, {
217-
if builder.ensure(dist::Clippy {
218-
compiler: self.compiler,
219-
target: self.target,
220-
}).is_some() || Self::should_install(builder) {
217+
builder.ensure(dist::Clippy { compiler: self.compiler, target: self.target });
218+
if Self::should_install(builder) {
221219
install_clippy(builder, self.compiler.stage, self.target);
222220
} else {
223221
builder.info(

src/bootstrap/test.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -548,9 +548,7 @@ impl Step for Clippy {
548548

549549
builder.add_rustc_lib_path(compiler, &mut cargo);
550550

551-
if try_run(builder, &mut cargo.into()) {
552-
builder.save_toolstate("clippy-driver", ToolState::TestPass);
553-
}
551+
try_run(builder, &mut cargo.into());
554552
} else {
555553
eprintln!("failed to test clippy: could not build");
556554
}

src/bootstrap/tool.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -652,14 +652,12 @@ tool_extended!((self, builder),
652652
Miri, miri, "src/tools/miri", "miri", {};
653653
CargoMiri, miri, "src/tools/miri", "cargo-miri", {};
654654
Rls, rls, "src/tools/rls", "rls", {
655-
let clippy = builder.ensure(Clippy {
655+
builder.ensure(Clippy {
656656
compiler: self.compiler,
657657
target: self.target,
658658
extra_features: Vec::new(),
659659
});
660-
if clippy.is_some() {
661-
self.extra_features.push("clippy".to_owned());
662-
}
660+
self.extra_features.push("clippy".to_owned());
663661
};
664662
Rustfmt, rustfmt, "src/tools/rustfmt", "rustfmt", {};
665663
);

0 commit comments

Comments
 (0)