@@ -179,8 +179,39 @@ fn dogfood_subprojects() {
179
179
#[ ignore]
180
180
#[ cfg( feature = "metadata-collector-lint" ) ]
181
181
fn run_metadata_collection_lint ( ) {
182
+ use std:: fs:: File ;
183
+ use std:: time:: SystemTime ;
184
+
185
+ // Setup for validation
186
+ let metadata_output_path = PathBuf :: from ( env ! ( "CARGO_MANIFEST_DIR" ) ) . join ( "util/gh-pages/metadata_collection.json" ) ;
187
+ let start_time = SystemTime :: now ( ) ;
188
+
189
+ // Run collection as is
182
190
std:: env:: set_var ( "ENABLE_METADATA_COLLECTION" , "1" ) ;
183
191
run_clippy_for_project ( "clippy_lints" ) ;
192
+
193
+ // Check if cargo caching got in the way
194
+ if let Ok ( file) = File :: open ( metadata_output_path) {
195
+ if let Ok ( metadata) = file. metadata ( ) {
196
+ if let Ok ( last_modification) = metadata. modified ( ) {
197
+ if last_modification > start_time {
198
+ // The output file has been modified. Most likely by a hungry
199
+ // metadata collection monster. So We'll return.
200
+ return ;
201
+ }
202
+ }
203
+ }
204
+ }
205
+
206
+ // Force cargo to invalidate the caches
207
+ filetime:: set_file_mtime (
208
+ PathBuf :: from ( env ! ( "CARGO_MANIFEST_DIR" ) ) . join ( "clippy_lints/src/lib.rs" ) ,
209
+ filetime:: FileTime :: now ( ) ,
210
+ )
211
+ . unwrap ( ) ;
212
+
213
+ // Running the collection again
214
+ run_clippy_for_project ( "clippy_lints" ) ;
184
215
}
185
216
186
217
fn run_clippy_for_project ( project : & str ) {
0 commit comments