@@ -13,7 +13,7 @@ use self::parse::parser_args;
13
13
use crate :: build:: compile:: { mark_modules_with_deleted_deps_dirty, mark_modules_with_expired_deps_dirty} ;
14
14
use crate :: helpers:: emojis:: * ;
15
15
use crate :: helpers:: { self , get_workspace_root} ;
16
- use crate :: sourcedirs;
16
+ use crate :: { config , sourcedirs} ;
17
17
use anyhow:: { Result , anyhow} ;
18
18
use build_types:: * ;
19
19
use console:: style;
@@ -58,7 +58,7 @@ pub struct CompilerArgs {
58
58
pub fn get_compiler_args ( path : & Path ) -> Result < String > {
59
59
let filename = & helpers:: get_abs_path ( path) ;
60
60
let package_root =
61
- helpers:: get_abs_path ( & helpers:: get_nearest_config ( & path) . expect ( "Couldn't find package root" ) ) ;
61
+ helpers:: get_abs_path ( & helpers:: get_nearest_config ( path) . expect ( "Couldn't find package root" ) ) ;
62
62
let workspace_root = get_workspace_root ( & package_root) . map ( |p| helpers:: get_abs_path ( & p) ) ;
63
63
let root_rescript_config =
64
64
packages:: read_config ( & workspace_root. to_owned ( ) . unwrap_or ( package_root. to_owned ( ) ) ) ?;
@@ -77,7 +77,7 @@ pub fn get_compiler_args(path: &Path) -> Result<String> {
77
77
let ( ast_path, parser_args) = parser_args (
78
78
& rescript_config,
79
79
& root_rescript_config,
80
- & relative_filename,
80
+ relative_filename,
81
81
& workspace_root,
82
82
workspace_root. as_ref ( ) . unwrap_or ( & package_root) ,
83
83
& contents,
@@ -94,7 +94,7 @@ pub fn get_compiler_args(path: &Path) -> Result<String> {
94
94
& rescript_config,
95
95
& root_rescript_config,
96
96
& ast_path,
97
- & relative_filename,
97
+ relative_filename,
98
98
is_interface,
99
99
has_interface,
100
100
& package_root,
@@ -216,7 +216,7 @@ pub fn initialize_build(
216
216
217
217
if show_progress {
218
218
if snapshot_output {
219
- println ! ( "Cleaned {}/{}" , diff_cleanup , total_cleanup )
219
+ println ! ( "Cleaned {diff_cleanup }/{total_cleanup}" )
220
220
} else {
221
221
println ! (
222
222
"{}{} {}Cleaned {}/{} {:.2}s" ,
@@ -234,7 +234,7 @@ pub fn initialize_build(
234
234
}
235
235
236
236
fn format_step ( current : usize , total : usize ) -> console:: StyledObject < String > {
237
- style ( format ! ( "[{}/{}]" , current , total ) ) . bold ( ) . dim ( )
237
+ style ( format ! ( "[{current }/{total }]" ) ) . bold ( ) . dim ( )
238
238
}
239
239
240
240
#[ derive( Debug , Clone ) ]
@@ -254,23 +254,23 @@ impl fmt::Display for IncrementalBuildError {
254
254
match & self . kind {
255
255
IncrementalBuildErrorKind :: SourceFileParseError => {
256
256
if self . snapshot_output {
257
- write ! ( f, "{} Could not parse Source Files" , LINE_CLEAR , )
257
+ write ! ( f, "{LINE_CLEAR } Could not parse Source Files" , )
258
258
} else {
259
- write ! ( f, "{} {}Could not parse Source Files" , LINE_CLEAR , CROSS , )
259
+ write ! ( f, "{LINE_CLEAR } {CROSS }Could not parse Source Files" , )
260
260
}
261
261
}
262
262
IncrementalBuildErrorKind :: CompileError ( Some ( e) ) => {
263
263
if self . snapshot_output {
264
- write ! ( f, "{} Failed to Compile. Error: {e}" , LINE_CLEAR , )
264
+ write ! ( f, "{LINE_CLEAR } Failed to Compile. Error: {e}" , )
265
265
} else {
266
- write ! ( f, "{} {}Failed to Compile. Error: {e}" , LINE_CLEAR , CROSS , )
266
+ write ! ( f, "{LINE_CLEAR } {CROSS }Failed to Compile. Error: {e}" , )
267
267
}
268
268
}
269
269
IncrementalBuildErrorKind :: CompileError ( None ) => {
270
270
if self . snapshot_output {
271
- write ! ( f, "{} Failed to Compile. See Errors Above" , LINE_CLEAR , )
271
+ write ! ( f, "{LINE_CLEAR } Failed to Compile. See Errors Above" , )
272
272
} else {
273
- write ! ( f, "{} {}Failed to Compile. See Errors Above" , LINE_CLEAR , CROSS , )
273
+ write ! ( f, "{LINE_CLEAR } {CROSS }Failed to Compile. See Errors Above" , )
274
274
}
275
275
}
276
276
}
@@ -280,7 +280,7 @@ impl fmt::Display for IncrementalBuildError {
280
280
pub fn incremental_build (
281
281
build_state : & mut BuildState ,
282
282
default_timing : Option < Duration > ,
283
- _initial_build : bool ,
283
+ initial_build : bool ,
284
284
show_progress : bool ,
285
285
only_incremental : bool ,
286
286
create_sourcedirs : bool ,
@@ -312,7 +312,7 @@ pub fn incremental_build(
312
312
Ok ( _ast) => {
313
313
if show_progress {
314
314
if snapshot_output {
315
- println ! ( "Parsed {} source files" , num_dirty_modules )
315
+ println ! ( "Parsed {num_dirty_modules } source files" )
316
316
} else {
317
317
println ! (
318
318
"{}{} {}Parsed {} source files in {:.2}s" ,
@@ -370,7 +370,7 @@ pub fn incremental_build(
370
370
if log_enabled ! ( log:: Level :: Trace ) {
371
371
for ( module_name, module) in build_state. modules . iter ( ) {
372
372
if module. compile_dirty {
373
- println ! ( "compile dirty: {}" , module_name ) ;
373
+ println ! ( "compile dirty: {module_name}" ) ;
374
374
}
375
375
}
376
376
} ;
@@ -411,7 +411,7 @@ pub fn incremental_build(
411
411
if !compile_errors. is_empty ( ) {
412
412
if show_progress {
413
413
if snapshot_output {
414
- println ! ( "Compiled {} modules" , num_compiled_modules )
414
+ println ! ( "Compiled {num_compiled_modules } modules" )
415
415
} else {
416
416
println ! (
417
417
"{}{} {}Compiled {} modules in {:.2}s" ,
@@ -426,6 +426,9 @@ pub fn incremental_build(
426
426
if helpers:: contains_ascii_characters ( & compile_warnings) {
427
427
println ! ( "{}" , & compile_warnings) ;
428
428
}
429
+ if initial_build {
430
+ log_deprecations ( build_state) ;
431
+ }
429
432
if helpers:: contains_ascii_characters ( & compile_errors) {
430
433
println ! ( "{}" , & compile_errors) ;
431
434
}
@@ -436,7 +439,7 @@ pub fn incremental_build(
436
439
} else {
437
440
if show_progress {
438
441
if snapshot_output {
439
- println ! ( "Compiled {} modules" , num_compiled_modules )
442
+ println ! ( "Compiled {num_compiled_modules } modules" )
440
443
} else {
441
444
println ! (
442
445
"{}{} {}Compiled {} modules in {:.2}s" ,
@@ -452,10 +455,42 @@ pub fn incremental_build(
452
455
if helpers:: contains_ascii_characters ( & compile_warnings) {
453
456
println ! ( "{}" , & compile_warnings) ;
454
457
}
458
+ if initial_build {
459
+ log_deprecations ( build_state) ;
460
+ }
461
+
455
462
Ok ( ( ) )
456
463
}
457
464
}
458
465
466
+ fn log_deprecations ( build_state : & BuildState ) {
467
+ build_state. packages . iter ( ) . for_each ( |( _, package) | {
468
+ package
469
+ . config
470
+ . get_deprecations ( )
471
+ . iter ( )
472
+ . for_each ( |deprecation_warning| match deprecation_warning {
473
+ config:: DeprecationWarning :: BsDependencies => {
474
+ log_deprecated_config_field ( & package. name , "bs-dependencies" , "dependencies" ) ;
475
+ }
476
+ config:: DeprecationWarning :: BsDevDependencies => {
477
+ log_deprecated_config_field ( & package. name , "bs-dev-dependencies" , "dev-dependencies" ) ;
478
+ }
479
+ config:: DeprecationWarning :: BscFlags => {
480
+ log_deprecated_config_field ( & package. name , "bsc-flags" , "compiler-flags" ) ;
481
+ }
482
+ } ) ;
483
+ } ) ;
484
+ }
485
+
486
+ fn log_deprecated_config_field ( package_name : & str , field_name : & str , new_field_name : & str ) {
487
+ let warning = format ! (
488
+ "The field '{field_name}' found in the package config of '{package_name}' is deprecated and will be removed in a future version.\n \
489
+ Use '{new_field_name}' instead."
490
+ ) ;
491
+ println ! ( "\n {}" , style( warning) . yellow( ) ) ;
492
+ }
493
+
459
494
// write build.ninja files in the packages after a non-incremental build
460
495
// this is necessary to bust the editor tooling cache. The editor tooling
461
496
// is watching this file.
0 commit comments