Skip to content

Commit ead999c

Browse files
committed
skip tar generation and compression for x install
Signed-off-by: onur-ozkan <[email protected]>
1 parent 8abfe2b commit ead999c

File tree

5 files changed

+111
-64
lines changed

5 files changed

+111
-64
lines changed

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

Lines changed: 59 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ fn should_build_extended_tool(builder: &Builder<'_>, tool: &str) -> bool {
5353
#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)]
5454
pub struct Docs {
5555
pub host: TargetSelection,
56+
pub prepare_only: bool,
5657
}
5758

5859
impl Step for Docs {
@@ -65,7 +66,7 @@ impl Step for Docs {
6566
}
6667

6768
fn make_run(run: RunConfig<'_>) {
68-
run.builder.ensure(Docs { host: run.target });
69+
run.builder.ensure(Docs { host: run.target, prepare_only: false });
6970
}
7071

7172
/// Builds the `rust-docs` installer component.
@@ -77,6 +78,7 @@ impl Step for Docs {
7778

7879
let mut tarball = Tarball::new(builder, "rust-docs", &host.triple);
7980
tarball.set_product_name("Rust Documentation");
81+
tarball.is_prepare_only(self.prepare_only);
8082
tarball.add_bulk_dir(&builder.doc_out(host), dest);
8183
tarball.add_file(&builder.src.join("src/doc/robots.txt"), dest, 0o644);
8284
Some(tarball.generate())
@@ -351,6 +353,7 @@ impl Step for Mingw {
351353
#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)]
352354
pub struct Rustc {
353355
pub compiler: Compiler,
356+
pub prepare_only: bool,
354357
}
355358

356359
impl Step for Rustc {
@@ -363,16 +366,19 @@ impl Step for Rustc {
363366
}
364367

365368
fn make_run(run: RunConfig<'_>) {
366-
run.builder
367-
.ensure(Rustc { compiler: run.builder.compiler(run.builder.top_stage, run.target) });
369+
run.builder.ensure(Rustc {
370+
compiler: run.builder.compiler(run.builder.top_stage, run.target),
371+
prepare_only: false,
372+
});
368373
}
369374

370375
/// Creates the `rustc` installer component.
371376
fn run(self, builder: &Builder<'_>) -> GeneratedTarball {
372377
let compiler = self.compiler;
373378
let host = self.compiler.host;
374379

375-
let tarball = Tarball::new(builder, "rustc", &host.triple);
380+
let mut tarball = Tarball::new(builder, "rustc", &host.triple);
381+
tarball.is_prepare_only(self.prepare_only);
376382

377383
// Prepare the rustc "image", what will actually end up getting installed
378384
prepare_image(builder, compiler, tarball.image_dir());
@@ -620,6 +626,7 @@ fn copy_target_libs(builder: &Builder<'_>, target: TargetSelection, image: &Path
620626
pub struct Std {
621627
pub compiler: Compiler,
622628
pub target: TargetSelection,
629+
pub prepare_only: bool,
623630
}
624631

625632
impl Step for Std {
@@ -638,6 +645,7 @@ impl Step for Std {
638645
run.target,
639646
),
640647
target: run.target,
648+
prepare_only: false,
641649
});
642650
}
643651

@@ -652,6 +660,7 @@ impl Step for Std {
652660
builder.ensure(compile::Std::new(compiler, target));
653661

654662
let mut tarball = Tarball::new(builder, "rust-std", &target.triple);
663+
tarball.is_prepare_only(self.prepare_only);
655664
tarball.include_target_in_component_name(true);
656665

657666
let compiler_to_use = builder.compiler_for(compiler.stage, compiler.host, target);
@@ -870,7 +879,9 @@ fn copy_src_dirs(
870879
}
871880

872881
#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)]
873-
pub struct Src;
882+
pub struct Src {
883+
pub prepare_only: bool,
884+
}
874885

875886
impl Step for Src {
876887
/// The output path of the src installer tarball
@@ -883,7 +894,7 @@ impl Step for Src {
883894
}
884895

885896
fn make_run(run: RunConfig<'_>) {
886-
run.builder.ensure(Src);
897+
run.builder.ensure(Src { prepare_only: false });
887898
}
888899

889900
/// Creates the `rust-src` installer component
@@ -892,7 +903,8 @@ impl Step for Src {
892903
builder.update_submodule(&Path::new("src/llvm-project"));
893904
}
894905

895-
let tarball = Tarball::new_targetless(builder, "rust-src");
906+
let mut tarball = Tarball::new_targetless(builder, "rust-src");
907+
tarball.is_prepare_only(self.prepare_only);
896908

897909
// A lot of tools expect the rust-src component to be entirely in this directory, so if you
898910
// change that (e.g. by adding another directory `lib/rustlib/src/foo` or
@@ -1034,6 +1046,7 @@ impl Step for PlainSourceTarball {
10341046
pub struct Cargo {
10351047
pub compiler: Compiler,
10361048
pub target: TargetSelection,
1049+
pub prepare_only: bool,
10371050
}
10381051

10391052
impl Step for Cargo {
@@ -1054,6 +1067,7 @@ impl Step for Cargo {
10541067
run.target,
10551068
),
10561069
target: run.target,
1070+
prepare_only: false,
10571071
});
10581072
}
10591073

@@ -1068,6 +1082,7 @@ impl Step for Cargo {
10681082
// Prepare the image directory
10691083
let mut tarball = Tarball::new(builder, "cargo", &target.triple);
10701084
tarball.set_overlay(OverlayKind::Cargo);
1085+
tarball.is_prepare_only(self.prepare_only);
10711086

10721087
tarball.add_file(&cargo, "bin", 0o755);
10731088
tarball.add_file(etc.join("_cargo"), "share/zsh/site-functions", 0o644);
@@ -1127,6 +1142,7 @@ impl Step for Rls {
11271142
pub struct RustAnalyzer {
11281143
pub compiler: Compiler,
11291144
pub target: TargetSelection,
1145+
pub prepare_only: bool,
11301146
}
11311147

11321148
impl Step for RustAnalyzer {
@@ -1147,6 +1163,7 @@ impl Step for RustAnalyzer {
11471163
run.target,
11481164
),
11491165
target: run.target,
1166+
prepare_only: false,
11501167
});
11511168
}
11521169

@@ -1160,6 +1177,7 @@ impl Step for RustAnalyzer {
11601177

11611178
let mut tarball = Tarball::new(builder, "rust-analyzer", &target.triple);
11621179
tarball.set_overlay(OverlayKind::RustAnalyzer);
1180+
tarball.is_prepare_only(self.prepare_only);
11631181
tarball.is_preview(true);
11641182
tarball.add_file(rust_analyzer, "bin", 0o755);
11651183
tarball.add_legal_and_readme_to("share/doc/rust-analyzer");
@@ -1171,6 +1189,7 @@ impl Step for RustAnalyzer {
11711189
pub struct Clippy {
11721190
pub compiler: Compiler,
11731191
pub target: TargetSelection,
1192+
pub prepare_only: bool,
11741193
}
11751194

11761195
impl Step for Clippy {
@@ -1191,6 +1210,7 @@ impl Step for Clippy {
11911210
run.target,
11921211
),
11931212
target: run.target,
1213+
prepare_only: false,
11941214
});
11951215
}
11961216

@@ -1210,6 +1230,7 @@ impl Step for Clippy {
12101230

12111231
let mut tarball = Tarball::new(builder, "clippy", &target.triple);
12121232
tarball.set_overlay(OverlayKind::Clippy);
1233+
tarball.is_prepare_only(self.prepare_only);
12131234
tarball.is_preview(true);
12141235
tarball.add_file(clippy, "bin", 0o755);
12151236
tarball.add_file(cargoclippy, "bin", 0o755);
@@ -1222,6 +1243,7 @@ impl Step for Clippy {
12221243
pub struct Miri {
12231244
pub compiler: Compiler,
12241245
pub target: TargetSelection,
1246+
pub prepare_only: bool,
12251247
}
12261248

12271249
impl Step for Miri {
@@ -1242,6 +1264,7 @@ impl Step for Miri {
12421264
run.target,
12431265
),
12441266
target: run.target,
1267+
prepare_only: false,
12451268
});
12461269
}
12471270

@@ -1262,6 +1285,7 @@ impl Step for Miri {
12621285
let mut tarball = Tarball::new(builder, "miri", &target.triple);
12631286
tarball.set_overlay(OverlayKind::Miri);
12641287
tarball.is_preview(true);
1288+
tarball.is_prepare_only(self.prepare_only);
12651289
tarball.add_file(miri, "bin", 0o755);
12661290
tarball.add_file(cargomiri, "bin", 0o755);
12671291
tarball.add_legal_and_readme_to("share/doc/miri");
@@ -1273,6 +1297,7 @@ impl Step for Miri {
12731297
pub struct CodegenBackend {
12741298
pub compiler: Compiler,
12751299
pub backend: Interned<String>,
1300+
pub prepare_only: bool,
12761301
}
12771302

12781303
impl Step for CodegenBackend {
@@ -1293,6 +1318,7 @@ impl Step for CodegenBackend {
12931318
run.builder.ensure(CodegenBackend {
12941319
compiler: run.builder.compiler(run.builder.top_stage, run.target),
12951320
backend,
1321+
prepare_only: false,
12961322
});
12971323
}
12981324
}
@@ -1338,6 +1364,7 @@ impl Step for CodegenBackend {
13381364
panic!("Unknown backend rustc_codegen_{}", backend);
13391365
}
13401366
tarball.is_preview(true);
1367+
tarball.is_prepare_only(self.prepare_only);
13411368
tarball.add_legal_and_readme_to(format!("share/doc/rustc_codegen_{}", backend));
13421369

13431370
let src = builder.sysroot(compiler);
@@ -1369,6 +1396,7 @@ impl Step for CodegenBackend {
13691396
pub struct Rustfmt {
13701397
pub compiler: Compiler,
13711398
pub target: TargetSelection,
1399+
pub prepare_only: bool,
13721400
}
13731401

13741402
impl Step for Rustfmt {
@@ -1389,6 +1417,7 @@ impl Step for Rustfmt {
13891417
run.target,
13901418
),
13911419
target: run.target,
1420+
prepare_only: false,
13921421
});
13931422
}
13941423

@@ -1405,6 +1434,7 @@ impl Step for Rustfmt {
14051434
let mut tarball = Tarball::new(builder, "rustfmt", &target.triple);
14061435
tarball.set_overlay(OverlayKind::Rustfmt);
14071436
tarball.is_preview(true);
1437+
tarball.is_prepare_only(self.prepare_only);
14081438
tarball.add_file(rustfmt, "bin", 0o755);
14091439
tarball.add_file(cargofmt, "bin", 0o755);
14101440
tarball.add_legal_and_readme_to("share/doc/rustfmt");
@@ -1416,6 +1446,7 @@ impl Step for Rustfmt {
14161446
pub struct RustDemangler {
14171447
pub compiler: Compiler,
14181448
pub target: TargetSelection,
1449+
pub prepare_only: bool,
14191450
}
14201451

14211452
impl Step for RustDemangler {
@@ -1441,6 +1472,7 @@ impl Step for RustDemangler {
14411472
run.target,
14421473
),
14431474
target: run.target,
1475+
prepare_only: false,
14441476
});
14451477
}
14461478

@@ -1463,6 +1495,7 @@ impl Step for RustDemangler {
14631495
let mut tarball = Tarball::new(builder, "rust-demangler", &target.triple);
14641496
tarball.set_overlay(OverlayKind::RustDemangler);
14651497
tarball.is_preview(true);
1498+
tarball.is_prepare_only(self.prepare_only);
14661499
tarball.add_file(&rust_demangler, "bin", 0o755);
14671500
tarball.add_legal_and_readme_to("share/doc/rust-demangler");
14681501
Some(tarball.generate())
@@ -1517,27 +1550,33 @@ impl Step for Extended {
15171550
// upgrades rustc was upgraded before rust-std. To avoid rustc clobbering
15181551
// the std files during uninstall. To do this ensure that rustc comes
15191552
// before rust-std in the list below.
1520-
tarballs.push(builder.ensure(Rustc { compiler: builder.compiler(stage, target) }));
1521-
tarballs.push(builder.ensure(Std { compiler, target }).expect("missing std"));
1553+
tarballs.push(
1554+
builder
1555+
.ensure(Rustc { compiler: builder.compiler(stage, target), prepare_only: false }),
1556+
);
1557+
tarballs.push(
1558+
builder.ensure(Std { compiler, target, prepare_only: false }).expect("missing std"),
1559+
);
15221560

15231561
if target.ends_with("windows-gnu") {
15241562
tarballs.push(builder.ensure(Mingw { host: target }).expect("missing mingw"));
15251563
}
15261564

1527-
add_component!("rust-docs" => Docs { host: target });
1565+
add_component!("rust-docs" => Docs { host: target, prepare_only: false });
15281566
add_component!("rust-json-docs" => JsonDocs { host: target });
1529-
add_component!("rust-demangler"=> RustDemangler { compiler, target });
1530-
add_component!("cargo" => Cargo { compiler, target });
1531-
add_component!("rustfmt" => Rustfmt { compiler, target });
1567+
add_component!("rust-demangler"=> RustDemangler { compiler, target, prepare_only: false });
1568+
add_component!("cargo" => Cargo { compiler, target, prepare_only: false });
1569+
add_component!("rustfmt" => Rustfmt { compiler, target, prepare_only: false });
15321570
add_component!("rls" => Rls { compiler, target });
1533-
add_component!("rust-analyzer" => RustAnalyzer { compiler, target });
1534-
add_component!("llvm-components" => LlvmTools { target });
1535-
add_component!("clippy" => Clippy { compiler, target });
1536-
add_component!("miri" => Miri { compiler, target });
1571+
add_component!("rust-analyzer" => RustAnalyzer { compiler, target, prepare_only: false });
1572+
add_component!("llvm-components" => LlvmTools { target, prepare_only: false });
1573+
add_component!("clippy" => Clippy { compiler, target, prepare_only: false });
1574+
add_component!("miri" => Miri { compiler, target, prepare_only: false });
15371575
add_component!("analysis" => Analysis { compiler, target });
15381576
add_component!("rustc-codegen-cranelift" => CodegenBackend {
15391577
compiler: builder.compiler(stage, target),
15401578
backend: INTERNER.intern_str("cranelift"),
1579+
prepare_only: false
15411580
});
15421581

15431582
let etc = builder.src.join("src/etc/installer");
@@ -2123,6 +2162,7 @@ pub fn maybe_install_llvm_runtime(builder: &Builder<'_>, target: TargetSelection
21232162
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
21242163
pub struct LlvmTools {
21252164
pub target: TargetSelection,
2165+
pub prepare_only: bool,
21262166
}
21272167

21282168
impl Step for LlvmTools {
@@ -2137,7 +2177,7 @@ impl Step for LlvmTools {
21372177
}
21382178

21392179
fn make_run(run: RunConfig<'_>) {
2140-
run.builder.ensure(LlvmTools { target: run.target });
2180+
run.builder.ensure(LlvmTools { target: run.target, prepare_only: false });
21412181
}
21422182

21432183
fn run(self, builder: &Builder<'_>) -> Option<GeneratedTarball> {
@@ -2156,6 +2196,7 @@ impl Step for LlvmTools {
21562196
let mut tarball = Tarball::new(builder, "llvm-tools", &target.triple);
21572197
tarball.set_overlay(OverlayKind::LLVM);
21582198
tarball.is_preview(true);
2199+
tarball.is_prepare_only(self.prepare_only);
21592200

21602201
// Prepare the image directory
21612202
let src_bindir = builder.llvm_out(target).join("bin");

0 commit comments

Comments
 (0)