@@ -75,6 +75,12 @@ impl Step for CleanTools {
7575 }
7676}
7777
78+ #[ derive( Debug , Clone , Hash , PartialEq , Eq ) ]
79+ pub enum SourceType {
80+ InTree ,
81+ Submodule ,
82+ }
83+
7884#[ derive( Debug , Clone , Hash , PartialEq , Eq ) ]
7985struct ToolBuild {
8086 compiler : Compiler ,
@@ -83,7 +89,7 @@ struct ToolBuild {
8389 path : & ' static str ,
8490 mode : Mode ,
8591 is_optional_tool : bool ,
86- is_external_tool : bool ,
92+ source_type : SourceType ,
8793 extra_features : Vec < String > ,
8894}
8995
@@ -123,7 +129,7 @@ impl Step for ToolBuild {
123129 target,
124130 "build" ,
125131 path,
126- self . is_external_tool ,
132+ self . source_type ,
127133 ) ;
128134 cargo. arg ( "--features" ) . arg ( self . extra_features . join ( " " ) ) ;
129135
@@ -247,7 +253,7 @@ pub fn prepare_tool_cargo(
247253 target : Interned < String > ,
248254 command : & ' static str ,
249255 path : & ' static str ,
250- is_external_tool : bool ,
256+ source_type : SourceType ,
251257) -> Command {
252258 let mut cargo = builder. cargo ( compiler, mode, target, command) ;
253259 let dir = builder. src . join ( path) ;
@@ -257,7 +263,7 @@ pub fn prepare_tool_cargo(
257263 // stages and such and it's just easier if they're not dynamically linked.
258264 cargo. env ( "RUSTC_NO_PREFER_DYNAMIC" , "1" ) ;
259265
260- if is_external_tool {
266+ if source_type == SourceType :: Submodule {
261267 cargo. env ( "RUSTC_EXTERNAL_TOOL" , "1" ) ;
262268 }
263269
@@ -289,7 +295,7 @@ pub fn prepare_tool_cargo(
289295
290296macro_rules! tool {
291297 ( $( $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) * ; ) +) => {
293299 #[ derive( Copy , PartialEq , Eq , Clone ) ]
294300 pub enum Tool {
295301 $(
@@ -367,7 +373,11 @@ macro_rules! tool {
367373 mode: $mode,
368374 path: $path,
369375 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+ } ,
371381 extra_features: Vec :: new( ) ,
372382 } ) . expect( "expected to build -- essential tool" )
373383 }
@@ -387,7 +397,7 @@ tool!(
387397 BuildManifest , "src/tools/build-manifest" , "build-manifest" , Mode :: ToolBootstrap ;
388398 RemoteTestClient , "src/tools/remote-test-client" , "remote-test-client" , Mode :: ToolBootstrap ;
389399 RustInstaller , "src/tools/rust-installer" , "fabricate" , Mode :: ToolBootstrap ,
390- external_tool = true ;
400+ is_external_tool = true ;
391401 RustdocTheme , "src/tools/rustdoc-themes" , "rustdoc-themes" , Mode :: ToolBootstrap ;
392402) ;
393403
@@ -419,7 +429,7 @@ impl Step for RemoteTestServer {
419429 mode : Mode :: ToolStd ,
420430 path : "src/tools/remote-test-server" ,
421431 is_optional_tool : false ,
422- is_external_tool : false ,
432+ source_type : SourceType :: InTree ,
423433 extra_features : Vec :: new ( ) ,
424434 } ) . expect ( "expected to build -- essential tool" )
425435 }
@@ -474,7 +484,7 @@ impl Step for Rustdoc {
474484 target,
475485 "build" ,
476486 "src/tools/rustdoc" ,
477- false ,
487+ SourceType :: InTree ,
478488 ) ;
479489
480490 // Most tools don't get debuginfo, but rustdoc should.
@@ -547,7 +557,7 @@ impl Step for Cargo {
547557 mode : Mode :: ToolRustc ,
548558 path : "src/tools/cargo" ,
549559 is_optional_tool : false ,
550- is_external_tool : true ,
560+ source_type : SourceType :: Submodule ,
551561 extra_features : Vec :: new ( ) ,
552562 } ) . expect ( "expected to build -- essential tool" )
553563 }
@@ -597,7 +607,7 @@ macro_rules! tool_extended {
597607 path: $path,
598608 extra_features: $sel. extra_features,
599609 is_optional_tool: true ,
600- is_external_tool : true ,
610+ source_type : SourceType :: Submodule ,
601611 } )
602612 }
603613 }
0 commit comments