Skip to content

Commit 1075ced

Browse files
committed
Discriminate between external and optional tools
1 parent e098985 commit 1075ced

File tree

2 files changed

+22
-14
lines changed

2 files changed

+22
-14
lines changed

src/bootstrap/bin/rustc.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,8 @@ fn main() {
296296
cmd.arg("--color=always");
297297
}
298298

299-
if env::var_os("RUSTC_DENY_WARNINGS").is_some() && env::var_os("RUSTC_EXT_TOOL").is_none() {
299+
if env::var_os("RUSTC_DENY_WARNINGS").is_some() && env::var_os("RUSTC_EXTERNAL_TOOL").is_none()
300+
{
300301
cmd.arg("-Dwarnings");
301302
cmd.arg("-Dbare_trait_objects");
302303
}

src/bootstrap/tool.rs

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ struct ToolBuild {
8282
tool: &'static str,
8383
path: &'static str,
8484
mode: Mode,
85-
is_ext_tool: bool,
85+
is_optional_tool: bool,
86+
is_external_tool: bool,
8687
extra_features: Vec<String>,
8788
}
8889

@@ -102,7 +103,7 @@ impl Step for ToolBuild {
102103
let target = self.target;
103104
let tool = self.tool;
104105
let path = self.path;
105-
let is_ext_tool = self.is_ext_tool;
106+
let is_optional_tool = self.is_optional_tool;
106107

107108
match self.mode {
108109
Mode::ToolRustc => {
@@ -122,7 +123,7 @@ impl Step for ToolBuild {
122123
target,
123124
"build",
124125
path,
125-
is_ext_tool,
126+
self.is_external_tool,
126127
);
127128
cargo.arg("--features").arg(self.extra_features.join(" "));
128129

@@ -224,7 +225,7 @@ impl Step for ToolBuild {
224225
});
225226

226227
if !is_expected {
227-
if !is_ext_tool {
228+
if !is_optional_tool {
228229
exit(1);
229230
} else {
230231
return None;
@@ -246,7 +247,7 @@ pub fn prepare_tool_cargo(
246247
target: Interned<String>,
247248
command: &'static str,
248249
path: &'static str,
249-
is_ext_tool: bool,
250+
is_external_tool: bool,
250251
) -> Command {
251252
let mut cargo = builder.cargo(compiler, mode, target, command);
252253
let dir = builder.src.join(path);
@@ -256,8 +257,8 @@ pub fn prepare_tool_cargo(
256257
// stages and such and it's just easier if they're not dynamically linked.
257258
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
258259

259-
if is_ext_tool {
260-
cargo.env("RUSTC_EXT_TOOL", "1");
260+
if is_external_tool {
261+
cargo.env("RUSTC_EXTERNAL_TOOL", "1");
261262
}
262263

263264
if let Some(dir) = builder.openssl_install_dir(target) {
@@ -287,7 +288,8 @@ pub fn prepare_tool_cargo(
287288
}
288289

289290
macro_rules! tool {
290-
($($name:ident, $path:expr, $tool_name:expr, $mode:expr $(,llvm_tools = $llvm:expr)*;)+) => {
291+
($($name:ident, $path:expr, $tool_name:expr, $mode:expr
292+
$(,llvm_tools = $llvm:expr)* $(,external_tool = $external:expr)*;)+) => {
291293
#[derive(Copy, PartialEq, Eq, Clone)]
292294
pub enum Tool {
293295
$(
@@ -364,7 +366,8 @@ macro_rules! tool {
364366
tool: $tool_name,
365367
mode: $mode,
366368
path: $path,
367-
is_ext_tool: false,
369+
is_optional_tool: false,
370+
is_external_tool: false $(|| $external)*,
368371
extra_features: Vec::new(),
369372
}).expect("expected to build -- essential tool")
370373
}
@@ -383,7 +386,8 @@ tool!(
383386
Compiletest, "src/tools/compiletest", "compiletest", Mode::ToolBootstrap, llvm_tools = true;
384387
BuildManifest, "src/tools/build-manifest", "build-manifest", Mode::ToolBootstrap;
385388
RemoteTestClient, "src/tools/remote-test-client", "remote-test-client", Mode::ToolBootstrap;
386-
RustInstaller, "src/tools/rust-installer", "fabricate", Mode::ToolBootstrap;
389+
RustInstaller, "src/tools/rust-installer", "fabricate", Mode::ToolBootstrap,
390+
external_tool = true;
387391
RustdocTheme, "src/tools/rustdoc-themes", "rustdoc-themes", Mode::ToolBootstrap;
388392
);
389393

@@ -414,7 +418,8 @@ impl Step for RemoteTestServer {
414418
tool: "remote-test-server",
415419
mode: Mode::ToolStd,
416420
path: "src/tools/remote-test-server",
417-
is_ext_tool: false,
421+
is_optional_tool: false,
422+
is_external_tool: false,
418423
extra_features: Vec::new(),
419424
}).expect("expected to build -- essential tool")
420425
}
@@ -541,7 +546,8 @@ impl Step for Cargo {
541546
tool: "cargo",
542547
mode: Mode::ToolRustc,
543548
path: "src/tools/cargo",
544-
is_ext_tool: false,
549+
is_optional_tool: false,
550+
is_external_tool: true,
545551
extra_features: Vec::new(),
546552
}).expect("expected to build -- essential tool")
547553
}
@@ -590,7 +596,8 @@ macro_rules! tool_extended {
590596
mode: Mode::ToolRustc,
591597
path: $path,
592598
extra_features: $sel.extra_features,
593-
is_ext_tool: true,
599+
is_optional_tool: true,
600+
is_external_tool: true,
594601
})
595602
}
596603
}

0 commit comments

Comments
 (0)