Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish compiletest as a rustc-tools component #99968

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,7 @@ impl<'a> Builder<'a> {
dist::LlvmTools,
dist::RustDev,
dist::Extended,
dist::RustcTools,
// It seems that PlainSourceTarball somehow changes how some of the tools
// perceive their dependencies (see #93033) which would invalidate fingerprints
// and force us to rebuild tools after vendoring dependencies.
Expand Down
41 changes: 41 additions & 0 deletions src/bootstrap/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2006,6 +2006,47 @@ impl Step for LlvmTools {
}
}

/// This tarball contains tools useful inside/outside the rustc tree (today just
/// compiletest). This is separate from the rust-dev tarball packaged below
/// because that contains a full LLVM and in practice keeping that separate
/// makes a lot of sense (it's probably worth renaming that tarball but that
/// takes some work to do). We also publish this component on nightly, so that
/// consumers (like clippy) can make use of it.
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
pub struct RustcTools {
pub target: TargetSelection,
}

impl Step for RustcTools {
type Output = Option<GeneratedTarball>;
const ONLY_HOSTS: bool = true;
const DEFAULT: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
let default = should_build_extended_tool(&run.builder, "rustc-tools");
run.alias("rustc-tools").default_condition(default)
}

fn make_run(run: RunConfig<'_>) {
run.builder.ensure(RustcTools { target: run.target });
}

fn run(self, builder: &Builder<'_>) -> Option<GeneratedTarball> {
let target = self.target;

let mut tarball = Tarball::new(builder, "rustc-tools", &target.triple);
tarball.set_overlay(OverlayKind::Rust);
tarball.is_preview(true);

// We place compiletest in rustlib since it shouldn't be directly run,
// only through some wrapper tool.
let dst_bindir = format!("lib/rustlib/{}/bin", target.triple);
tarball.add_file(builder.tool_exe(tool::Tool::Compiletest), &dst_bindir, 0o755);

Some(tarball.generate())
}
}

// Tarball intended for internal consumption to ease rustc/std development.
//
// Should not be considered stable by end users.
Expand Down
12 changes: 10 additions & 2 deletions src/tools/build-manifest/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ static PKG_INSTALLERS: &[&str] = &["x86_64-apple-darwin", "aarch64-apple-darwin"

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

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

macro_rules! t {
($e:expr) => {
Expand Down Expand Up @@ -323,6 +323,7 @@ impl Builder {
package!("rust-analyzer-preview", HOSTS);
package!("clippy-preview", HOSTS);
package!("miri-preview", HOSTS);
package!("rustc-tools-preview", HOSTS);
package!("rustfmt-preview", HOSTS);
package!("rust-analysis", TARGETS);
package!("llvm-tools-preview", TARGETS);
Expand Down Expand Up @@ -403,6 +404,7 @@ impl Builder {
rename("rustfmt", "rustfmt-preview");
rename("clippy", "clippy-preview");
rename("miri", "miri-preview");
rename("rustc-tools", "rustc-tools-preview");
rename("rust-analyzer", "rust-analyzer-preview");
}

Expand Down Expand Up @@ -454,6 +456,7 @@ impl Builder {
extensions.extend(vec![
host_component("clippy-preview"),
host_component("miri-preview"),
host_component("rustc-tools-preview"),
host_component("rls-preview"),
host_component("rust-analyzer-preview"),
host_component("rustfmt-preview"),
Expand Down Expand Up @@ -544,7 +547,12 @@ impl Builder {
if target_name.contains(substr) {
let t = Target::from_compressed_tar(self, &tarball_name!(fallback_target));
// Fallbacks must always be available.
assert!(t.available);
assert!(
t.available,
"{} fallback for {} not available",
tarball_name!(target_name),
tarball_name!(fallback_target)
);
return t;
}
}
Expand Down