Skip to content

Commit

Permalink
impl is_tool on Mode enum
Browse files Browse the repository at this point in the history
make is_tool inherent prop of mode

fix errors from rebase

resolve issues from review
  • Loading branch information
Collins Abitekaniza committed Jun 3, 2018
1 parent 1133397 commit 36eafe5
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/bootstrap/builder.rs
Expand Up @@ -806,7 +806,7 @@ impl<'a> Builder<'a> {
);
}

if [Mode::ToolRustc, Mode::ToolStd, Mode::ToolTest].iter().any(|m| &mode == m) {
if mode.is_tool() {
// Tools like cargo and rls don't get debuginfo by default right now, but this can be
// enabled in the config. Adding debuginfo makes them several times larger.
if self.config.rust_debuginfo_tools {
Expand Down Expand Up @@ -1012,7 +1012,7 @@ impl<'a> Builder<'a> {
// be resolved because MinGW has the import library. The downside is we
// don't get newer functions from Windows, but we don't use any of them
// anyway.
if ![Mode::ToolRustc, Mode::ToolStd, Mode::ToolTest].iter().any(|m| &mode == m) {
if !mode.is_tool() {
cargo.env("WINAPI_NO_BUNDLED_LIBRARIES", "1");
}

Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/check.rs
Expand Up @@ -219,7 +219,7 @@ impl Step for Rustdoc {

let mut cargo = prepare_tool_cargo(builder,
compiler,
Mode::Rustc,
Mode::ToolRustc,
target,
"check",
"src/tools/rustdoc");
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/dist.rs
Expand Up @@ -953,7 +953,7 @@ impl Step for PlainSourceTarball {
if !has_cargo_vendor {
let mut cmd = builder.cargo(
builder.compiler(0, builder.config.build),
Mode::Tool,
Mode::ToolRustc,
builder.config.build,
"install"
);
Expand Down
6 changes: 4 additions & 2 deletions src/bootstrap/doc.rs
Expand Up @@ -799,13 +799,15 @@ impl Step for Rustdoc {
builder.ensure(tool::Rustdoc { host: compiler.host });

// Symlink compiler docs to the output directory of rustdoc documentation.
let out_dir = builder.stage_out(compiler, Mode::Tool).join(target).join("doc");
let out_dir = builder.stage_out(compiler, Mode::ToolRustc).join(target).join("doc");
t!(fs::create_dir_all(&out_dir));
builder.clear_if_dirty(&out, &rustdoc);
t!(symlink_dir_force(&builder.config, &out, &out_dir));

// Build cargo command.
let mut cargo = prepare_tool_cargo(builder, compiler, target, "doc", "src/tools/rustdoc");
let mut cargo = prepare_tool_cargo(
builder, compiler, Mode::ToolRustc, target, "doc", "src/tools/rustdoc");

cargo.env("RUSTDOCFLAGS", "--document-private-items");
builder.run(&mut cargo);
}
Expand Down
9 changes: 9 additions & 0 deletions src/bootstrap/lib.rs
Expand Up @@ -324,6 +324,15 @@ pub enum Mode {
ToolRustc,
}

impl Mode {
pub fn is_tool(&self) -> bool {
match self {
Mode::ToolStd | Mode::ToolTest | Mode::ToolRustc => true,
_ => false
}
}
}

impl Build {
/// Creates a new set of build configuration from the `flags` on the command
/// line and the filesystem `config`.
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/test.rs
Expand Up @@ -1729,7 +1729,7 @@ impl Step for CrateRustdoc {

let mut cargo = tool::prepare_tool_cargo(builder,
compiler,
Mode::Rustc,
Mode::ToolRustc,
target,
test_kind.subcommand(),
"src/tools/rustdoc");
Expand Down

0 comments on commit 36eafe5

Please sign in to comment.