@@ -38,15 +38,14 @@ impl Step for CleanTools {
38
38
}
39
39
40
40
fn run ( self , builder : & Builder ) {
41
- let build = builder. build ;
42
41
let compiler = self . compiler ;
43
42
let target = self . target ;
44
43
let mode = self . mode ;
45
44
46
45
// This is for the original compiler, but if we're forced to use stage 1, then
47
46
// std/test/rustc stamps won't exist in stage 2, so we need to get those from stage 1, since
48
47
// we copy the libs forward.
49
- let tools_dir = build . stage_out ( compiler, Mode :: Tool ) ;
48
+ let tools_dir = builder . stage_out ( compiler, Mode :: Tool ) ;
50
49
let compiler = if builder. force_use_stage1 ( compiler, target) {
51
50
builder. compiler ( 1 , compiler. host )
52
51
} else {
@@ -55,13 +54,13 @@ impl Step for CleanTools {
55
54
56
55
for & cur_mode in & [ Mode :: Libstd , Mode :: Libtest , Mode :: Librustc ] {
57
56
let stamp = match cur_mode {
58
- Mode :: Libstd => libstd_stamp ( build , compiler, target) ,
59
- Mode :: Libtest => libtest_stamp ( build , compiler, target) ,
60
- Mode :: Librustc => librustc_stamp ( build , compiler, target) ,
57
+ Mode :: Libstd => libstd_stamp ( builder , compiler, target) ,
58
+ Mode :: Libtest => libtest_stamp ( builder , compiler, target) ,
59
+ Mode :: Librustc => librustc_stamp ( builder , compiler, target) ,
61
60
_ => panic ! ( ) ,
62
61
} ;
63
62
64
- if build . clear_if_dirty ( & tools_dir, & stamp) {
63
+ if builder . clear_if_dirty ( & tools_dir, & stamp) {
65
64
break ;
66
65
}
67
66
@@ -97,7 +96,6 @@ impl Step for ToolBuild {
97
96
/// This will build the specified tool with the specified `host` compiler in
98
97
/// `stage` into the normal cargo output directory.
99
98
fn run ( self , builder : & Builder ) -> Option < PathBuf > {
100
- let build = builder. build ;
101
99
let compiler = self . compiler ;
102
100
let target = self . target ;
103
101
let tool = self . tool ;
@@ -114,10 +112,10 @@ impl Step for ToolBuild {
114
112
let mut cargo = prepare_tool_cargo ( builder, compiler, target, "build" , path) ;
115
113
cargo. arg ( "--features" ) . arg ( self . extra_features . join ( " " ) ) ;
116
114
117
- let _folder = build . fold_output ( || format ! ( "stage{}-{}" , compiler. stage, tool) ) ;
118
- build . info ( & format ! ( "Building stage{} tool {} ({})" , compiler. stage, tool, target) ) ;
115
+ let _folder = builder . fold_output ( || format ! ( "stage{}-{}" , compiler. stage, tool) ) ;
116
+ builder . info ( & format ! ( "Building stage{} tool {} ({})" , compiler. stage, tool, target) ) ;
119
117
let mut duplicates = Vec :: new ( ) ;
120
- let is_expected = compile:: stream_cargo ( build , & mut cargo, & mut |msg| {
118
+ let is_expected = compile:: stream_cargo ( builder , & mut cargo, & mut |msg| {
121
119
// Only care about big things like the RLS/Cargo for now
122
120
if tool != "rls" && tool != "cargo" {
123
121
return
@@ -156,7 +154,7 @@ impl Step for ToolBuild {
156
154
}
157
155
}
158
156
159
- let mut artifacts = build . tool_artifacts . borrow_mut ( ) ;
157
+ let mut artifacts = builder . tool_artifacts . borrow_mut ( ) ;
160
158
let prev_artifacts = artifacts
161
159
. entry ( target)
162
160
. or_insert_with ( Default :: default) ;
@@ -190,7 +188,7 @@ impl Step for ToolBuild {
190
188
panic ! ( "tools should not compile multiple copies of the same crate" ) ;
191
189
}
192
190
193
- build . save_toolstate ( tool, if is_expected {
191
+ builder . save_toolstate ( tool, if is_expected {
194
192
ToolState :: TestFail
195
193
} else {
196
194
ToolState :: BuildFail
@@ -203,10 +201,10 @@ impl Step for ToolBuild {
203
201
return None ;
204
202
}
205
203
} else {
206
- let cargo_out = build . cargo_out ( compiler, Mode :: Tool , target)
204
+ let cargo_out = builder . cargo_out ( compiler, Mode :: Tool , target)
207
205
. join ( exe ( tool, & compiler. host ) ) ;
208
- let bin = build . tools_dir ( compiler) . join ( exe ( tool, & compiler. host ) ) ;
209
- build . copy ( & cargo_out, & bin) ;
206
+ let bin = builder . tools_dir ( compiler) . join ( exe ( tool, & compiler. host ) ) ;
207
+ builder . copy ( & cargo_out, & bin) ;
210
208
Some ( bin)
211
209
}
212
210
}
@@ -219,16 +217,15 @@ pub fn prepare_tool_cargo(
219
217
command : & ' static str ,
220
218
path : & ' static str ,
221
219
) -> Command {
222
- let build = builder. build ;
223
220
let mut cargo = builder. cargo ( compiler, Mode :: Tool , target, command) ;
224
- let dir = build . src . join ( path) ;
221
+ let dir = builder . src . join ( path) ;
225
222
cargo. arg ( "--manifest-path" ) . arg ( dir. join ( "Cargo.toml" ) ) ;
226
223
227
224
// We don't want to build tools dynamically as they'll be running across
228
225
// stages and such and it's just easier if they're not dynamically linked.
229
226
cargo. env ( "RUSTC_NO_PREFER_DYNAMIC" , "1" ) ;
230
227
231
- if let Some ( dir) = build . openssl_install_dir ( target) {
228
+ if let Some ( dir) = builder . openssl_install_dir ( target) {
232
229
cargo. env ( "OPENSSL_STATIC" , "1" ) ;
233
230
cargo. env ( "OPENSSL_DIR" , dir) ;
234
231
cargo. env ( "LIBZ_SYS_STATIC" , "1" ) ;
@@ -238,10 +235,10 @@ pub fn prepare_tool_cargo(
238
235
// own copy
239
236
cargo. env ( "LZMA_API_STATIC" , "1" ) ;
240
237
241
- cargo. env ( "CFG_RELEASE_CHANNEL" , & build . config . channel ) ;
242
- cargo. env ( "CFG_VERSION" , build . rust_version ( ) ) ;
238
+ cargo. env ( "CFG_RELEASE_CHANNEL" , & builder . config . channel ) ;
239
+ cargo. env ( "CFG_VERSION" , builder . rust_version ( ) ) ;
243
240
244
- let info = GitInfo :: new ( & build . config , & dir) ;
241
+ let info = GitInfo :: new ( & builder . config , & dir) ;
245
242
if let Some ( sha) = info. sha ( ) {
246
243
cargo. env ( "CFG_COMMIT_HASH" , sha) ;
247
244
}
@@ -269,8 +266,8 @@ macro_rules! tool {
269
266
match tool {
270
267
$( Tool :: $name =>
271
268
self . ensure( $name {
272
- compiler: self . compiler( stage, self . build . build) ,
273
- target: self . build . build,
269
+ compiler: self . compiler( stage, self . config . build) ,
270
+ target: self . config . build,
274
271
} ) ,
275
272
) +
276
273
}
@@ -304,7 +301,7 @@ macro_rules! tool {
304
301
305
302
fn make_run( run: RunConfig ) {
306
303
run. builder. ensure( $name {
307
- compiler: run. builder. compiler( run. builder. top_stage, run. builder. build . build) ,
304
+ compiler: run. builder. compiler( run. builder. top_stage, run. builder. config . build) ,
308
305
target: run. target,
309
306
} ) ;
310
307
}
@@ -354,7 +351,7 @@ impl Step for RemoteTestServer {
354
351
355
352
fn make_run ( run : RunConfig ) {
356
353
run. builder . ensure ( RemoteTestServer {
357
- compiler : run. builder . compiler ( run. builder . top_stage , run. builder . build . build ) ,
354
+ compiler : run. builder . compiler ( run. builder . top_stage , run. builder . config . build ) ,
358
355
target : run. target ,
359
356
} ) ;
360
357
}
@@ -393,26 +390,25 @@ impl Step for Rustdoc {
393
390
}
394
391
395
392
fn run ( self , builder : & Builder ) -> PathBuf {
396
- let build = builder. build ;
397
393
let target_compiler = builder. compiler ( builder. top_stage , self . host ) ;
398
394
let target = target_compiler. host ;
399
395
let build_compiler = if target_compiler. stage == 0 {
400
- builder. compiler ( 0 , builder. build . build )
396
+ builder. compiler ( 0 , builder. config . build )
401
397
} else if target_compiler. stage >= 2 {
402
398
// Past stage 2, we consider the compiler to be ABI-compatible and hence capable of
403
399
// building rustdoc itself.
404
- builder. compiler ( target_compiler. stage , builder. build . build )
400
+ builder. compiler ( target_compiler. stage , builder. config . build )
405
401
} else {
406
402
// Similar to `compile::Assemble`, build with the previous stage's compiler. Otherwise
407
403
// we'd have stageN/bin/rustc and stageN/bin/rustdoc be effectively different stage
408
404
// compilers, which isn't what we want.
409
- builder. compiler ( target_compiler. stage - 1 , builder. build . build )
405
+ builder. compiler ( target_compiler. stage - 1 , builder. config . build )
410
406
} ;
411
407
412
408
builder. ensure ( compile:: Rustc { compiler : build_compiler, target } ) ;
413
409
builder. ensure ( compile:: Rustc {
414
410
compiler : build_compiler,
415
- target : builder. build . build ,
411
+ target : builder. config . build ,
416
412
} ) ;
417
413
418
414
let mut cargo = prepare_tool_cargo ( builder,
@@ -425,15 +421,15 @@ impl Step for Rustdoc {
425
421
cargo. env ( "RUSTC_DEBUGINFO" , builder. config . rust_debuginfo . to_string ( ) )
426
422
. env ( "RUSTC_DEBUGINFO_LINES" , builder. config . rust_debuginfo_lines . to_string ( ) ) ;
427
423
428
- let _folder = build . fold_output ( || format ! ( "stage{}-rustdoc" , target_compiler. stage) ) ;
429
- build . info ( & format ! ( "Building rustdoc for stage{} ({})" ,
424
+ let _folder = builder . fold_output ( || format ! ( "stage{}-rustdoc" , target_compiler. stage) ) ;
425
+ builder . info ( & format ! ( "Building rustdoc for stage{} ({})" ,
430
426
target_compiler. stage, target_compiler. host) ) ;
431
- build . run ( & mut cargo) ;
427
+ builder . run ( & mut cargo) ;
432
428
433
429
// Cargo adds a number of paths to the dylib search path on windows, which results in
434
430
// the wrong rustdoc being executed. To avoid the conflicting rustdocs, we name the "tool"
435
431
// rustdoc a different name.
436
- let tool_rustdoc = build . cargo_out ( build_compiler, Mode :: Tool , target)
432
+ let tool_rustdoc = builder . cargo_out ( build_compiler, Mode :: Tool , target)
437
433
. join ( exe ( "rustdoc-tool-binary" , & target_compiler. host ) ) ;
438
434
439
435
// don't create a stage0-sysroot/bin directory.
@@ -443,7 +439,7 @@ impl Step for Rustdoc {
443
439
t ! ( fs:: create_dir_all( & bindir) ) ;
444
440
let bin_rustdoc = bindir. join ( exe ( "rustdoc" , & * target_compiler. host ) ) ;
445
441
let _ = fs:: remove_file ( & bin_rustdoc) ;
446
- build . copy ( & tool_rustdoc, & bin_rustdoc) ;
442
+ builder . copy ( & tool_rustdoc, & bin_rustdoc) ;
447
443
bin_rustdoc
448
444
} else {
449
445
tool_rustdoc
@@ -464,12 +460,12 @@ impl Step for Cargo {
464
460
465
461
fn should_run ( run : ShouldRun ) -> ShouldRun {
466
462
let builder = run. builder ;
467
- run. path ( "src/tools/cargo" ) . default_condition ( builder. build . config . extended )
463
+ run. path ( "src/tools/cargo" ) . default_condition ( builder. config . extended )
468
464
}
469
465
470
466
fn make_run ( run : RunConfig ) {
471
467
run. builder . ensure ( Cargo {
472
- compiler : run. builder . compiler ( run. builder . top_stage , run. builder . build . build ) ,
468
+ compiler : run. builder . compiler ( run. builder . top_stage , run. builder . config . build ) ,
473
469
target : run. target ,
474
470
} ) ;
475
471
}
@@ -482,7 +478,7 @@ impl Step for Cargo {
482
478
// compiler to be available, so we need to depend on that.
483
479
builder. ensure ( compile:: Rustc {
484
480
compiler : self . compiler ,
485
- target : builder. build . build ,
481
+ target : builder. config . build ,
486
482
} ) ;
487
483
builder. ensure ( ToolBuild {
488
484
compiler : self . compiler ,
@@ -518,12 +514,12 @@ macro_rules! tool_extended {
518
514
519
515
fn should_run( run: ShouldRun ) -> ShouldRun {
520
516
let builder = run. builder;
521
- run. path( $path) . default_condition( builder. build . config. extended)
517
+ run. path( $path) . default_condition( builder. config. extended)
522
518
}
523
519
524
520
fn make_run( run: RunConfig ) {
525
521
run. builder. ensure( $name {
526
- compiler: run. builder. compiler( run. builder. top_stage, run. builder. build . build) ,
522
+ compiler: run. builder. compiler( run. builder. top_stage, run. builder. config . build) ,
527
523
target: run. target,
528
524
extra_features: Vec :: new( ) ,
529
525
} ) ;
@@ -554,7 +550,7 @@ tool_extended!((self, builder),
554
550
// compiler to be available, so we need to depend on that.
555
551
builder. ensure( compile:: Rustc {
556
552
compiler: self . compiler,
557
- target: builder. build . build,
553
+ target: builder. config . build,
558
554
} ) ;
559
555
} ;
560
556
Miri , miri, "src/tools/miri" , "miri" , { } ;
@@ -575,7 +571,7 @@ tool_extended!((self, builder),
575
571
// compiler to be available, so we need to depend on that.
576
572
builder. ensure( compile:: Rustc {
577
573
compiler: self . compiler,
578
- target: builder. build . build,
574
+ target: builder. config . build,
579
575
} ) ;
580
576
} ;
581
577
Rustfmt , rustfmt, "src/tools/rustfmt" , "rustfmt" , { } ;
@@ -586,7 +582,7 @@ impl<'a> Builder<'a> {
586
582
/// `host`.
587
583
pub fn tool_cmd ( & self , tool : Tool ) -> Command {
588
584
let mut cmd = Command :: new ( self . tool_exe ( tool) ) ;
589
- let compiler = self . compiler ( self . tool_default_stage ( tool) , self . build . build ) ;
585
+ let compiler = self . compiler ( self . tool_default_stage ( tool) , self . config . build ) ;
590
586
self . prepare_tool_cmd ( compiler, & mut cmd) ;
591
587
cmd
592
588
}
0 commit comments