From fe2b93bcc5daf730a92df6b3bd6677484f8d3a06 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Wed, 24 Feb 2021 21:32:48 -0500 Subject: [PATCH] Rename the `tidy` binary to `rust-tidy` This avoids naming collisions, particularly on Windows where the dynamic library variable is PATH and setting it causes the in-tree `tidy` to take precedence over the HTML tidy used by compiletest. --- src/bootstrap/tool.rs | 8 +++++++- src/tools/tidy/Cargo.toml | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs index 5c874f69bd92d..71aa6bb150e2e 100644 --- a/src/bootstrap/tool.rs +++ b/src/bootstrap/tool.rs @@ -47,7 +47,7 @@ impl Step for ToolBuild { fn run(self, builder: &Builder<'_>) -> Option { let compiler = self.compiler; let target = self.target; - let tool = self.tool; + let mut tool = self.tool; let path = self.path; let is_optional_tool = self.is_optional_tool; @@ -208,6 +208,12 @@ impl Step for ToolBuild { None } } else { + // HACK(#82501): on Windows, the tools directory gets added to PATH when running tests, and + // compiletest confuses HTML tidy with the in-tree tidy. Name the in-tree tidy something + // different so the problem doesn't come up. + if tool == "tidy" { + tool = "rust-tidy"; + } let cargo_out = builder.cargo_out(compiler, self.mode, target).join(exe(tool, compiler.host)); let bin = builder.tools_dir(compiler).join(exe(tool, compiler.host)); diff --git a/src/tools/tidy/Cargo.toml b/src/tools/tidy/Cargo.toml index ccdb4524d5c5a..777d7be8fdc43 100644 --- a/src/tools/tidy/Cargo.toml +++ b/src/tools/tidy/Cargo.toml @@ -3,9 +3,14 @@ name = "tidy" version = "0.1.0" authors = ["Alex Crichton "] edition = "2018" +autobins = false [dependencies] cargo_metadata = "0.11" regex = "1" lazy_static = "1" walkdir = "2" + +[[bin]] +name = "rust-tidy" +path = "src/main.rs"