about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-09-02 17:17:14 +0000
committerbors <bors@rust-lang.org>2017-09-02 17:17:14 +0000
commit204c0a47e7b7e371cf1cdc159404d405b86386ba (patch)
tree23704d30ca5656cae4f2637cecd8034f6096932a /src
parent8d83c1516c9e8d92ae61d7329de86ec9e1f561c9 (diff)
parent20f1e6809e302e0a6353ccf744916b47a1f2535c (diff)
downloadrust-204c0a47e7b7e371cf1cdc159404d405b86386ba.tar.gz
rust-204c0a47e7b7e371cf1cdc159404d405b86386ba.zip
Auto merge of #43886 - oli-obk:clippy, r=nrc
Add clippy as a submodule

~~This builds clippy as part of `./x.py build` (locally and in CI).~~

This allows building clippy with `./x.py build src/tools/clippy`

~~Needs https://github.com/nrc/dev-tools-team/issues/18#issuecomment-322456461 to be resolved before it can be merged.~~ Contributers can simply open a PR to clippy and point the submodule at the `pull/$pr_number/head` branch.

This does **not** build clippy or test the clippy test suite at all as per https://github.com/nrc/dev-tools-team/issues/18#issuecomment-321411418

r? @nrc

cc @Manishearth @llogiq @mcarton @alexcrichton
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/builder.rs2
-rw-r--r--src/bootstrap/tool.rs38
m---------src/tools/clippy6
-rw-r--r--src/tools/tidy/src/lib.rs1
4 files changed, 46 insertions, 1 deletions
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index 298f6a004a2..722b3d16e9d 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -248,7 +248,7 @@ impl<'a> Builder<'a> {
                 compile::StartupObjects, tool::BuildManifest, tool::Rustbook, tool::ErrorIndex,
                 tool::UnstableBookGen, tool::Tidy, tool::Linkchecker, tool::CargoTest,
                 tool::Compiletest, tool::RemoteTestServer, tool::RemoteTestClient,
-                tool::RustInstaller, tool::Cargo, tool::Rls, tool::Rustdoc,
+                tool::RustInstaller, tool::Cargo, tool::Rls, tool::Rustdoc, tool::Clippy,
                 native::Llvm),
             Kind::Test => describe!(check::Tidy, check::Bootstrap, check::DefaultCompiletest,
                 check::HostCompiletest, check::Crate, check::CrateLibrustc, check::Linkcheck,
diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs
index e759f1a3e6f..0ad5bb8d2f6 100644
--- a/src/bootstrap/tool.rs
+++ b/src/bootstrap/tool.rs
@@ -341,6 +341,44 @@ impl Step for Cargo {
 }
 
 #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
+pub struct Clippy {
+    pub compiler: Compiler,
+    pub target: Interned<String>,
+}
+
+impl Step for Clippy {
+    type Output = PathBuf;
+    const DEFAULT: bool = false;
+    const ONLY_HOSTS: bool = true;
+
+    fn should_run(run: ShouldRun) -> ShouldRun {
+        run.path("src/tools/clippy")
+    }
+
+    fn make_run(run: RunConfig) {
+        run.builder.ensure(Clippy {
+            compiler: run.builder.compiler(run.builder.top_stage, run.builder.build.build),
+            target: run.target,
+        });
+    }
+
+    fn run(self, builder: &Builder) -> PathBuf {
+        // Clippy depends on procedural macros (serde), which requires a full host
+        // compiler to be available, so we need to depend on that.
+        builder.ensure(compile::Rustc {
+            compiler: self.compiler,
+            target: builder.build.build,
+        });
+        builder.ensure(ToolBuild {
+            compiler: self.compiler,
+            target: self.target,
+            tool: "clippy",
+            mode: Mode::Librustc,
+        })
+    }
+}
+
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
 pub struct Rls {
     pub compiler: Compiler,
     pub target: Interned<String>,
diff --git a/src/tools/clippy b/src/tools/clippy
new file mode 160000
+Subproject 4402bc70a3b175c38994bbc802bee41ddc59165
diff --git a/src/tools/tidy/src/lib.rs b/src/tools/tidy/src/lib.rs
index 020570e61dc..731a3d96cff 100644
--- a/src/tools/tidy/src/lib.rs
+++ b/src/tools/tidy/src/lib.rs
@@ -62,6 +62,7 @@ fn filter_dirs(path: &Path) -> bool {
         "src/rt/hoedown",
         "src/tools/cargo",
         "src/tools/rls",
+        "src/tools/clippy",
         "src/tools/rust-installer",
     ];
     skip.iter().any(|p| path.ends_with(p))