This repository was archived by the owner on Nov 8, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
tools/external_crates/crate_tool/src Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ use std::{
18
18
fs:: { remove_file, rename} ,
19
19
path:: Path ,
20
20
process:: { Command , Output } ,
21
+ time:: { Duration , SystemTime } ,
21
22
} ;
22
23
23
24
use anyhow:: { Context , Result } ;
@@ -84,12 +85,16 @@ pub fn cargo_embargo_autoconfig(path: &RootedPath) -> Result<Output> {
84
85
}
85
86
86
87
pub fn maybe_build_cargo_embargo ( repo_root : & impl AsRef < Path > , force_rebuild : bool ) -> Result < ( ) > {
87
- if !force_rebuild && repo_root. as_ref ( ) . join ( "out/host/linux-x86/bin/cargo_embargo" ) . exists ( ) {
88
- Ok ( ( ) )
89
- } else {
88
+ let cargo_embargo = repo_root. as_ref ( ) . join ( "out/host/linux-x86/bin/cargo_embargo" ) ;
89
+ if force_rebuild
90
+ || !cargo_embargo. exists ( )
91
+ || SystemTime :: now ( ) . duration_since ( cargo_embargo. metadata ( ) ?. modified ( ) ?) ?
92
+ > Duration :: from_secs ( 14 * 24 * 60 * 60 )
93
+ {
90
94
println ! ( "Rebuilding cargo_embargo" ) ;
91
- build_cargo_embargo ( repo_root)
95
+ return build_cargo_embargo ( repo_root) ;
92
96
}
97
+ Ok ( ( ) )
93
98
}
94
99
95
100
pub fn build_cargo_embargo ( repo_root : & impl AsRef < Path > ) -> Result < ( ) > {
You can’t perform that action at this time.
0 commit comments