From e3eafaf84b0f35e46dd9363c4615d7133c871326 Mon Sep 17 00:00:00 2001 From: Jaap Frolich Date: Tue, 18 Jul 2023 15:01:55 +0200 Subject: [PATCH 1/3] :zap: - Improve compile performance by removing redundant condition --- src/build.rs | 4 ++-- src/clean.rs | 15 +++------------ 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/build.rs b/src/build.rs index e4637b1..8849c28 100644 --- a/src/build.rs +++ b/src/build.rs @@ -1203,7 +1203,7 @@ pub fn build(filter: &Option, path: &str) -> Result, path: &str) -> Result 0 { if helpers::contains_ascii_characters(&compile_warnings) { println!("{}", &compile_warnings); diff --git a/src/clean.rs b/src/clean.rs index e7546f9..f614ce7 100644 --- a/src/clean.rs +++ b/src/clean.rs @@ -346,12 +346,7 @@ fn failed_to_parse(module: &Module) -> bool { } } -fn failed_to_compile(module: &Module, no_errors: bool) -> bool { - // also clean up dirty modules when the compile failed - if !no_errors && module.compile_dirty { - return true; - }; - +fn failed_to_compile(module: &Module) -> bool { match &module.source_type { SourceType::SourceFile(SourceFile { implementation: @@ -373,11 +368,7 @@ fn failed_to_compile(module: &Module, no_errors: bool) -> bool { } } -pub fn cleanup_after_build(build_state: &BuildState, no_errors: bool) { - // let failed_modules = all_modules - // .difference(&compiled_modules) - // .collect::>(); - +pub fn cleanup_after_build(build_state: &BuildState) { build_state .modules .par_iter() @@ -395,7 +386,7 @@ pub fn cleanup_after_build(build_state: &BuildState, no_errors: bool) { _ => (), } } - if failed_to_compile(module, no_errors) { + if failed_to_compile(module) { // only retain ast file if it compiled successfully, that's the only thing we check // if we see a AST file, we assume it compiled successfully, so we also need to clean // up the AST file if compile is not successful From 41923a1c49c551d9b258f5ae5777455a1408172f Mon Sep 17 00:00:00 2001 From: Jaap Frolich Date: Tue, 18 Jul 2023 15:27:29 +0200 Subject: [PATCH 2/3] :bug: - Fix warn-error --- src/build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/build.rs b/src/build.rs index 8849c28..f824bb6 100644 --- a/src/build.rs +++ b/src/build.rs @@ -874,7 +874,7 @@ pub fn compile_file( let warn_error = match warnings.error { Some(bsconfig::Error::Catchall(true)) => { - vec!["-warn-error A".to_string()] + vec!["-warn-error".to_string(), "A".to_string()] } Some(bsconfig::Error::Qualified(errors)) => { vec!["-warn-error".to_string(), errors.to_string()] From 52e16088001fc902dfc56ed9bb24ecf5c018c9d7 Mon Sep 17 00:00:00 2001 From: Jaap Frolich Date: Tue, 18 Jul 2023 15:30:21 +0200 Subject: [PATCH 3/3] :bug: - Warnings of root package should override deps --- src/build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/build.rs b/src/build.rs index f824bb6..9d6db38 100644 --- a/src/build.rs +++ b/src/build.rs @@ -862,7 +862,7 @@ pub fn compile_file( let jsx_mode_args = get_jsx_mode_args(&root_package); let uncurried_args = get_uncurried_args(version, &package, &root_package); - let warning_args: Vec = match package.bsconfig.warnings.to_owned() { + let warning_args: Vec = match root_package.bsconfig.warnings.to_owned() { None => vec![], Some(warnings) => { let warn_number = match warnings.number {