@@ -129,6 +129,7 @@ pub fn initialize_build(
129129 path : & Path ,
130130 bsc_path : & Option < PathBuf > ,
131131 build_dev_deps : bool ,
132+ snapshot_output : bool ,
132133) -> Result < BuildState > {
133134 let project_root = helpers:: get_abs_path ( path) ;
134135 let workspace_root = helpers:: get_workspace_root ( & project_root) ;
@@ -139,7 +140,7 @@ pub fn initialize_build(
139140 let root_config_name = packages:: read_package_name ( & project_root) ?;
140141 let rescript_version = helpers:: get_rescript_version ( & bsc_path) ;
141142
142- if show_progress {
143+ if !snapshot_output && show_progress {
143144 print ! ( "{} {}Building package tree..." , style( "[1/7]" ) . bold( ) . dim( ) , TREE ) ;
144145 let _ = stdout ( ) . flush ( ) ;
145146 }
@@ -154,7 +155,7 @@ pub fn initialize_build(
154155 ) ?;
155156 let timing_package_tree_elapsed = timing_package_tree. elapsed ( ) ;
156157
157- if show_progress {
158+ if !snapshot_output && show_progress {
158159 println ! (
159160 "{}{} {}Built package tree in {:.2}s" ,
160161 LINE_CLEAR ,
@@ -172,7 +173,7 @@ pub fn initialize_build(
172173
173174 let timing_source_files = Instant :: now ( ) ;
174175
175- if show_progress {
176+ if !snapshot_output && show_progress {
176177 print ! (
177178 "{} {}Finding source files..." ,
178179 style( "[2/7]" ) . bold( ) . dim( ) ,
@@ -192,7 +193,7 @@ pub fn initialize_build(
192193 packages:: parse_packages ( & mut build_state) ;
193194 let timing_source_files_elapsed = timing_source_files. elapsed ( ) ;
194195
195- if show_progress {
196+ if !snapshot_output && show_progress {
196197 println ! (
197198 "{}{} {}Found source files in {:.2}s" ,
198199 LINE_CLEAR ,
@@ -214,7 +215,7 @@ pub fn initialize_build(
214215 let compile_assets_state = read_compile_state:: read ( & mut build_state) ;
215216 let timing_compile_state_elapsed = timing_compile_state. elapsed ( ) ;
216217
217- if show_progress {
218+ if !snapshot_output && show_progress {
218219 println ! (
219220 "{}{} {}Read compile state {:.2}s" ,
220221 LINE_CLEAR ,
@@ -236,15 +237,19 @@ pub fn initialize_build(
236237 let timing_cleanup_elapsed = timing_cleanup. elapsed ( ) ;
237238
238239 if show_progress {
239- println ! (
240- "{}{} {}Cleaned {}/{} {:.2}s" ,
241- LINE_CLEAR ,
242- style( "[4/7]" ) . bold( ) . dim( ) ,
243- SWEEP ,
244- diff_cleanup,
245- total_cleanup,
246- default_timing. unwrap_or( timing_cleanup_elapsed) . as_secs_f64( )
247- ) ;
240+ if snapshot_output {
241+ println ! ( "Cleant {}/{}" , diff_cleanup, total_cleanup)
242+ } else {
243+ println ! (
244+ "{}{} {}Cleant {}/{} {:.2}s" ,
245+ LINE_CLEAR ,
246+ style( "[4/7]" ) . bold( ) . dim( ) ,
247+ SWEEP ,
248+ diff_cleanup,
249+ total_cleanup,
250+ default_timing. unwrap_or( timing_cleanup_elapsed) . as_secs_f64( )
251+ ) ;
252+ }
248253 }
249254
250255 Ok ( build_state)
@@ -282,10 +287,11 @@ pub fn incremental_build(
282287 only_incremental : bool ,
283288 create_sourcedirs : bool ,
284289 build_dev_deps : bool ,
290+ snapshot_output : bool ,
285291) -> Result < ( ) , IncrementalBuildError > {
286292 logs:: initialize ( & build_state. packages ) ;
287293 let num_dirty_modules = build_state. modules . values ( ) . filter ( |m| is_dirty ( m) ) . count ( ) as u64 ;
288- let pb = if show_progress {
294+ let pb = if !snapshot_output && show_progress {
289295 ProgressBar :: new ( num_dirty_modules)
290296 } else {
291297 ProgressBar :: hidden ( )
@@ -308,20 +314,25 @@ pub fn incremental_build(
308314 match result_asts {
309315 Ok ( _ast) => {
310316 if show_progress {
311- println ! (
312- "{}{} {}Parsed {} source files in {:.2}s" ,
313- LINE_CLEAR ,
314- format_step( current_step, total_steps) ,
315- CODE ,
316- num_dirty_modules,
317- default_timing. unwrap_or( timing_ast_elapsed) . as_secs_f64( )
318- ) ;
319- pb. finish ( ) ;
317+ if snapshot_output {
318+ println ! ( "Parsed {} source files" , num_dirty_modules)
319+ } else {
320+ println ! (
321+ "{}{} {}Parsed {} source files in {:.2}s" ,
322+ LINE_CLEAR ,
323+ format_step( current_step, total_steps) ,
324+ CODE ,
325+ num_dirty_modules,
326+ default_timing. unwrap_or( timing_ast_elapsed) . as_secs_f64( )
327+ ) ;
328+ pb. finish ( ) ;
329+ }
320330 }
321331 }
322332 Err ( err) => {
323333 logs:: finalize ( & build_state. packages ) ;
324- if show_progress {
334+
335+ if !snapshot_output && show_progress {
325336 println ! (
326337 "{}{} {}Error parsing source files in {:.2}s" ,
327338 LINE_CLEAR ,
@@ -332,7 +343,7 @@ pub fn incremental_build(
332343 pb. finish ( ) ;
333344 }
334345
335- println ! ( "Could not parse source files: {}" , & err) ;
346+ println ! ( "{}" , & err) ;
336347 return Err ( IncrementalBuildError :: SourceFileParseError ) ;
337348 }
338349 }
@@ -341,7 +352,7 @@ pub fn incremental_build(
341352 let timing_deps_elapsed = timing_deps. elapsed ( ) ;
342353 current_step += 1 ;
343354
344- if show_progress {
355+ if !snapshot_output && show_progress {
345356 println ! (
346357 "{}{} {}Collected deps in {:.2}s" ,
347358 LINE_CLEAR ,
@@ -365,7 +376,7 @@ pub fn incremental_build(
365376 } ;
366377
367378 let start_compiling = Instant :: now ( ) ;
368- let pb = if show_progress {
379+ let pb = if !snapshot_output && show_progress {
369380 ProgressBar :: new ( build_state. modules . len ( ) . try_into ( ) . unwrap ( ) )
370381 } else {
371382 ProgressBar :: hidden ( )
@@ -397,14 +408,18 @@ pub fn incremental_build(
397408 pb. finish ( ) ;
398409 if !compile_errors. is_empty ( ) {
399410 if show_progress {
400- println ! (
401- "{}{} {}Compiled {} modules in {:.2}s" ,
402- LINE_CLEAR ,
403- format_step( current_step, total_steps) ,
404- CROSS ,
405- num_compiled_modules,
406- default_timing. unwrap_or( compile_duration) . as_secs_f64( )
407- ) ;
411+ if snapshot_output {
412+ println ! ( "Compiled {} modules" , num_compiled_modules)
413+ } else {
414+ println ! (
415+ "{}{} {}Compiled {} modules in {:.2}s" ,
416+ LINE_CLEAR ,
417+ format_step( current_step, total_steps) ,
418+ CROSS ,
419+ num_compiled_modules,
420+ default_timing. unwrap_or( compile_duration) . as_secs_f64( )
421+ ) ;
422+ }
408423 }
409424 if helpers:: contains_ascii_characters ( & compile_warnings) {
410425 println ! ( "{}" , & compile_warnings) ;
@@ -415,14 +430,18 @@ pub fn incremental_build(
415430 Err ( IncrementalBuildError :: CompileError ( None ) )
416431 } else {
417432 if show_progress {
418- println ! (
419- "{}{} {}Compiled {} modules in {:.2}s" ,
420- LINE_CLEAR ,
421- format_step( current_step, total_steps) ,
422- SWORDS ,
423- num_compiled_modules,
424- default_timing. unwrap_or( compile_duration) . as_secs_f64( )
425- ) ;
433+ if snapshot_output {
434+ println ! ( "Compiled {} modules" , num_compiled_modules)
435+ } else {
436+ println ! (
437+ "{}{} {}Compiled {} modules in {:.2}s" ,
438+ LINE_CLEAR ,
439+ format_step( current_step, total_steps) ,
440+ SWORDS ,
441+ num_compiled_modules,
442+ default_timing. unwrap_or( compile_duration) . as_secs_f64( )
443+ ) ;
444+ }
426445 }
427446
428447 if helpers:: contains_ascii_characters ( & compile_warnings) {
@@ -453,6 +472,7 @@ pub fn build(
453472 create_sourcedirs : bool ,
454473 bsc_path : & Option < PathBuf > ,
455474 build_dev_deps : bool ,
475+ snapshot_output : bool ,
456476) -> Result < BuildState > {
457477 let default_timing: Option < std:: time:: Duration > = if no_timing {
458478 Some ( std:: time:: Duration :: new ( 0.0 as u64 , 0.0 as u32 ) )
@@ -467,6 +487,7 @@ pub fn build(
467487 path,
468488 bsc_path,
469489 build_dev_deps,
490+ snapshot_output,
470491 )
471492 . map_err ( |e| anyhow ! ( "Could not initialize build. Error: {e}" ) ) ?;
472493
@@ -478,9 +499,10 @@ pub fn build(
478499 false ,
479500 create_sourcedirs,
480501 build_dev_deps,
502+ snapshot_output,
481503 ) {
482504 Ok ( _) => {
483- if show_progress {
505+ if !snapshot_output && show_progress {
484506 let timing_total_elapsed = timing_total. elapsed ( ) ;
485507 println ! (
486508 "\n {}{}Finished Compilation in {:.2}s" ,
0 commit comments