aboutsummaryrefslogtreecommitdiff
path: root/xtask
diff options
context:
space:
mode:
authorDmitry <[email protected]>2020-08-14 19:32:05 +0100
committerDmitry <[email protected]>2020-08-14 19:32:05 +0100
commit178c3e135a2a249692f7784712492e7884ae0c00 (patch)
treeac6b769dbf7162150caa0c1624786a4dd79ff3be /xtask
parent06ff8e6c760ff05f10e868b5d1f9d79e42fbb49c (diff)
parentc2594daf2974dbd4ce3d9b7ec72481764abaceb5 (diff)
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'xtask')
-rw-r--r--xtask/Cargo.toml1
-rw-r--r--xtask/src/codegen.rs10
-rw-r--r--xtask/src/codegen/gen_syntax.rs2
-rw-r--r--xtask/src/lib.rs4
-rw-r--r--xtask/tests/tidy.rs35
5 files changed, 34 insertions, 18 deletions
diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml
index 1a1140b04..e9edbdd10 100644
--- a/xtask/Cargo.toml
+++ b/xtask/Cargo.toml
@@ -18,3 +18,4 @@ quote = "1.0.2"
18ungrammar = "1.1.1" 18ungrammar = "1.1.1"
19walkdir = "2.3.1" 19walkdir = "2.3.1"
20write-json = "0.1.0" 20write-json = "0.1.0"
21# Avoid adding more dependencies to this crate
diff --git a/xtask/src/codegen.rs b/xtask/src/codegen.rs
index 1edb04c2f..950dd61b2 100644
--- a/xtask/src/codegen.rs
+++ b/xtask/src/codegen.rs
@@ -33,12 +33,12 @@ const GRAMMAR_DIR: &str = "crates/ra_parser/src/grammar";
33const OK_INLINE_TESTS_DIR: &str = "crates/ra_syntax/test_data/parser/inline/ok"; 33const OK_INLINE_TESTS_DIR: &str = "crates/ra_syntax/test_data/parser/inline/ok";
34const ERR_INLINE_TESTS_DIR: &str = "crates/ra_syntax/test_data/parser/inline/err"; 34const ERR_INLINE_TESTS_DIR: &str = "crates/ra_syntax/test_data/parser/inline/err";
35 35
36const SYNTAX_KINDS: &str = "crates/ra_parser/src/syntax_kind/generated.rs"; 36const SYNTAX_KINDS: &str = "crates/parser/src/syntax_kind/generated.rs";
37const AST_NODES: &str = "crates/ra_syntax/src/ast/generated/nodes.rs"; 37const AST_NODES: &str = "crates/syntax/src/ast/generated/nodes.rs";
38const AST_TOKENS: &str = "crates/ra_syntax/src/ast/generated/tokens.rs"; 38const AST_TOKENS: &str = "crates/syntax/src/ast/generated/tokens.rs";
39 39
40const ASSISTS_DIR: &str = "crates/ra_assists/src/handlers"; 40const ASSISTS_DIR: &str = "crates/assists/src/handlers";
41const ASSISTS_TESTS: &str = "crates/ra_assists/src/tests/generated.rs"; 41const ASSISTS_TESTS: &str = "crates/assists/src/tests/generated.rs";
42 42
43const REPOSITORY_URL: &str = "https://github.com/rust-lang/rust"; 43const REPOSITORY_URL: &str = "https://github.com/rust-lang/rust";
44const UNSTABLE_FEATURE: &str = "crates/ra_ide/src/completion/unstable_feature_descriptor.rs"; 44const UNSTABLE_FEATURE: &str = "crates/ra_ide/src/completion/unstable_feature_descriptor.rs";
diff --git a/xtask/src/codegen/gen_syntax.rs b/xtask/src/codegen/gen_syntax.rs
index cafad8070..dd1f4d6a2 100644
--- a/xtask/src/codegen/gen_syntax.rs
+++ b/xtask/src/codegen/gen_syntax.rs
@@ -1,7 +1,7 @@
1//! This module generates AST datatype used by rust-analyzer. 1//! This module generates AST datatype used by rust-analyzer.
2//! 2//!
3//! Specifically, it generates the `SyntaxKind` enum and a number of newtype 3//! Specifically, it generates the `SyntaxKind` enum and a number of newtype
4//! wrappers around `SyntaxNode` which implement `ra_syntax::AstNode`. 4//! wrappers around `SyntaxNode` which implement `syntax::AstNode`.
5 5
6use std::{ 6use std::{
7 collections::{BTreeSet, HashSet}, 7 collections::{BTreeSet, HashSet},
diff --git a/xtask/src/lib.rs b/xtask/src/lib.rs
index 2fdb08f2e..807ef587c 100644
--- a/xtask/src/lib.rs
+++ b/xtask/src/lib.rs
@@ -103,7 +103,7 @@ pub fn run_clippy() -> Result<()> {
103} 103}
104 104
105pub fn run_fuzzer() -> Result<()> { 105pub fn run_fuzzer() -> Result<()> {
106 let _d = pushd("./crates/ra_syntax"); 106 let _d = pushd("./crates/syntax");
107 let _e = pushenv("RUSTUP_TOOLCHAIN", "nightly"); 107 let _e = pushenv("RUSTUP_TOOLCHAIN", "nightly");
108 if run!("cargo fuzz --help").is_err() { 108 if run!("cargo fuzz --help").is_err() {
109 run!("cargo install cargo-fuzz")?; 109 run!("cargo install cargo-fuzz")?;
@@ -139,7 +139,7 @@ pub fn run_pre_cache() -> Result<()> {
139 } 139 }
140 140
141 fs2::remove_file("./target/.rustc_info.json")?; 141 fs2::remove_file("./target/.rustc_info.json")?;
142 let to_delete = ["ra_", "heavy_test", "xtask"]; 142 let to_delete = ["hir", "heavy_test", "xtask", "ide", "rust-analyzer"];
143 for &dir in ["./target/debug/deps", "target/debug/.fingerprint"].iter() { 143 for &dir in ["./target/debug/deps", "target/debug/.fingerprint"].iter() {
144 for entry in Path::new(dir).read_dir()? { 144 for entry in Path::new(dir).read_dir()? {
145 let entry = entry?; 145 let entry = entry?;
diff --git a/xtask/tests/tidy.rs b/xtask/tests/tidy.rs
index 68a70da9e..ca9749ed4 100644
--- a/xtask/tests/tidy.rs
+++ b/xtask/tests/tidy.rs
@@ -44,11 +44,26 @@ fn rust_files_are_tidy() {
44 let text = fs2::read_to_string(&path).unwrap(); 44 let text = fs2::read_to_string(&path).unwrap();
45 check_todo(&path, &text); 45 check_todo(&path, &text);
46 check_trailing_ws(&path, &text); 46 check_trailing_ws(&path, &text);
47 deny_clippy(&path, &text);
47 tidy_docs.visit(&path, &text); 48 tidy_docs.visit(&path, &text);
48 } 49 }
49 tidy_docs.finish(); 50 tidy_docs.finish();
50} 51}
51 52
53fn deny_clippy(path: &PathBuf, text: &String) {
54 if text.contains("[\u{61}llow(clippy") {
55 panic!(
56 "\n\nallowing lints is forbidden: {}.
57rust-analyzer intentionally doesn't check clippy on CI.
58You can allow lint globally via `xtask clippy`.
59See https://github.com/rust-lang/rust-clippy/issues/5537 for discussion.
60
61",
62 path.display()
63 )
64 }
65}
66
52#[test] 67#[test]
53fn check_licenses() { 68fn check_licenses() {
54 let expected = " 69 let expected = "
@@ -179,16 +194,16 @@ impl TidyDocs {
179 } 194 }
180 195
181 let poorly_documented = [ 196 let poorly_documented = [
182 "ra_hir", 197 "hir",
183 "ra_hir_expand", 198 "hir_expand",
184 "ra_ide", 199 "ide",
185 "ra_mbe", 200 "mbe",
186 "ra_parser", 201 "parser",
187 "ra_prof", 202 "profile",
188 "ra_project_model", 203 "project_model",
189 "ra_syntax", 204 "syntax",
190 "ra_tt", 205 "tt",
191 "ra_hir_ty", 206 "hir_ty",
192 ]; 207 ];
193 208
194 let mut has_fixmes = 209 let mut has_fixmes =