File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change 5353 - name : xtask build
5454 run : cd xtask && cargo build
5555 - name : xtask generate
56- run : cargo xtask generate ${{ matrix.integration }}
56+ run : cargo xtask generate ${{ matrix.integration }} --clean
5757 - name : check generated files are up-to-date
5858 run : |
5959 git add .
Original file line number Diff line number Diff line change @@ -69,6 +69,10 @@ pub struct Generate {
6969 /// Directory where to place the generated templates.
7070 #[ clap( long) ]
7171 out : Option < PathBuf > ,
72+ /// Clean generate, deletes the generated directory before generating templates. Use this when you moved or removed
73+ /// files.
74+ #[ clap( long) ]
75+ clean : bool ,
7276 /// A command that should be executed on each generated template.
7377 ///
7478 /// If a command fails, this process will fail as well, allowing you to test the template output.
@@ -126,6 +130,10 @@ impl Generate {
126130 . out
127131 . clone ( )
128132 . unwrap_or_else ( || PathBuf :: from ( env ! ( "CARGO_MANIFEST_DIR" ) ) . join ( "../generated" ) ) ;
133+ debug ! ( "out_base_dir: {}" , out. display( ) ) ;
134+ if self . clean {
135+ std:: fs:: remove_dir_all ( & out) ?;
136+ }
129137 std:: fs:: create_dir_all ( & out) ?;
130138 Ok ( out)
131139 }
You can’t perform that action at this time.
0 commit comments