Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 521b884

Browse files
committed
bootstrap: convert clippy to use Tarball
1 parent 8a711a0 commit 521b884

File tree

2 files changed

+19
-48
lines changed

2 files changed

+19
-48
lines changed

src/bootstrap/dist.rs

Lines changed: 10 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1256,16 +1256,6 @@ impl Step for Clippy {
12561256
let target = self.target;
12571257
assert!(builder.config.extended);
12581258

1259-
let src = builder.src.join("src/tools/clippy");
1260-
let release_num = builder.release_num("clippy");
1261-
let name = pkgname(builder, "clippy");
1262-
let version = builder.clippy_info.version(builder, &release_num);
1263-
1264-
let tmp = tmpdir(builder);
1265-
let image = tmp.join("clippy-image");
1266-
drop(fs::remove_dir_all(&image));
1267-
builder.create_dir(&image);
1268-
12691259
// Prepare the image directory
12701260
// We expect clippy to build, because we've exited this step above if tool
12711261
// state for clippy isn't testing.
@@ -1275,45 +1265,17 @@ impl Step for Clippy {
12751265
let cargoclippy = builder
12761266
.ensure(tool::CargoClippy { compiler, target, extra_features: Vec::new() })
12771267
.expect("clippy expected to build - essential tool");
1268+
let src = builder.src.join("src/tools/clippy");
12781269

1279-
builder.install(&clippy, &image.join("bin"), 0o755);
1280-
builder.install(&cargoclippy, &image.join("bin"), 0o755);
1281-
let doc = image.join("share/doc/clippy");
1282-
builder.install(&src.join("README.md"), &doc, 0o644);
1283-
builder.install(&src.join("LICENSE-APACHE"), &doc, 0o644);
1284-
builder.install(&src.join("LICENSE-MIT"), &doc, 0o644);
1285-
1286-
// Prepare the overlay
1287-
let overlay = tmp.join("clippy-overlay");
1288-
drop(fs::remove_dir_all(&overlay));
1289-
t!(fs::create_dir_all(&overlay));
1290-
builder.install(&src.join("README.md"), &overlay, 0o644);
1291-
builder.install(&src.join("LICENSE-APACHE"), &doc, 0o644);
1292-
builder.install(&src.join("LICENSE-MIT"), &doc, 0o644);
1293-
builder.create(&overlay.join("version"), &version);
1294-
1295-
// Generate the installer tarball
1296-
let mut cmd = rust_installer(builder);
1297-
cmd.arg("generate")
1298-
.arg("--product-name=Rust")
1299-
.arg("--rel-manifest-dir=rustlib")
1300-
.arg("--success-message=clippy-ready-to-serve.")
1301-
.arg("--image-dir")
1302-
.arg(&image)
1303-
.arg("--work-dir")
1304-
.arg(&tmpdir(builder))
1305-
.arg("--output-dir")
1306-
.arg(&distdir(builder))
1307-
.arg("--non-installed-overlay")
1308-
.arg(&overlay)
1309-
.arg(format!("--package-name={}-{}", name, target.triple))
1310-
.arg("--legacy-manifest-dirs=rustlib,cargo")
1311-
.arg("--component-name=clippy-preview");
1312-
1313-
builder.info(&format!("Dist clippy stage{} ({})", compiler.stage, target));
1314-
let _time = timeit(builder);
1315-
builder.run(&mut cmd);
1316-
distdir(builder).join(format!("{}-{}.tar.gz", name, target.triple))
1270+
let mut tarball = Tarball::new(builder, "clippy", &target.triple);
1271+
tarball.set_overlay(OverlayKind::Clippy);
1272+
tarball.is_preview(true);
1273+
tarball.add_file(clippy, "bin", 0o755);
1274+
tarball.add_file(cargoclippy, "bin", 0o755);
1275+
tarball.add_file(src.join("README.md"), "share/doc/clippy", 0o644);
1276+
tarball.add_file(src.join("LICENSE-APACHE"), "share/doc/clippy", 0o644);
1277+
tarball.add_file(src.join("LICENSE-MIT"), "share/doc/clippy", 0o644);
1278+
tarball.generate()
13171279
}
13181280
}
13191281

src/bootstrap/tarball.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ pub(crate) enum OverlayKind {
99
Rust,
1010
LLVM,
1111
Cargo,
12+
Clippy,
1213
}
1314

1415
impl OverlayKind {
@@ -24,6 +25,11 @@ impl OverlayKind {
2425
"src/tools/cargo/LICENSE-APACHE",
2526
"src/tools/cargo/LICENSE-THIRD-PARTY",
2627
],
28+
OverlayKind::Clippy => &[
29+
"src/tools/clippy/README.md",
30+
"src/tools/clippy/LICENSE-APACHE",
31+
"src/tools/clippy/LICENSE-MIT",
32+
],
2733
}
2834
}
2935

@@ -34,6 +40,9 @@ impl OverlayKind {
3440
OverlayKind::Cargo => {
3541
builder.cargo_info.version(builder, &builder.release_num("cargo"))
3642
}
43+
OverlayKind::Clippy => {
44+
builder.clippy_info.version(builder, &builder.release_num("clippy"))
45+
}
3746
}
3847
}
3948
}

0 commit comments

Comments
 (0)