about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2021-03-01 15:07:33 +0900
committerGitHub <noreply@github.com>2021-03-01 15:07:33 +0900
commit6c76dacccc869468ae715b3d0a15d7a1fdd358a4 (patch)
tree9d4aa3e5f6c44f478ef1ad11966a62ff7d7beb2e
parent9720cd1d56c215df87dff7f5d0026c947b5c6c9b (diff)
parentfe2b93bcc5daf730a92df6b3bd6677484f8d3a06 (diff)
downloadrust-6c76dacccc869468ae715b3d0a15d7a1fdd358a4.tar.gz
rust-6c76dacccc869468ae715b3d0a15d7a1fdd358a4.zip
Rollup merge of #82507 - jyn514:tidy-windows, r=Mark-Simulacrum
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.

This doesn't change the x.py interface in any way, it still accepts `x.py test tidy` and prints error messages about `tidy`. It only changes the name of the file on disk.

Fixes https://github.com/rust-lang/rust/issues/82501.
-rw-r--r--src/bootstrap/tool.rs8
-rw-r--r--src/tools/tidy/Cargo.toml5
2 files changed, 12 insertions, 1 deletions
diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs
index 5c874f69bd9..71aa6bb150e 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<PathBuf> {
         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 ccdb4524d5c..777d7be8fdc 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 <alex@alexcrichton.com>"]
 edition = "2018"
+autobins = false
 
 [dependencies]
 cargo_metadata = "0.11"
 regex = "1"
 lazy_static = "1"
 walkdir = "2"
+
+[[bin]]
+name = "rust-tidy"
+path = "src/main.rs"