Skip to content

Commit b398a72

Browse files
Publish compiletest as a rustc-tools component
1 parent 038f9e6 commit b398a72

File tree

3 files changed

+46
-1
lines changed

3 files changed

+46
-1
lines changed

src/bootstrap/builder.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,7 @@ impl<'a> Builder<'a> {
724724
dist::LlvmTools,
725725
dist::RustDev,
726726
dist::Extended,
727+
dist::RustcTools,
727728
// It seems that PlainSourceTarball somehow changes how some of the tools
728729
// perceive their dependencies (see #93033) which would invalidate fingerprints
729730
// and force us to rebuild tools after vendoring dependencies.

src/bootstrap/dist.rs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2006,6 +2006,47 @@ impl Step for LlvmTools {
20062006
}
20072007
}
20082008

2009+
/// This tarball contains tools useful inside/outside the rustc tree (today just
2010+
/// compiletest). This is separate from the rust-dev tarball packaged below
2011+
/// because that contains a full LLVM and in practice keeping that separate
2012+
/// makes a lot of sense (it's probably worth renaming that tarball but that
2013+
/// takes some work to do). We also publish this component on nightly, so that
2014+
/// consumers (like clippy) can make use of it.
2015+
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
2016+
pub struct RustcTools {
2017+
pub target: TargetSelection,
2018+
}
2019+
2020+
impl Step for RustcTools {
2021+
type Output = Option<GeneratedTarball>;
2022+
const ONLY_HOSTS: bool = true;
2023+
const DEFAULT: bool = true;
2024+
2025+
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
2026+
let default = should_build_extended_tool(&run.builder, "rustc-tools");
2027+
run.alias("rustc-tools").default_condition(default)
2028+
}
2029+
2030+
fn make_run(run: RunConfig<'_>) {
2031+
run.builder.ensure(RustcTools { target: run.target });
2032+
}
2033+
2034+
fn run(self, builder: &Builder<'_>) -> Option<GeneratedTarball> {
2035+
let target = self.target;
2036+
2037+
let mut tarball = Tarball::new(builder, "rustc-tools", &target.triple);
2038+
tarball.set_overlay(OverlayKind::Rust);
2039+
tarball.is_preview(true);
2040+
2041+
// We place compiletest in rustlib since it shouldn't be directly run,
2042+
// only through some wrapper tool.
2043+
let dst_bindir = format!("lib/rustlib/{}/bin", target.triple);
2044+
tarball.add_file(builder.tool_exe(tool::Tool::Compiletest), &dst_bindir, 0o755);
2045+
2046+
Some(tarball.generate())
2047+
}
2048+
}
2049+
20092050
// Tarball intended for internal consumption to ease rustc/std development.
20102051
//
20112052
// Should not be considered stable by end users.

src/tools/build-manifest/src/main.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ static PKG_INSTALLERS: &[&str] = &["x86_64-apple-darwin", "aarch64-apple-darwin"
184184

185185
static MINGW: &[&str] = &["i686-pc-windows-gnu", "x86_64-pc-windows-gnu"];
186186

187-
static NIGHTLY_ONLY_COMPONENTS: &[&str] = &["miri-preview"];
187+
static NIGHTLY_ONLY_COMPONENTS: &[&str] = &["miri-preview", "rustc-tools-preview"];
188188

189189
macro_rules! t {
190190
($e:expr) => {
@@ -323,6 +323,7 @@ impl Builder {
323323
package!("rust-analyzer-preview", HOSTS);
324324
package!("clippy-preview", HOSTS);
325325
package!("miri-preview", HOSTS);
326+
package!("rustc-tools-preview", HOSTS);
326327
package!("rustfmt-preview", HOSTS);
327328
package!("rust-analysis", TARGETS);
328329
package!("llvm-tools-preview", TARGETS);
@@ -403,6 +404,7 @@ impl Builder {
403404
rename("rustfmt", "rustfmt-preview");
404405
rename("clippy", "clippy-preview");
405406
rename("miri", "miri-preview");
407+
rename("rustc-tools", "rustc-tools-preview");
406408
rename("rust-analyzer", "rust-analyzer-preview");
407409
}
408410

@@ -454,6 +456,7 @@ impl Builder {
454456
extensions.extend(vec![
455457
host_component("clippy-preview"),
456458
host_component("miri-preview"),
459+
host_component("rustc-tools-preview"),
457460
host_component("rls-preview"),
458461
host_component("rust-analyzer-preview"),
459462
host_component("rustfmt-preview"),

0 commit comments

Comments
 (0)