Skip to content

Commit 8f55152

Browse files
committed
Did you mean to block nightlies on clippy?
1 parent 48af771 commit 8f55152

File tree

7 files changed

+162
-7
lines changed

7 files changed

+162
-7
lines changed

src/Cargo.lock

+5-5
Original file line numberDiff line numberDiff line change
@@ -307,12 +307,12 @@ dependencies = [
307307

308308
[[package]]
309309
name = "clippy"
310-
version = "0.0.202"
310+
version = "0.0.211"
311311
dependencies = [
312312
"ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
313313
"cargo_metadata 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
314314
"clippy-mini-macro-test 0.2.0",
315-
"clippy_lints 0.0.202",
315+
"clippy_lints 0.0.211",
316316
"compiletest_rs 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
317317
"derive-new 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
318318
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -329,7 +329,8 @@ version = "0.2.0"
329329

330330
[[package]]
331331
name = "clippy_lints"
332-
version = "0.0.202"
332+
version = "0.0.205"
333+
source = "registry+https://github.com/rust-lang/crates.io-index"
333334
dependencies = [
334335
"cargo_metadata 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
335336
"if_chain 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -349,8 +350,7 @@ dependencies = [
349350

350351
[[package]]
351352
name = "clippy_lints"
352-
version = "0.0.205"
353-
source = "registry+https://github.com/rust-lang/crates.io-index"
353+
version = "0.0.211"
354354
dependencies = [
355355
"cargo_metadata 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
356356
"if_chain 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",

src/bootstrap/dist.rs

+114
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ pub fn pkgname(builder: &Builder, component: &str) -> String {
4141
format!("{}-{}", component, builder.cargo_package_vers())
4242
} else if component == "rls" {
4343
format!("{}-{}", component, builder.rls_package_vers())
44+
} else if component == "clippy" {
45+
format!("{}-{}", component, builder.clippy_package_vers())
4446
} else if component == "rustfmt" {
4547
format!("{}-{}", component, builder.rustfmt_package_vers())
4648
} else if component == "llvm-tools" {
@@ -1183,6 +1185,83 @@ impl Step for Rls {
11831185
}
11841186
}
11851187

1188+
#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)]
1189+
pub struct Clippy {
1190+
pub stage: u32,
1191+
pub target: Interned<String>,
1192+
}
1193+
1194+
impl Step for Clippy {
1195+
type Output = Option<PathBuf>;
1196+
const ONLY_HOSTS: bool = true;
1197+
1198+
fn should_run(run: ShouldRun) -> ShouldRun {
1199+
run.path("clippy")
1200+
}
1201+
1202+
fn make_run(run: RunConfig) {
1203+
run.builder.ensure(Clippy {
1204+
stage: run.builder.top_stage,
1205+
target: run.target,
1206+
});
1207+
}
1208+
1209+
fn run(self, builder: &Builder) -> Option<PathBuf> {
1210+
let stage = self.stage;
1211+
let target = self.target;
1212+
assert!(builder.config.extended);
1213+
1214+
builder.info(&format!("Dist clippy stage{} ({})", stage, target));
1215+
let src = builder.src.join("src/tools/clippy");
1216+
let release_num = builder.release_num("clippy");
1217+
let name = pkgname(builder, "clippy");
1218+
let version = builder.clippy_info.version(builder, &release_num);
1219+
1220+
let tmp = tmpdir(builder);
1221+
let image = tmp.join("clippy-image");
1222+
drop(fs::remove_dir_all(&image));
1223+
t!(fs::create_dir_all(&image));
1224+
1225+
// Prepare the image directory
1226+
// We expect clippy to build, because we've exited this step above if tool
1227+
// state for clippy isn't testing.
1228+
let clippy = builder.ensure(tool::Clippy {
1229+
compiler: builder.compiler(stage, builder.config.build),
1230+
target, extra_features: Vec::new()
1231+
}).or_else(|| { println!("Unable to build clippy, skipping dist"); None })?;
1232+
1233+
builder.install(&clippy, &image.join("bin"), 0o755);
1234+
let doc = image.join("share/doc/clippy");
1235+
builder.install(&src.join("README.md"), &doc, 0o644);
1236+
builder.install(&src.join("LICENSE"), &doc, 0o644);
1237+
1238+
// Prepare the overlay
1239+
let overlay = tmp.join("clippy-overlay");
1240+
drop(fs::remove_dir_all(&overlay));
1241+
t!(fs::create_dir_all(&overlay));
1242+
builder.install(&src.join("README.md"), &overlay, 0o644);
1243+
builder.install(&src.join("LICENSE-MIT"), &overlay, 0o644);
1244+
builder.install(&src.join("LICENSE-APACHE"), &overlay, 0o644);
1245+
builder.create(&overlay.join("version"), &version);
1246+
1247+
// Generate the installer tarball
1248+
let mut cmd = rust_installer(builder);
1249+
cmd.arg("generate")
1250+
.arg("--product-name=Rust")
1251+
.arg("--rel-manifest-dir=rustlib")
1252+
.arg("--success-message=clippy-ready-to-serve.")
1253+
.arg("--image-dir").arg(&image)
1254+
.arg("--work-dir").arg(&tmpdir(builder))
1255+
.arg("--output-dir").arg(&distdir(builder))
1256+
.arg("--non-installed-overlay").arg(&overlay)
1257+
.arg(format!("--package-name={}-{}", name, target))
1258+
.arg("--legacy-manifest-dirs=rustlib,cargo")
1259+
.arg("--component-name=clippy-preview");
1260+
1261+
builder.run(&mut cmd);
1262+
Some(distdir(builder).join(format!("{}-{}.tar.gz", name, target)))
1263+
}
1264+
}
11861265

11871266
#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)]
11881267
pub struct Rustfmt {
@@ -1304,6 +1383,7 @@ impl Step for Extended {
13041383
let rustfmt_installer = builder.ensure(Rustfmt { stage, target });
13051384
let rls_installer = builder.ensure(Rls { stage, target });
13061385
let llvm_tools_installer = builder.ensure(LlvmTools { stage, target });
1386+
let clippy_installer = builder.ensure(Clippy { stage, target });
13071387
let mingw_installer = builder.ensure(Mingw { host: target });
13081388
let analysis_installer = builder.ensure(Analysis {
13091389
compiler: builder.compiler(stage, self.host),
@@ -1340,6 +1420,7 @@ impl Step for Extended {
13401420
tarballs.push(rustc_installer);
13411421
tarballs.push(cargo_installer);
13421422
tarballs.extend(rls_installer.clone());
1423+
tarballs.extend(clippy_installer.clone());
13431424
tarballs.extend(rustfmt_installer.clone());
13441425
tarballs.extend(llvm_tools_installer.clone());
13451426
tarballs.push(analysis_installer);
@@ -1409,6 +1490,9 @@ impl Step for Extended {
14091490
if rls_installer.is_none() {
14101491
contents = filter(&contents, "rls");
14111492
}
1493+
if clippy_installer.is_none() {
1494+
contents = filter(&contents, "clippy");
1495+
}
14121496
if rustfmt_installer.is_none() {
14131497
contents = filter(&contents, "rustfmt");
14141498
}
@@ -1446,6 +1530,9 @@ impl Step for Extended {
14461530
if rls_installer.is_some() {
14471531
prepare("rls");
14481532
}
1533+
if clippy_installer.is_some() {
1534+
prepare("clippy");
1535+
}
14491536

14501537
// create an 'uninstall' package
14511538
builder.install(&etc.join("pkg/postinstall"), &pkg.join("uninstall"), 0o755);
@@ -1474,6 +1561,8 @@ impl Step for Extended {
14741561
format!("{}-{}", name, target)
14751562
} else if name == "rls" {
14761563
"rls-preview".to_string()
1564+
} else if name == "clippy" {
1565+
"clippy-preview".to_string()
14771566
} else {
14781567
name.to_string()
14791568
};
@@ -1490,6 +1579,9 @@ impl Step for Extended {
14901579
if rls_installer.is_some() {
14911580
prepare("rls");
14921581
}
1582+
if clippy_installer.is_some() {
1583+
prepare("clippy");
1584+
}
14931585
if target.contains("windows-gnu") {
14941586
prepare("rust-mingw");
14951587
}
@@ -1570,6 +1662,18 @@ impl Step for Extended {
15701662
.arg("-out").arg(exe.join("RlsGroup.wxs"))
15711663
.arg("-t").arg(etc.join("msi/remove-duplicates.xsl")));
15721664
}
1665+
if clippy_installer.is_some() {
1666+
builder.run(Command::new(&heat)
1667+
.current_dir(&exe)
1668+
.arg("dir")
1669+
.arg("clippy")
1670+
.args(&heat_flags)
1671+
.arg("-cg").arg("ClippyGroup")
1672+
.arg("-dr").arg("Clippy")
1673+
.arg("-var").arg("var.ClippyDir")
1674+
.arg("-out").arg(exe.join("ClippyGroup.wxs"))
1675+
.arg("-t").arg(etc.join("msi/remove-duplicates.xsl")));
1676+
}
15731677
builder.run(Command::new(&heat)
15741678
.current_dir(&exe)
15751679
.arg("dir")
@@ -1612,6 +1716,9 @@ impl Step for Extended {
16121716
if rls_installer.is_some() {
16131717
cmd.arg("-dRlsDir=rls");
16141718
}
1719+
if clippy_installer.is_some() {
1720+
cmd.arg("-dClippyDir=clippy");
1721+
}
16151722
if target.contains("windows-gnu") {
16161723
cmd.arg("-dGccDir=rust-mingw");
16171724
}
@@ -1627,6 +1734,9 @@ impl Step for Extended {
16271734
if rls_installer.is_some() {
16281735
candle("RlsGroup.wxs".as_ref());
16291736
}
1737+
if clippy_installer.is_some() {
1738+
candle("ClippyGroup.wxs".as_ref());
1739+
}
16301740
candle("AnalysisGroup.wxs".as_ref());
16311741

16321742
if target.contains("windows-gnu") {
@@ -1656,6 +1766,9 @@ impl Step for Extended {
16561766
if rls_installer.is_some() {
16571767
cmd.arg("RlsGroup.wixobj");
16581768
}
1769+
if clippy_installer.is_some() {
1770+
cmd.arg("ClippyGroup.wixobj");
1771+
}
16591772

16601773
if target.contains("windows-gnu") {
16611774
cmd.arg("GccGroup.wixobj");
@@ -1741,6 +1854,7 @@ impl Step for HashSign {
17411854
cmd.arg(builder.rust_package_vers());
17421855
cmd.arg(builder.package_vers(&builder.release_num("cargo")));
17431856
cmd.arg(builder.package_vers(&builder.release_num("rls")));
1857+
cmd.arg(builder.package_vers(&builder.release_num("clippy")));
17441858
cmd.arg(builder.package_vers(&builder.release_num("rustfmt")));
17451859
cmd.arg(builder.llvm_tools_package_vers());
17461860
cmd.arg(addr);

src/bootstrap/install.rs

+11
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ pub fn install_cargo(builder: &Builder, stage: u32, host: Interned<String>) {
3939
pub fn install_rls(builder: &Builder, stage: u32, host: Interned<String>) {
4040
install_sh(builder, "rls", "rls", stage, Some(host));
4141
}
42+
pub fn install_clippy(builder: &Builder, stage: u32, host: Interned<String>) {
43+
install_sh(builder, "clippy", "clippy", stage, Some(host));
44+
}
4245

4346
pub fn install_rustfmt(builder: &Builder, stage: u32, host: Interned<String>) {
4447
install_sh(builder, "rustfmt", "rustfmt", stage, Some(host));
@@ -216,6 +219,14 @@ install!((self, builder, _config),
216219
builder.info(&format!("skipping Install RLS stage{} ({})", self.stage, self.target));
217220
}
218221
};
222+
Clippy, "clippy", Self::should_build(_config), only_hosts: true, {
223+
if builder.ensure(dist::Clippy { stage: self.stage, target: self.target }).is_some() ||
224+
Self::should_install(builder) {
225+
install_clippy(builder, self.stage, self.target);
226+
} else {
227+
builder.info(&format!("skipping Install clippy stage{} ({})", self.stage, self.target));
228+
}
229+
};
219230
Rustfmt, "rustfmt", Self::should_build(_config), only_hosts: true, {
220231
if builder.ensure(dist::Rustfmt { stage: self.stage, target: self.target }).is_some() ||
221232
Self::should_install(builder) {

src/bootstrap/lib.rs

+8
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ pub struct Build {
248248
rust_info: channel::GitInfo,
249249
cargo_info: channel::GitInfo,
250250
rls_info: channel::GitInfo,
251+
clippy_info: channel::GitInfo,
251252
rustfmt_info: channel::GitInfo,
252253
local_rebuild: bool,
253254
fail_fast: bool,
@@ -363,6 +364,7 @@ impl Build {
363364
let rust_info = channel::GitInfo::new(&config, &src);
364365
let cargo_info = channel::GitInfo::new(&config, &src.join("src/tools/cargo"));
365366
let rls_info = channel::GitInfo::new(&config, &src.join("src/tools/rls"));
367+
let clippy_info = channel::GitInfo::new(&config, &src.join("src/tools/clippy"));
366368
let rustfmt_info = channel::GitInfo::new(&config, &src.join("src/tools/rustfmt"));
367369

368370
let mut build = Build {
@@ -384,6 +386,7 @@ impl Build {
384386
rust_info,
385387
cargo_info,
386388
rls_info,
389+
clippy_info,
387390
rustfmt_info,
388391
cc: HashMap::new(),
389392
cxx: HashMap::new(),
@@ -968,6 +971,11 @@ impl Build {
968971
self.package_vers(&self.release_num("rls"))
969972
}
970973

974+
/// Returns the value of `package_vers` above for clippy
975+
fn clippy_package_vers(&self) -> String {
976+
self.package_vers(&self.release_num("clippy"))
977+
}
978+
971979
/// Returns the value of `package_vers` above for rustfmt
972980
fn rustfmt_package_vers(&self) -> String {
973981
self.package_vers(&self.release_num("rustfmt"))

src/bootstrap/tool.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ impl Step for ToolBuild {
118118
let mut duplicates = Vec::new();
119119
let is_expected = compile::stream_cargo(builder, &mut cargo, &mut |msg| {
120120
// Only care about big things like the RLS/Cargo for now
121-
if tool != "rls" && tool != "cargo" {
121+
if tool != "rls" && tool != "cargo" && tool != "clippy-driver" {
122122
return
123123
}
124124
let (id, features, filenames) = match msg {

0 commit comments

Comments
 (0)