aboutsummaryrefslogtreecommitdiff
path: root/xtask
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-06-03 17:22:05 +0100
committerAleksey Kladov <[email protected]>2020-06-03 17:26:50 +0100
commit5315934d888797432d62ec4a55303aeacb8cd286 (patch)
tree9cd37b2ad18029c098529d91ef89443ac8e13b22 /xtask
parent636f597a86cbb72194dd9c867563a77ddcf50c44 (diff)
Don't store generated docs in the repo
Diffstat (limited to 'xtask')
-rw-r--r--xtask/src/codegen.rs6
-rw-r--r--xtask/src/codegen/gen_assists_docs.rs11
-rw-r--r--xtask/src/lib.rs2
-rw-r--r--xtask/src/main.rs1
-rw-r--r--xtask/tests/tidy.rs9
5 files changed, 14 insertions, 15 deletions
diff --git a/xtask/src/codegen.rs b/xtask/src/codegen.rs
index 5511c01d5..f5f4b964a 100644
--- a/xtask/src/codegen.rs
+++ b/xtask/src/codegen.rs
@@ -18,8 +18,10 @@ use std::{
18use crate::{not_bash::fs2, project_root, Result}; 18use crate::{not_bash::fs2, project_root, Result};
19 19
20pub use self::{ 20pub use self::{
21 gen_assists_docs::generate_assists_docs, gen_feature_docs::generate_feature_docs, 21 gen_assists_docs::{generate_assists_docs, generate_assists_tests},
22 gen_parser_tests::generate_parser_tests, gen_syntax::generate_syntax, 22 gen_feature_docs::generate_feature_docs,
23 gen_parser_tests::generate_parser_tests,
24 gen_syntax::generate_syntax,
23}; 25};
24 26
25const GRAMMAR_DIR: &str = "crates/ra_parser/src/grammar"; 27const GRAMMAR_DIR: &str = "crates/ra_parser/src/grammar";
diff --git a/xtask/src/codegen/gen_assists_docs.rs b/xtask/src/codegen/gen_assists_docs.rs
index 6c1be5350..526941f73 100644
--- a/xtask/src/codegen/gen_assists_docs.rs
+++ b/xtask/src/codegen/gen_assists_docs.rs
@@ -7,16 +7,17 @@ use crate::{
7 project_root, rust_files, Result, 7 project_root, rust_files, Result,
8}; 8};
9 9
10pub fn generate_assists_docs(mode: Mode) -> Result<()> { 10pub fn generate_assists_tests(mode: Mode) -> Result<()> {
11 let assists = Assist::collect()?; 11 let assists = Assist::collect()?;
12 generate_tests(&assists, mode)?; 12 generate_tests(&assists, mode)
13}
13 14
15pub fn generate_assists_docs(mode: Mode) -> Result<()> {
16 let assists = Assist::collect()?;
14 let contents = assists.into_iter().map(|it| it.to_string()).collect::<Vec<_>>().join("\n\n"); 17 let contents = assists.into_iter().map(|it| it.to_string()).collect::<Vec<_>>().join("\n\n");
15 let contents = contents.trim().to_string() + "\n"; 18 let contents = contents.trim().to_string() + "\n";
16 let dst = project_root().join("docs/user/generated_assists.adoc"); 19 let dst = project_root().join("docs/user/generated_assists.adoc");
17 codegen::update(&dst, &contents, mode)?; 20 codegen::update(&dst, &contents, mode)
18
19 Ok(())
20} 21}
21 22
22#[derive(Debug)] 23#[derive(Debug)]
diff --git a/xtask/src/lib.rs b/xtask/src/lib.rs
index 874957885..739f49f7b 100644
--- a/xtask/src/lib.rs
+++ b/xtask/src/lib.rs
@@ -160,6 +160,8 @@ pub fn run_release(dry_run: bool) -> Result<()> {
160 run!("git reset --hard tags/nightly")?; 160 run!("git reset --hard tags/nightly")?;
161 run!("git push")?; 161 run!("git push")?;
162 } 162 }
163 codegen::generate_assists_docs(Mode::Overwrite)?;
164 codegen::generate_feature_docs(Mode::Overwrite)?;
163 165
164 let website_root = project_root().join("../rust-analyzer.github.io"); 166 let website_root = project_root().join("../rust-analyzer.github.io");
165 let changelog_dir = website_root.join("./thisweek/_posts"); 167 let changelog_dir = website_root.join("./thisweek/_posts");
diff --git a/xtask/src/main.rs b/xtask/src/main.rs
index 9d7cdd114..81bb3a33f 100644
--- a/xtask/src/main.rs
+++ b/xtask/src/main.rs
@@ -74,6 +74,7 @@ FLAGS:
74 args.finish()?; 74 args.finish()?;
75 codegen::generate_syntax(Mode::Overwrite)?; 75 codegen::generate_syntax(Mode::Overwrite)?;
76 codegen::generate_parser_tests(Mode::Overwrite)?; 76 codegen::generate_parser_tests(Mode::Overwrite)?;
77 codegen::generate_assists_tests(Mode::Overwrite)?;
77 codegen::generate_assists_docs(Mode::Overwrite)?; 78 codegen::generate_assists_docs(Mode::Overwrite)?;
78 codegen::generate_feature_docs(Mode::Overwrite)?; 79 codegen::generate_feature_docs(Mode::Overwrite)?;
79 Ok(()) 80 Ok(())
diff --git a/xtask/tests/tidy.rs b/xtask/tests/tidy.rs
index 62626064e..d38ac7f17 100644
--- a/xtask/tests/tidy.rs
+++ b/xtask/tests/tidy.rs
@@ -25,19 +25,12 @@ fn generated_tests_are_fresh() {
25 25
26#[test] 26#[test]
27fn generated_assists_are_fresh() { 27fn generated_assists_are_fresh() {
28 if let Err(error) = codegen::generate_assists_docs(Mode::Verify) { 28 if let Err(error) = codegen::generate_assists_tests(Mode::Verify) {
29 panic!("{}. Please update assists by running `cargo xtask codegen`", error); 29 panic!("{}. Please update assists by running `cargo xtask codegen`", error);
30 } 30 }
31} 31}
32 32
33#[test] 33#[test]
34fn generated_features_are_fresh() {
35 if let Err(error) = codegen::generate_feature_docs(Mode::Verify) {
36 panic!("{}. Please update features by running `cargo xtask codegen`", error);
37 }
38}
39
40#[test]
41fn check_code_formatting() { 34fn check_code_formatting() {
42 if let Err(error) = run_rustfmt(Mode::Verify) { 35 if let Err(error) = run_rustfmt(Mode::Verify) {
43 panic!("{}. Please format the code by running `cargo format`", error); 36 panic!("{}. Please format the code by running `cargo format`", error);