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

Commit c4aaff6

Browse files
committed
bootstrap: convert rust-analysis to use Tarball
1 parent c0cadc9 commit c4aaff6

File tree

1 file changed

+12
-36
lines changed

1 file changed

+12
-36
lines changed

src/bootstrap/dist.rs

Lines changed: 12 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ pub struct Analysis {
664664
}
665665

666666
impl Step for Analysis {
667-
type Output = PathBuf;
667+
type Output = Option<PathBuf>;
668668
const DEFAULT: bool = true;
669669

670670
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
@@ -687,52 +687,26 @@ impl Step for Analysis {
687687
}
688688

689689
/// Creates a tarball of save-analysis metadata, if available.
690-
fn run(self, builder: &Builder<'_>) -> PathBuf {
690+
fn run(self, builder: &Builder<'_>) -> Option<PathBuf> {
691691
let compiler = self.compiler;
692692
let target = self.target;
693693
assert!(builder.config.extended);
694-
let name = pkgname(builder, "rust-analysis");
695-
696694
if compiler.host != builder.config.build {
697-
return distdir(builder).join(format!("{}-{}.tar.gz", name, target.triple));
695+
return None;
698696
}
699697

700698
builder.ensure(compile::Std { compiler, target });
701-
702-
let image = tmpdir(builder).join(format!("{}-{}-image", name, target.triple));
703-
704699
let src = builder
705700
.stage_out(compiler, Mode::Std)
706701
.join(target.triple)
707702
.join(builder.cargo_dir())
708-
.join("deps");
709-
710-
let image_src = src.join("save-analysis");
711-
let dst = image.join("lib/rustlib").join(target.triple).join("analysis");
712-
t!(fs::create_dir_all(&dst));
713-
builder.info(&format!("image_src: {:?}, dst: {:?}", image_src, dst));
714-
builder.cp_r(&image_src, &dst);
715-
716-
let mut cmd = rust_installer(builder);
717-
cmd.arg("generate")
718-
.arg("--product-name=Rust")
719-
.arg("--rel-manifest-dir=rustlib")
720-
.arg("--success-message=save-analysis-saved.")
721-
.arg("--image-dir")
722-
.arg(&image)
723-
.arg("--work-dir")
724-
.arg(&tmpdir(builder))
725-
.arg("--output-dir")
726-
.arg(&distdir(builder))
727-
.arg(format!("--package-name={}-{}", name, target.triple))
728-
.arg(format!("--component-name=rust-analysis-{}", target.triple))
729-
.arg("--legacy-manifest-dirs=rustlib,cargo");
703+
.join("deps")
704+
.join("save-analysis");
730705

731-
builder.info("Dist analysis");
732-
let _time = timeit(builder);
733-
builder.run(&mut cmd);
734-
builder.remove_dir(&image);
735-
distdir(builder).join(format!("{}-{}.tar.gz", name, target.triple))
706+
let mut tarball = Tarball::new(builder, "rust-analysis", &target.triple);
707+
tarball.include_target_in_component_name(true);
708+
tarball.add_dir(src, format!("lib/rustlib/{}/analysis", target.triple));
709+
Some(tarball.generate())
736710
}
737711
}
738712

@@ -1652,7 +1626,9 @@ impl Step for Extended {
16521626
tarballs.extend(miri_installer.clone());
16531627
tarballs.extend(rustfmt_installer.clone());
16541628
tarballs.extend(llvm_tools_installer);
1655-
tarballs.push(analysis_installer);
1629+
if let Some(analysis_installer) = analysis_installer {
1630+
tarballs.push(analysis_installer);
1631+
}
16561632
tarballs.push(std_installer.expect("missing std"));
16571633
if let Some(docs_installer) = docs_installer {
16581634
tarballs.push(docs_installer);

0 commit comments

Comments
 (0)