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

Commit c0cadc9

Browse files
committed
bootstrap: convert rustc-dev to use Tarball
1 parent 79f60fb commit c0cadc9

File tree

1 file changed

+16
-40
lines changed

1 file changed

+16
-40
lines changed

src/bootstrap/dist.rs

Lines changed: 16 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ pub struct RustcDev {
605605
}
606606

607607
impl Step for RustcDev {
608-
type Output = PathBuf;
608+
type Output = Option<PathBuf>;
609609
const DEFAULT: bool = true;
610610
const ONLY_HOSTS: bool = true;
611611

@@ -624,60 +624,36 @@ impl Step for RustcDev {
624624
});
625625
}
626626

627-
fn run(self, builder: &Builder<'_>) -> PathBuf {
627+
fn run(self, builder: &Builder<'_>) -> Option<PathBuf> {
628628
let compiler = self.compiler;
629629
let target = self.target;
630-
631-
let name = pkgname(builder, "rustc-dev");
632-
let archive = distdir(builder).join(format!("{}-{}.tar.gz", name, target.triple));
633630
if skip_host_target_lib(builder, compiler) {
634-
return archive;
631+
return None;
635632
}
636633

637634
builder.ensure(compile::Rustc { compiler, target });
638635

639-
let image = tmpdir(builder).join(format!("{}-{}-image", name, target.triple));
640-
let _ = fs::remove_dir_all(&image);
636+
let tarball = Tarball::new(builder, "rustc-dev", &target.triple);
641637

642638
let compiler_to_use = builder.compiler_for(compiler.stage, compiler.host, target);
643639
let stamp = compile::librustc_stamp(builder, compiler_to_use, target);
644-
copy_target_libs(builder, target, &image, &stamp);
640+
copy_target_libs(builder, target, tarball.image_dir(), &stamp);
645641

646-
// Copy compiler sources.
647-
let dst_src = image.join("lib/rustlib/rustc-src/rust");
648-
t!(fs::create_dir_all(&dst_src));
649-
650-
let src_files = ["Cargo.lock"];
642+
let src_files = &["Cargo.lock"];
651643
// This is the reduced set of paths which will become the rustc-dev component
652644
// (essentially the compiler crates and all of their path dependencies).
653-
copy_src_dirs(builder, &builder.src, &["compiler"], &[], &dst_src);
654-
for file in src_files.iter() {
655-
builder.copy(&builder.src.join(file), &dst_src.join(file));
645+
copy_src_dirs(
646+
builder,
647+
&builder.src,
648+
&["compiler"],
649+
&[],
650+
&tarball.image_dir().join("lib/rustlib/rustc-src/rust"),
651+
);
652+
for file in src_files {
653+
tarball.add_file(builder.src.join(file), "lib/rustlib/rustc-src/rust", 0o644);
656654
}
657655

658-
let mut cmd = rust_installer(builder);
659-
cmd.arg("generate")
660-
.arg("--product-name=Rust")
661-
.arg("--rel-manifest-dir=rustlib")
662-
.arg("--success-message=Rust-is-ready-to-develop.")
663-
.arg("--image-dir")
664-
.arg(&image)
665-
.arg("--work-dir")
666-
.arg(&tmpdir(builder))
667-
.arg("--output-dir")
668-
.arg(&distdir(builder))
669-
.arg(format!("--package-name={}-{}", name, target.triple))
670-
.arg(format!("--component-name=rustc-dev-{}", target.triple))
671-
.arg("--legacy-manifest-dirs=rustlib,cargo");
672-
673-
builder.info(&format!(
674-
"Dist rustc-dev stage{} ({} -> {})",
675-
compiler.stage, &compiler.host, target
676-
));
677-
let _time = timeit(builder);
678-
builder.run(&mut cmd);
679-
builder.remove_dir(&image);
680-
archive
656+
Some(tarball.generate())
681657
}
682658
}
683659

0 commit comments

Comments
 (0)