@@ -75,6 +75,12 @@ impl Step for CleanTools {
75
75
}
76
76
}
77
77
78
+ #[ derive( Debug , Clone , Hash , PartialEq , Eq ) ]
79
+ pub enum SourceType {
80
+ InTree ,
81
+ Submodule ,
82
+ }
83
+
78
84
#[ derive( Debug , Clone , Hash , PartialEq , Eq ) ]
79
85
struct ToolBuild {
80
86
compiler : Compiler ,
@@ -83,7 +89,7 @@ struct ToolBuild {
83
89
path : & ' static str ,
84
90
mode : Mode ,
85
91
is_optional_tool : bool ,
86
- is_external_tool : bool ,
92
+ source_type : SourceType ,
87
93
extra_features : Vec < String > ,
88
94
}
89
95
@@ -123,7 +129,7 @@ impl Step for ToolBuild {
123
129
target,
124
130
"build" ,
125
131
path,
126
- self . is_external_tool ,
132
+ self . source_type ,
127
133
) ;
128
134
cargo. arg ( "--features" ) . arg ( self . extra_features . join ( " " ) ) ;
129
135
@@ -247,7 +253,7 @@ pub fn prepare_tool_cargo(
247
253
target : Interned < String > ,
248
254
command : & ' static str ,
249
255
path : & ' static str ,
250
- is_external_tool : bool ,
256
+ source_type : SourceType ,
251
257
) -> Command {
252
258
let mut cargo = builder. cargo ( compiler, mode, target, command) ;
253
259
let dir = builder. src . join ( path) ;
@@ -257,7 +263,7 @@ pub fn prepare_tool_cargo(
257
263
// stages and such and it's just easier if they're not dynamically linked.
258
264
cargo. env ( "RUSTC_NO_PREFER_DYNAMIC" , "1" ) ;
259
265
260
- if is_external_tool {
266
+ if source_type == SourceType :: Submodule {
261
267
cargo. env ( "RUSTC_EXTERNAL_TOOL" , "1" ) ;
262
268
}
263
269
@@ -289,7 +295,7 @@ pub fn prepare_tool_cargo(
289
295
290
296
macro_rules! tool {
291
297
( $( $name: ident, $path: expr, $tool_name: expr, $mode: expr
292
- $( , llvm_tools = $llvm: expr) * $( , external_tool = $external: expr) * ; ) +) => {
298
+ $( , llvm_tools = $llvm: expr) * $( , is_external_tool = $external: expr) * ; ) +) => {
293
299
#[ derive( Copy , PartialEq , Eq , Clone ) ]
294
300
pub enum Tool {
295
301
$(
@@ -367,7 +373,11 @@ macro_rules! tool {
367
373
mode: $mode,
368
374
path: $path,
369
375
is_optional_tool: false ,
370
- is_external_tool: false $( || $external) * ,
376
+ source_type: if false $( || $external) * {
377
+ SourceType :: Submodule
378
+ } else {
379
+ SourceType :: InTree
380
+ } ,
371
381
extra_features: Vec :: new( ) ,
372
382
} ) . expect( "expected to build -- essential tool" )
373
383
}
@@ -387,7 +397,7 @@ tool!(
387
397
BuildManifest , "src/tools/build-manifest" , "build-manifest" , Mode :: ToolBootstrap ;
388
398
RemoteTestClient , "src/tools/remote-test-client" , "remote-test-client" , Mode :: ToolBootstrap ;
389
399
RustInstaller , "src/tools/rust-installer" , "fabricate" , Mode :: ToolBootstrap ,
390
- external_tool = true ;
400
+ is_external_tool = true ;
391
401
RustdocTheme , "src/tools/rustdoc-themes" , "rustdoc-themes" , Mode :: ToolBootstrap ;
392
402
) ;
393
403
@@ -419,7 +429,7 @@ impl Step for RemoteTestServer {
419
429
mode : Mode :: ToolStd ,
420
430
path : "src/tools/remote-test-server" ,
421
431
is_optional_tool : false ,
422
- is_external_tool : false ,
432
+ source_type : SourceType :: InTree ,
423
433
extra_features : Vec :: new ( ) ,
424
434
} ) . expect ( "expected to build -- essential tool" )
425
435
}
@@ -474,7 +484,7 @@ impl Step for Rustdoc {
474
484
target,
475
485
"build" ,
476
486
"src/tools/rustdoc" ,
477
- false ,
487
+ SourceType :: InTree ,
478
488
) ;
479
489
480
490
// Most tools don't get debuginfo, but rustdoc should.
@@ -547,7 +557,7 @@ impl Step for Cargo {
547
557
mode : Mode :: ToolRustc ,
548
558
path : "src/tools/cargo" ,
549
559
is_optional_tool : false ,
550
- is_external_tool : true ,
560
+ source_type : SourceType :: Submodule ,
551
561
extra_features : Vec :: new ( ) ,
552
562
} ) . expect ( "expected to build -- essential tool" )
553
563
}
@@ -597,7 +607,7 @@ macro_rules! tool_extended {
597
607
path: $path,
598
608
extra_features: $sel. extra_features,
599
609
is_optional_tool: true ,
600
- is_external_tool : true ,
610
+ source_type : SourceType :: Submodule ,
601
611
} )
602
612
}
603
613
}
0 commit comments