mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
bootstrap: convert rustfmt to use Tarball
This commit is contained in:
parent
2073ea5c07
commit
2b54f0de37
@ -1355,17 +1355,6 @@ impl Step for Rustfmt {
|
||||
let compiler = self.compiler;
|
||||
let target = self.target;
|
||||
|
||||
let src = builder.src.join("src/tools/rustfmt");
|
||||
let release_num = builder.release_num("rustfmt");
|
||||
let name = pkgname(builder, "rustfmt");
|
||||
let version = builder.rustfmt_info.version(builder, &release_num);
|
||||
|
||||
let tmp = tmpdir(builder);
|
||||
let image = tmp.join("rustfmt-image");
|
||||
drop(fs::remove_dir_all(&image));
|
||||
builder.create_dir(&image);
|
||||
|
||||
// Prepare the image directory
|
||||
let rustfmt = builder
|
||||
.ensure(tool::Rustfmt { compiler, target, extra_features: Vec::new() })
|
||||
.or_else(|| {
|
||||
@ -1379,44 +1368,13 @@ impl Step for Rustfmt {
|
||||
None
|
||||
})?;
|
||||
|
||||
builder.install(&rustfmt, &image.join("bin"), 0o755);
|
||||
builder.install(&cargofmt, &image.join("bin"), 0o755);
|
||||
let doc = image.join("share/doc/rustfmt");
|
||||
builder.install(&src.join("README.md"), &doc, 0o644);
|
||||
builder.install(&src.join("LICENSE-MIT"), &doc, 0o644);
|
||||
builder.install(&src.join("LICENSE-APACHE"), &doc, 0o644);
|
||||
|
||||
// Prepare the overlay
|
||||
let overlay = tmp.join("rustfmt-overlay");
|
||||
drop(fs::remove_dir_all(&overlay));
|
||||
builder.create_dir(&overlay);
|
||||
builder.install(&src.join("README.md"), &overlay, 0o644);
|
||||
builder.install(&src.join("LICENSE-MIT"), &overlay, 0o644);
|
||||
builder.install(&src.join("LICENSE-APACHE"), &overlay, 0o644);
|
||||
builder.create(&overlay.join("version"), &version);
|
||||
|
||||
// Generate the installer tarball
|
||||
let mut cmd = rust_installer(builder);
|
||||
cmd.arg("generate")
|
||||
.arg("--product-name=Rust")
|
||||
.arg("--rel-manifest-dir=rustlib")
|
||||
.arg("--success-message=rustfmt-ready-to-fmt.")
|
||||
.arg("--image-dir")
|
||||
.arg(&image)
|
||||
.arg("--work-dir")
|
||||
.arg(&tmpdir(builder))
|
||||
.arg("--output-dir")
|
||||
.arg(&distdir(builder))
|
||||
.arg("--non-installed-overlay")
|
||||
.arg(&overlay)
|
||||
.arg(format!("--package-name={}-{}", name, target.triple))
|
||||
.arg("--legacy-manifest-dirs=rustlib,cargo")
|
||||
.arg("--component-name=rustfmt-preview");
|
||||
|
||||
builder.info(&format!("Dist Rustfmt stage{} ({})", compiler.stage, target));
|
||||
let _time = timeit(builder);
|
||||
builder.run(&mut cmd);
|
||||
Some(distdir(builder).join(format!("{}-{}.tar.gz", name, target.triple)))
|
||||
let mut tarball = Tarball::new(builder, "rustfmt", &target.triple);
|
||||
tarball.set_overlay(OverlayKind::Rustfmt);
|
||||
tarball.is_preview(true);
|
||||
tarball.add_file(rustfmt, "bin", 0o755);
|
||||
tarball.add_file(cargofmt, "bin", 0o755);
|
||||
tarball.add_legal_and_readme_to("share/doc/rustfmt");
|
||||
Some(tarball.generate())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@ pub(crate) enum OverlayKind {
|
||||
Cargo,
|
||||
Clippy,
|
||||
Miri,
|
||||
Rustfmt,
|
||||
}
|
||||
|
||||
impl OverlayKind {
|
||||
@ -36,6 +37,11 @@ impl OverlayKind {
|
||||
"src/tools/miri/LICENSE-APACHE",
|
||||
"src/tools/miri/LICENSE-MIT",
|
||||
],
|
||||
OverlayKind::Rustfmt => &[
|
||||
"src/tools/rustfmt/README.md",
|
||||
"src/tools/rustfmt/LICENSE-APACHE",
|
||||
"src/tools/rustfmt/LICENSE-MIT",
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,6 +56,9 @@ impl OverlayKind {
|
||||
builder.clippy_info.version(builder, &builder.release_num("clippy"))
|
||||
}
|
||||
OverlayKind::Miri => builder.miri_info.version(builder, &builder.release_num("miri")),
|
||||
OverlayKind::Rustfmt => {
|
||||
builder.rustfmt_info.version(builder, &builder.release_num("rustfmt"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user