@@ -108,14 +108,20 @@ fn get_apple_sdk_name(config: &Config) -> &'static str {
108108}
109109
110110/// Returns an absolute path to the BoringSSL source.
111- fn get_boringssl_source_path ( config : & Config ) -> & PathBuf {
112- if let Some ( src_path) = & config. env . source_path {
113- return src_path;
114- }
115-
111+ fn get_boringssl_source_path ( config : & Config ) -> & Path {
116112 static SOURCE_PATH : OnceLock < PathBuf > = OnceLock :: new ( ) ;
117113
118114 SOURCE_PATH . get_or_init ( || {
115+ if let Some ( src_path) = & config. env . source_path {
116+ if !src_path. exists ( ) {
117+ println ! (
118+ "cargo:warning=boringssl source path doesn't exist: {}" ,
119+ src_path. display( )
120+ ) ;
121+ }
122+ return src_path. into ( ) ;
123+ }
124+
119125 let submodule_dir = "boringssl" ;
120126
121127 let src_path = config. out_dir . join ( submodule_dir) ;
@@ -130,7 +136,7 @@ fn get_boringssl_source_path(config: &Config) -> &PathBuf {
130136 . args ( [ "submodule" , "update" , "--init" , "--recursive" ] )
131137 . arg ( & submodule_path) ,
132138 )
133- . unwrap ( ) ;
139+ . expect ( "git submodule update" ) ;
134140 }
135141
136142 let _ = fs:: remove_dir_all ( & src_path) ;
@@ -501,7 +507,15 @@ fn apply_patch(config: &Config, patch_name: &str) -> io::Result<()> {
501507}
502508
503509fn run_command ( command : & mut Command ) -> io:: Result < Output > {
504- let out = command. output ( ) ?;
510+ let out = command. output ( ) . map_err ( |e| {
511+ io:: Error :: new (
512+ e. kind ( ) ,
513+ format ! (
514+ "can't run {}: {e}\n {command:?} failed" ,
515+ command. get_program( ) . to_string_lossy( ) ,
516+ ) ,
517+ )
518+ } ) ?;
505519
506520 std:: io:: stderr ( ) . write_all ( & out. stderr ) ?;
507521 std:: io:: stdout ( ) . write_all ( & out. stdout ) ?;
@@ -519,13 +533,16 @@ fn run_command(command: &mut Command) -> io::Result<Output> {
519533}
520534
521535fn built_boring_source_path ( config : & Config ) -> & PathBuf {
522- if let Some ( path) = & config. env . path {
523- return path;
524- }
525-
526536 static BUILD_SOURCE_PATH : OnceLock < PathBuf > = OnceLock :: new ( ) ;
527537
528538 BUILD_SOURCE_PATH . get_or_init ( || {
539+ if let Some ( path) = & config. env . path {
540+ if !path. exists ( ) {
541+ println ! ( "cargo:warning=built path doesn't exist: {}" , path. display( ) ) ;
542+ }
543+ return path. into ( ) ;
544+ }
545+
529546 let mut cfg = get_boringssl_cmake_config ( config) ;
530547
531548 let num_jobs = std:: env:: var ( "NUM_JOBS" ) . ok ( ) . or_else ( || {
0 commit comments