File tree Expand file tree Collapse file tree 1 file changed +15
-9
lines changed Expand file tree Collapse file tree 1 file changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ use target_build_utils::TargetInfo;
13
13
use walkdir:: { DirEntry , WalkDir } ;
14
14
15
15
fn build_hermit ( src_dir : & Path , target_dir_opt : Option < & Path > ) {
16
+ assert ! ( src_dir. exists( ) , "rusty_hermit source folder does not exist" ) ;
16
17
let target = TargetInfo :: new ( ) . expect ( "Could not get target info" ) ;
17
18
let profile = env:: var ( "PROFILE" ) . expect ( "PROFILE was not set" ) ;
18
19
let mut cmd = Command :: new ( "cargo" ) ;
@@ -186,15 +187,20 @@ fn build() {
186
187
let out_dir = PathBuf :: from ( env:: var ( "OUT_DIR" ) . unwrap ( ) ) ;
187
188
let src_dir = out_dir. join ( "rusty-hermit" ) ;
188
189
189
- let _output = Command :: new ( "cargo" )
190
- . current_dir ( out_dir)
191
- . arg ( "download" )
192
- . arg ( "--output" )
193
- . arg ( src_dir. clone ( ) . into_os_string ( ) )
194
- . arg ( "--extract" )
195
- . arg ( "rusty-hermit" )
196
- . output ( )
197
- . expect ( "Unable to download rusty-hermit. Please install `cargo-download`." ) ;
190
+ if !src_dir. as_path ( ) . exists ( ) {
191
+ let cargo_download = Command :: new ( "cargo" )
192
+ . current_dir ( out_dir)
193
+ . arg ( "download" )
194
+ . arg ( "--output" )
195
+ . arg ( src_dir. clone ( ) . into_os_string ( ) )
196
+ . arg ( "--extract" )
197
+ . arg ( "rusty-hermit" )
198
+ . output ( )
199
+ . expect ( "could not launch cargo download" ) ;
200
+ if !cargo_download. status . success ( ) {
201
+ panic ! ( "Unable to download rusty-hermit. Is `cargo-download` installed?." ) ;
202
+ }
203
+ }
198
204
199
205
build_hermit ( src_dir. as_ref ( ) , None ) ;
200
206
}
You can’t perform that action at this time.
0 commit comments