@@ -13,7 +13,7 @@ use self::parse::parser_args;
1313use crate :: build:: compile:: { mark_modules_with_deleted_deps_dirty, mark_modules_with_expired_deps_dirty} ;
1414use crate :: helpers:: emojis:: * ;
1515use crate :: helpers:: { self , get_workspace_root} ;
16- use crate :: sourcedirs;
16+ use crate :: { config , sourcedirs} ;
1717use anyhow:: { Result , anyhow} ;
1818use build_types:: * ;
1919use console:: style;
@@ -58,7 +58,7 @@ pub struct CompilerArgs {
5858pub fn get_compiler_args ( path : & Path ) -> Result < String > {
5959 let filename = & helpers:: get_abs_path ( path) ;
6060 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" ) ) ;
6262 let workspace_root = get_workspace_root ( & package_root) . map ( |p| helpers:: get_abs_path ( & p) ) ;
6363 let root_rescript_config =
6464 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> {
7777 let ( ast_path, parser_args) = parser_args (
7878 & rescript_config,
7979 & root_rescript_config,
80- & relative_filename,
80+ relative_filename,
8181 & workspace_root,
8282 workspace_root. as_ref ( ) . unwrap_or ( & package_root) ,
8383 & contents,
@@ -94,7 +94,7 @@ pub fn get_compiler_args(path: &Path) -> Result<String> {
9494 & rescript_config,
9595 & root_rescript_config,
9696 & ast_path,
97- & relative_filename,
97+ relative_filename,
9898 is_interface,
9999 has_interface,
100100 & package_root,
@@ -216,7 +216,7 @@ pub fn initialize_build(
216216
217217 if show_progress {
218218 if snapshot_output {
219- println ! ( "Cleaned {}/{}" , diff_cleanup , total_cleanup )
219+ println ! ( "Cleaned {diff_cleanup }/{total_cleanup}" )
220220 } else {
221221 println ! (
222222 "{}{} {}Cleaned {}/{} {:.2}s" ,
@@ -234,7 +234,7 @@ pub fn initialize_build(
234234}
235235
236236fn format_step ( current : usize , total : usize ) -> console:: StyledObject < String > {
237- style ( format ! ( "[{}/{}]" , current , total ) ) . bold ( ) . dim ( )
237+ style ( format ! ( "[{current }/{total }]" ) ) . bold ( ) . dim ( )
238238}
239239
240240#[ derive( Debug , Clone ) ]
@@ -254,23 +254,23 @@ impl fmt::Display for IncrementalBuildError {
254254 match & self . kind {
255255 IncrementalBuildErrorKind :: SourceFileParseError => {
256256 if self . snapshot_output {
257- write ! ( f, "{} Could not parse Source Files" , LINE_CLEAR , )
257+ write ! ( f, "{LINE_CLEAR } Could not parse Source Files" , )
258258 } else {
259- write ! ( f, "{} {}Could not parse Source Files" , LINE_CLEAR , CROSS , )
259+ write ! ( f, "{LINE_CLEAR } {CROSS }Could not parse Source Files" , )
260260 }
261261 }
262262 IncrementalBuildErrorKind :: CompileError ( Some ( e) ) => {
263263 if self . snapshot_output {
264- write ! ( f, "{} Failed to Compile. Error: {e}" , LINE_CLEAR , )
264+ write ! ( f, "{LINE_CLEAR } Failed to Compile. Error: {e}" , )
265265 } else {
266- write ! ( f, "{} {}Failed to Compile. Error: {e}" , LINE_CLEAR , CROSS , )
266+ write ! ( f, "{LINE_CLEAR } {CROSS }Failed to Compile. Error: {e}" , )
267267 }
268268 }
269269 IncrementalBuildErrorKind :: CompileError ( None ) => {
270270 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" , )
272272 } 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" , )
274274 }
275275 }
276276 }
@@ -280,7 +280,7 @@ impl fmt::Display for IncrementalBuildError {
280280pub fn incremental_build (
281281 build_state : & mut BuildState ,
282282 default_timing : Option < Duration > ,
283- _initial_build : bool ,
283+ initial_build : bool ,
284284 show_progress : bool ,
285285 only_incremental : bool ,
286286 create_sourcedirs : bool ,
@@ -312,7 +312,7 @@ pub fn incremental_build(
312312 Ok ( _ast) => {
313313 if show_progress {
314314 if snapshot_output {
315- println ! ( "Parsed {} source files" , num_dirty_modules )
315+ println ! ( "Parsed {num_dirty_modules } source files" )
316316 } else {
317317 println ! (
318318 "{}{} {}Parsed {} source files in {:.2}s" ,
@@ -370,7 +370,7 @@ pub fn incremental_build(
370370 if log_enabled ! ( log:: Level :: Trace ) {
371371 for ( module_name, module) in build_state. modules . iter ( ) {
372372 if module. compile_dirty {
373- println ! ( "compile dirty: {}" , module_name ) ;
373+ println ! ( "compile dirty: {module_name}" ) ;
374374 }
375375 }
376376 } ;
@@ -411,7 +411,7 @@ pub fn incremental_build(
411411 if !compile_errors. is_empty ( ) {
412412 if show_progress {
413413 if snapshot_output {
414- println ! ( "Compiled {} modules" , num_compiled_modules )
414+ println ! ( "Compiled {num_compiled_modules } modules" )
415415 } else {
416416 println ! (
417417 "{}{} {}Compiled {} modules in {:.2}s" ,
@@ -426,6 +426,9 @@ pub fn incremental_build(
426426 if helpers:: contains_ascii_characters ( & compile_warnings) {
427427 println ! ( "{}" , & compile_warnings) ;
428428 }
429+ if initial_build {
430+ log_deprecations ( build_state) ;
431+ }
429432 if helpers:: contains_ascii_characters ( & compile_errors) {
430433 println ! ( "{}" , & compile_errors) ;
431434 }
@@ -436,7 +439,7 @@ pub fn incremental_build(
436439 } else {
437440 if show_progress {
438441 if snapshot_output {
439- println ! ( "Compiled {} modules" , num_compiled_modules )
442+ println ! ( "Compiled {num_compiled_modules } modules" )
440443 } else {
441444 println ! (
442445 "{}{} {}Compiled {} modules in {:.2}s" ,
@@ -452,10 +455,42 @@ pub fn incremental_build(
452455 if helpers:: contains_ascii_characters ( & compile_warnings) {
453456 println ! ( "{}" , & compile_warnings) ;
454457 }
458+ if initial_build {
459+ log_deprecations ( build_state) ;
460+ }
461+
455462 Ok ( ( ) )
456463 }
457464}
458465
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+
459494// write build.ninja files in the packages after a non-incremental build
460495// this is necessary to bust the editor tooling cache. The editor tooling
461496// is watching this file.
0 commit comments