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

Commit 2e0a16c

Browse files
committed
bootstrap: convert rust-analyzer to use Tarball
1 parent cfb23e8 commit 2e0a16c

File tree

2 files changed

+15
-50
lines changed

2 files changed

+15
-50
lines changed

src/bootstrap/dist.rs

Lines changed: 6 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,60 +1122,16 @@ impl Step for RustAnalyzer {
11221122
return None;
11231123
}
11241124

1125-
let src = builder.src.join("src/tools/rust-analyzer");
1126-
let release_num = builder.release_num("rust-analyzer/crates/rust-analyzer");
1127-
let name = pkgname(builder, "rust-analyzer");
1128-
let version = builder.rust_analyzer_info.version(builder, &release_num);
1129-
1130-
let tmp = tmpdir(builder);
1131-
let image = tmp.join("rust-analyzer-image");
1132-
drop(fs::remove_dir_all(&image));
1133-
builder.create_dir(&image);
1134-
1135-
// Prepare the image directory
1136-
// We expect rust-analyer to always build, as it doesn't depend on rustc internals
1137-
// and doesn't have associated toolstate.
11381125
let rust_analyzer = builder
11391126
.ensure(tool::RustAnalyzer { compiler, target, extra_features: Vec::new() })
11401127
.expect("rust-analyzer always builds");
11411128

1142-
builder.install(&rust_analyzer, &image.join("bin"), 0o755);
1143-
let doc = image.join("share/doc/rust-analyzer");
1144-
builder.install(&src.join("README.md"), &doc, 0o644);
1145-
builder.install(&src.join("LICENSE-APACHE"), &doc, 0o644);
1146-
builder.install(&src.join("LICENSE-MIT"), &doc, 0o644);
1147-
1148-
// Prepare the overlay
1149-
let overlay = tmp.join("rust-analyzer-overlay");
1150-
drop(fs::remove_dir_all(&overlay));
1151-
t!(fs::create_dir_all(&overlay));
1152-
builder.install(&src.join("README.md"), &overlay, 0o644);
1153-
builder.install(&src.join("LICENSE-APACHE"), &doc, 0o644);
1154-
builder.install(&src.join("LICENSE-MIT"), &doc, 0o644);
1155-
builder.create(&overlay.join("version"), &version);
1156-
1157-
// Generate the installer tarball
1158-
let mut cmd = rust_installer(builder);
1159-
cmd.arg("generate")
1160-
.arg("--product-name=Rust")
1161-
.arg("--rel-manifest-dir=rustlib")
1162-
.arg("--success-message=rust-analyzer-ready-to-serve.")
1163-
.arg("--image-dir")
1164-
.arg(&image)
1165-
.arg("--work-dir")
1166-
.arg(&tmpdir(builder))
1167-
.arg("--output-dir")
1168-
.arg(&distdir(builder))
1169-
.arg("--non-installed-overlay")
1170-
.arg(&overlay)
1171-
.arg(format!("--package-name={}-{}", name, target.triple))
1172-
.arg("--legacy-manifest-dirs=rustlib,cargo")
1173-
.arg("--component-name=rust-analyzer-preview");
1174-
1175-
builder.info(&format!("Dist rust-analyzer stage{} ({})", compiler.stage, target));
1176-
let _time = timeit(builder);
1177-
builder.run(&mut cmd);
1178-
Some(distdir(builder).join(format!("{}-{}.tar.gz", name, target.triple)))
1129+
let mut tarball = Tarball::new(builder, "rust-analyzer", &target.triple);
1130+
tarball.set_overlay(OverlayKind::RustAnalyzer);
1131+
tarball.is_preview(true);
1132+
tarball.add_file(rust_analyzer, "bin", 0o755);
1133+
tarball.add_legal_and_readme_to("share/doc/rust-analyzer");
1134+
Some(tarball.generate())
11791135
}
11801136
}
11811137

src/bootstrap/tarball.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ pub(crate) enum OverlayKind {
1313
Miri,
1414
Rustfmt,
1515
RLS,
16+
RustAnalyzer,
1617
}
1718

1819
impl OverlayKind {
@@ -48,6 +49,11 @@ impl OverlayKind {
4849
"src/tools/rls/LICENSE-APACHE",
4950
"src/tools/rls/LICENSE-MIT",
5051
],
52+
OverlayKind::RustAnalyzer => &[
53+
"src/tools/rust-analyzer/README.md",
54+
"src/tools/rust-analyzer/LICENSE-APACHE",
55+
"src/tools/rust-analyzer/LICENSE-MIT",
56+
],
5157
}
5258
}
5359

@@ -66,6 +72,9 @@ impl OverlayKind {
6672
builder.rustfmt_info.version(builder, &builder.release_num("rustfmt"))
6773
}
6874
OverlayKind::RLS => builder.rls_info.version(builder, &builder.release_num("rls")),
75+
OverlayKind::RustAnalyzer => builder
76+
.rust_analyzer_info
77+
.version(builder, &builder.release_num("rust-analyzer/crates/rust-analyzer")),
6978
}
7079
}
7180
}

0 commit comments

Comments
 (0)