mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-13 17:35:21 +00:00
fix(codegen): do not generate docs with --check
Running `cargo codegen --check` should not generate any mdbook files, since they are ignored in the repo and used only while releasing a new copy of the documentation. Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
This commit is contained in:
parent
b0632f749e
commit
1f366e7efe
3 changed files with 18 additions and 7 deletions
|
|
@ -53,6 +53,11 @@ r#####"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Do not generate assists manual when run with `--check`
|
||||||
|
if check {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// Generate assists manual. Note that we do _not_ commit manual to the
|
// Generate assists manual. Note that we do _not_ commit manual to the
|
||||||
// git repo. Instead, `cargo xtask release` runs this test before making
|
// git repo. Instead, `cargo xtask release` runs this test before making
|
||||||
|
|
|
||||||
|
|
@ -10,13 +10,15 @@ use crate::{
|
||||||
|
|
||||||
pub(crate) fn generate(check: bool) {
|
pub(crate) fn generate(check: bool) {
|
||||||
let diagnostics = Diagnostic::collect().unwrap();
|
let diagnostics = Diagnostic::collect().unwrap();
|
||||||
if !check {
|
// Do not generate docs when run with `--check`
|
||||||
|
if check {
|
||||||
|
return;
|
||||||
|
}
|
||||||
let contents =
|
let contents =
|
||||||
diagnostics.into_iter().map(|it| it.to_string()).collect::<Vec<_>>().join("\n\n");
|
diagnostics.into_iter().map(|it| it.to_string()).collect::<Vec<_>>().join("\n\n");
|
||||||
let contents = add_preamble(crate::flags::CodegenType::DiagnosticsDocs, contents);
|
let contents = add_preamble(crate::flags::CodegenType::DiagnosticsDocs, contents);
|
||||||
let dst = project_root().join("docs/book/src/diagnostics_generated.md");
|
let dst = project_root().join("docs/book/src/diagnostics_generated.md");
|
||||||
fs::write(dst, contents).unwrap();
|
fs::write(dst, contents).unwrap();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,12 @@ use crate::{
|
||||||
util::list_rust_files,
|
util::list_rust_files,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub(crate) fn generate(_check: bool) {
|
pub(crate) fn generate(check: bool) {
|
||||||
let features = Feature::collect().unwrap();
|
let features = Feature::collect().unwrap();
|
||||||
|
// Do not generate docs when run with `--check`
|
||||||
|
if check {
|
||||||
|
return;
|
||||||
|
}
|
||||||
let contents = features.into_iter().map(|it| it.to_string()).collect::<Vec<_>>().join("\n\n");
|
let contents = features.into_iter().map(|it| it.to_string()).collect::<Vec<_>>().join("\n\n");
|
||||||
let contents = add_preamble(crate::flags::CodegenType::FeatureDocs, contents);
|
let contents = add_preamble(crate::flags::CodegenType::FeatureDocs, contents);
|
||||||
let dst = project_root().join("docs/book/src/features_generated.md");
|
let dst = project_root().join("docs/book/src/features_generated.md");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue