mirror of
				https://github.com/rust-lang/rust-analyzer.git
				synced 2025-11-03 21:25:25 +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
 | 
			
		||||
        // git repo. Instead, `cargo xtask release` runs this test before making
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,13 +10,15 @@ use crate::{
 | 
			
		|||
 | 
			
		||||
pub(crate) fn generate(check: bool) {
 | 
			
		||||
    let diagnostics = Diagnostic::collect().unwrap();
 | 
			
		||||
    if !check {
 | 
			
		||||
        let contents =
 | 
			
		||||
            diagnostics.into_iter().map(|it| it.to_string()).collect::<Vec<_>>().join("\n\n");
 | 
			
		||||
        let contents = add_preamble(crate::flags::CodegenType::DiagnosticsDocs, contents);
 | 
			
		||||
        let dst = project_root().join("docs/book/src/diagnostics_generated.md");
 | 
			
		||||
        fs::write(dst, contents).unwrap();
 | 
			
		||||
    // Do not generate docs when run with `--check`
 | 
			
		||||
    if check {
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    let contents =
 | 
			
		||||
        diagnostics.into_iter().map(|it| it.to_string()).collect::<Vec<_>>().join("\n\n");
 | 
			
		||||
    let contents = add_preamble(crate::flags::CodegenType::DiagnosticsDocs, contents);
 | 
			
		||||
    let dst = project_root().join("docs/book/src/diagnostics_generated.md");
 | 
			
		||||
    fs::write(dst, contents).unwrap();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[derive(Debug)]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,8 +8,12 @@ use crate::{
 | 
			
		|||
    util::list_rust_files,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
pub(crate) fn generate(_check: bool) {
 | 
			
		||||
pub(crate) fn generate(check: bool) {
 | 
			
		||||
    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 = add_preamble(crate::flags::CodegenType::FeatureDocs, contents);
 | 
			
		||||
    let dst = project_root().join("docs/book/src/features_generated.md");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue