Discriminate between external and optional tools

This commit is contained in:
Tatsuyuki Ishi 2018-07-23 13:08:05 +09:00
parent e098985939
commit 1075ced5bc
2 changed files with 22 additions and 14 deletions

View File

@ -296,7 +296,8 @@ fn main() {
cmd.arg("--color=always"); cmd.arg("--color=always");
} }
if env::var_os("RUSTC_DENY_WARNINGS").is_some() && env::var_os("RUSTC_EXT_TOOL").is_none() { if env::var_os("RUSTC_DENY_WARNINGS").is_some() && env::var_os("RUSTC_EXTERNAL_TOOL").is_none()
{
cmd.arg("-Dwarnings"); cmd.arg("-Dwarnings");
cmd.arg("-Dbare_trait_objects"); cmd.arg("-Dbare_trait_objects");
} }

View File

@ -82,7 +82,8 @@ struct ToolBuild {
tool: &'static str, tool: &'static str,
path: &'static str, path: &'static str,
mode: Mode, mode: Mode,
is_ext_tool: bool, is_optional_tool: bool,
is_external_tool: bool,
extra_features: Vec<String>, extra_features: Vec<String>,
} }
@ -102,7 +103,7 @@ impl Step for ToolBuild {
let target = self.target; let target = self.target;
let tool = self.tool; let tool = self.tool;
let path = self.path; let path = self.path;
let is_ext_tool = self.is_ext_tool; let is_optional_tool = self.is_optional_tool;
match self.mode { match self.mode {
Mode::ToolRustc => { Mode::ToolRustc => {
@ -122,7 +123,7 @@ impl Step for ToolBuild {
target, target,
"build", "build",
path, path,
is_ext_tool, self.is_external_tool,
); );
cargo.arg("--features").arg(self.extra_features.join(" ")); cargo.arg("--features").arg(self.extra_features.join(" "));
@ -224,7 +225,7 @@ impl Step for ToolBuild {
}); });
if !is_expected { if !is_expected {
if !is_ext_tool { if !is_optional_tool {
exit(1); exit(1);
} else { } else {
return None; return None;
@ -246,7 +247,7 @@ pub fn prepare_tool_cargo(
target: Interned<String>, target: Interned<String>,
command: &'static str, command: &'static str,
path: &'static str, path: &'static str,
is_ext_tool: bool, is_external_tool: bool,
) -> Command { ) -> Command {
let mut cargo = builder.cargo(compiler, mode, target, command); let mut cargo = builder.cargo(compiler, mode, target, command);
let dir = builder.src.join(path); let dir = builder.src.join(path);
@ -256,8 +257,8 @@ pub fn prepare_tool_cargo(
// stages and such and it's just easier if they're not dynamically linked. // stages and such and it's just easier if they're not dynamically linked.
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1"); cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
if is_ext_tool { if is_external_tool {
cargo.env("RUSTC_EXT_TOOL", "1"); cargo.env("RUSTC_EXTERNAL_TOOL", "1");
} }
if let Some(dir) = builder.openssl_install_dir(target) { if let Some(dir) = builder.openssl_install_dir(target) {
@ -287,7 +288,8 @@ pub fn prepare_tool_cargo(
} }
macro_rules! tool { macro_rules! tool {
($($name:ident, $path:expr, $tool_name:expr, $mode:expr $(,llvm_tools = $llvm:expr)*;)+) => { ($($name:ident, $path:expr, $tool_name:expr, $mode:expr
$(,llvm_tools = $llvm:expr)* $(,external_tool = $external:expr)*;)+) => {
#[derive(Copy, PartialEq, Eq, Clone)] #[derive(Copy, PartialEq, Eq, Clone)]
pub enum Tool { pub enum Tool {
$( $(
@ -364,7 +366,8 @@ macro_rules! tool {
tool: $tool_name, tool: $tool_name,
mode: $mode, mode: $mode,
path: $path, path: $path,
is_ext_tool: false, is_optional_tool: false,
is_external_tool: false $(|| $external)*,
extra_features: Vec::new(), extra_features: Vec::new(),
}).expect("expected to build -- essential tool") }).expect("expected to build -- essential tool")
} }
@ -383,7 +386,8 @@ tool!(
Compiletest, "src/tools/compiletest", "compiletest", Mode::ToolBootstrap, llvm_tools = true; Compiletest, "src/tools/compiletest", "compiletest", Mode::ToolBootstrap, llvm_tools = true;
BuildManifest, "src/tools/build-manifest", "build-manifest", Mode::ToolBootstrap; BuildManifest, "src/tools/build-manifest", "build-manifest", Mode::ToolBootstrap;
RemoteTestClient, "src/tools/remote-test-client", "remote-test-client", Mode::ToolBootstrap; RemoteTestClient, "src/tools/remote-test-client", "remote-test-client", Mode::ToolBootstrap;
RustInstaller, "src/tools/rust-installer", "fabricate", Mode::ToolBootstrap; RustInstaller, "src/tools/rust-installer", "fabricate", Mode::ToolBootstrap,
external_tool = true;
RustdocTheme, "src/tools/rustdoc-themes", "rustdoc-themes", Mode::ToolBootstrap; RustdocTheme, "src/tools/rustdoc-themes", "rustdoc-themes", Mode::ToolBootstrap;
); );
@ -414,7 +418,8 @@ impl Step for RemoteTestServer {
tool: "remote-test-server", tool: "remote-test-server",
mode: Mode::ToolStd, mode: Mode::ToolStd,
path: "src/tools/remote-test-server", path: "src/tools/remote-test-server",
is_ext_tool: false, is_optional_tool: false,
is_external_tool: false,
extra_features: Vec::new(), extra_features: Vec::new(),
}).expect("expected to build -- essential tool") }).expect("expected to build -- essential tool")
} }
@ -541,7 +546,8 @@ impl Step for Cargo {
tool: "cargo", tool: "cargo",
mode: Mode::ToolRustc, mode: Mode::ToolRustc,
path: "src/tools/cargo", path: "src/tools/cargo",
is_ext_tool: false, is_optional_tool: false,
is_external_tool: true,
extra_features: Vec::new(), extra_features: Vec::new(),
}).expect("expected to build -- essential tool") }).expect("expected to build -- essential tool")
} }
@ -590,7 +596,8 @@ macro_rules! tool_extended {
mode: Mode::ToolRustc, mode: Mode::ToolRustc,
path: $path, path: $path,
extra_features: $sel.extra_features, extra_features: $sel.extra_features,
is_ext_tool: true, is_optional_tool: true,
is_external_tool: true,
}) })
} }
} }