Skip to content

Commit e1c63cd

Browse files
committed
Refactor Analysis dist step
1 parent 99b044e commit e1c63cd

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

src/bootstrap/src/core/build_steps/dist.rs

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -889,14 +889,19 @@ impl Step for RustcDev {
889889
}
890890
}
891891

892+
/// The `rust-analysis` component used to create a tarball of save-analysis metadata.
893+
///
894+
/// This component has been deprecated and its contents now only include a warning about
895+
/// its non-availability.
892896
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
893897
pub struct Analysis {
894-
pub compiler: Compiler,
895-
pub target: TargetSelection,
898+
build_compiler: Compiler,
899+
target: TargetSelection,
896900
}
897901

898902
impl Step for Analysis {
899903
type Output = Option<GeneratedTarball>;
904+
900905
const DEFAULT: bool = true;
901906

902907
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
@@ -905,24 +910,17 @@ impl Step for Analysis {
905910
}
906911

907912
fn make_run(run: RunConfig<'_>) {
913+
// The step just produces a deprecation notice, so we just hardcode stage 1
908914
run.builder.ensure(Analysis {
909-
// Find the actual compiler (handling the full bootstrap option) which
910-
// produced the save-analysis data because that data isn't copied
911-
// through the sysroot uplifting.
912-
compiler: run.builder.compiler_for(
913-
run.builder.top_stage,
914-
run.builder.config.host_target,
915-
run.target,
916-
),
915+
build_compiler: run.builder.compiler(1, run.builder.config.host_target),
917916
target: run.target,
918917
});
919918
}
920919

921-
/// Creates a tarball of (degenerate) save-analysis metadata, if available.
922920
fn run(self, builder: &Builder<'_>) -> Option<GeneratedTarball> {
923-
let compiler = self.compiler;
921+
let compiler = self.build_compiler;
924922
let target = self.target;
925-
if !builder.config.is_host_target(compiler.host) {
923+
if skip_host_target_lib(builder, compiler) {
926924
return None;
927925
}
928926

@@ -945,6 +943,10 @@ impl Step for Analysis {
945943
tarball.add_dir(src, format!("lib/rustlib/{}/analysis", target.triple));
946944
Some(tarball.generate())
947945
}
946+
947+
fn metadata(&self) -> Option<StepMetadata> {
948+
Some(StepMetadata::dist("analysis", self.target).built_by(self.build_compiler))
949+
}
948950
}
949951

950952
/// Use the `builder` to make a filtered copy of `base`/X for X in (`src_dirs` - `exclude_dirs`) to
@@ -1669,7 +1671,7 @@ impl Step for Extended {
16691671
add_component!("llvm-components" => LlvmTools { target });
16701672
add_component!("clippy" => Clippy { build_compiler: compiler, target });
16711673
add_component!("miri" => Miri { build_compiler: compiler, target });
1672-
add_component!("analysis" => Analysis { compiler, target });
1674+
add_component!("analysis" => Analysis { build_compiler: compiler, target });
16731675
add_component!("rustc-codegen-cranelift" => CraneliftCodegenBackend {
16741676
build_compiler: compiler,
16751677
target

src/bootstrap/src/core/builder/tests.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,6 +1121,7 @@ mod snapshot {
11211121
[dist] rustc <host>
11221122
[dist] rustc 1 <host> -> std 1 <host>
11231123
[dist] rustc 1 <host> -> rustc-dev 2 <host>
1124+
[dist] rustc 1 <host> -> analysis 2 <host>
11241125
[dist] src <>
11251126
[build] rustc 1 <host> -> cargo 2 <host>
11261127
[build] rustc 1 <host> -> rust-analyzer 2 <host>
@@ -1449,6 +1450,7 @@ mod snapshot {
14491450
[dist] rustc <target1>
14501451
[dist] rustc 1 <host> -> std 1 <target1>
14511452
[dist] rustc 1 <host> -> rustc-dev 2 <target1>
1453+
[dist] rustc 1 <host> -> analysis 2 <target1>
14521454
[dist] src <>
14531455
[build] rustc 1 <host> -> cargo 2 <target1>
14541456
[build] rustc 1 <host> -> rust-analyzer 2 <target1>

0 commit comments

Comments
 (0)