@@ -105,6 +105,22 @@ pub fn prepare<'a, 'cfg>(
105
105
}
106
106
}
107
107
108
+ fn emit_build_output ( output : & BuildOutput , id : & PackageId ) {
109
+ let library_paths = output
110
+ . library_paths
111
+ . iter ( )
112
+ . map ( |l| l. display ( ) . to_string ( ) )
113
+ . collect :: < Vec < _ > > ( ) ;
114
+
115
+ machine_message:: emit ( & machine_message:: BuildScript {
116
+ package_id : id,
117
+ linked_libs : & output. library_links ,
118
+ linked_paths : & library_paths,
119
+ cfgs : & output. cfgs ,
120
+ env : & output. env ,
121
+ } ) ;
122
+ }
123
+
108
124
fn build_work < ' a , ' cfg > ( cx : & mut Context < ' a , ' cfg > , unit : & Unit < ' a > ) -> CargoResult < ( Work , Work ) > {
109
125
assert ! ( unit. mode. is_run_custom_build( ) ) ;
110
126
let bcx = & cx. bcx ;
@@ -336,18 +352,7 @@ fn build_work<'a, 'cfg>(cx: &mut Context<'a, 'cfg>, unit: &Unit<'a>) -> CargoRes
336
352
BuildOutput :: parse ( & output. stdout , & pkg_name, & root_output, & root_output) ?;
337
353
338
354
if json_messages {
339
- let library_paths = parsed_output
340
- . library_paths
341
- . iter ( )
342
- . map ( |l| l. display ( ) . to_string ( ) )
343
- . collect :: < Vec < _ > > ( ) ;
344
- machine_message:: emit ( & machine_message:: BuildScript {
345
- package_id : & id,
346
- linked_libs : & parsed_output. library_links ,
347
- linked_paths : & library_paths,
348
- cfgs : & parsed_output. cfgs ,
349
- env : & parsed_output. env ,
350
- } ) ;
355
+ emit_build_output ( & parsed_output, & id) ;
351
356
}
352
357
build_state. insert ( id, kind, parsed_output) ;
353
358
}
@@ -367,18 +372,7 @@ fn build_work<'a, 'cfg>(cx: &mut Context<'a, 'cfg>, unit: &Unit<'a>) -> CargoRes
367
372
} ;
368
373
369
374
if json_messages {
370
- let library_paths = output
371
- . library_paths
372
- . iter ( )
373
- . map ( |l| l. display ( ) . to_string ( ) )
374
- . collect :: < Vec < _ > > ( ) ;
375
- machine_message:: emit ( & machine_message:: BuildScript {
376
- package_id : & id,
377
- linked_libs : & output. library_links ,
378
- linked_paths : & library_paths,
379
- cfgs : & output. cfgs ,
380
- env : & output. env ,
381
- } ) ;
375
+ emit_build_output ( & output, & id) ;
382
376
}
383
377
384
378
build_state. insert ( id, kind, output) ;
0 commit comments