]> git.lizzy.rs Git - rust.git/commitdiff
Add clippy as a submodule
authorOliver Schneider <git-spam-no-reply9815368754983@oli-obk.de>
Tue, 15 Aug 2017 12:27:20 +0000 (14:27 +0200)
committerOliver Schneider <git-spam-no-reply9815368754983@oli-obk.de>
Tue, 15 Aug 2017 15:31:28 +0000 (17:31 +0200)
.gitmodules
src/bootstrap/builder.rs
src/bootstrap/tool.rs
src/tools/clippy [new submodule]
src/tools/tidy/src/lib.rs

index 6244b3c0951868b30ea8a3bbc0605e647e7ddf6e..fbebccf408fb6634104d8a63a74c660cd0a42b96 100644 (file)
@@ -33,3 +33,6 @@
 [submodule "src/libcompiler_builtins"]
        path = src/libcompiler_builtins
        url = https://github.com/rust-lang-nursery/compiler-builtins
+[submodule "src/tools/clippy"]
+       path = src/tools/clippy
+       url = https://github.com/rust-lang-nursery/rust-clippy.git
index 91dddc7b5bc8ad6e9267736bda04167c602dd461..40b0ec483c90569e83817d660d2609a23353ad57 100644 (file)
@@ -248,7 +248,7 @@ macro_rules! describe {
                 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,
index d798e8de3dffae66fff02079891f75b21586fe9b..fe175117483ac5e13ca2ce7d433f417d542ded3d 100644 (file)
@@ -340,6 +340,44 @@ fn run(self, builder: &Builder) -> PathBuf {
     }
 }
 
+#[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 = true;
+    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,
diff --git a/src/tools/clippy b/src/tools/clippy
new file mode 160000 (submodule)
index 0000000..7cdaeae
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit 7cdaeae1b877ca03b26ccb9b82754b826b03da5d
index 020570e61dc63fe7495ac72a4461367ff0f8526f..731a3d96cff9d9521c848200e667744dcb2f2310 100644 (file)
@@ -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))