From f238405aea6df75886796338bdb9090f71f2f616 Mon Sep 17 00:00:00 2001 From: Christoph Knittel Date: Thu, 5 Sep 2024 08:37:53 +0200 Subject: [PATCH 1/2] Sync rewatch 1.0.9 --- rewatch/Cargo.lock | 2 +- rewatch/Cargo.toml | 2 +- rewatch/src/build.rs | 33 ++++++++++++++-- rewatch/src/build/clean.rs | 15 +++++--- rewatch/src/build/compile.rs | 8 ++-- rewatch/src/build/deps.rs | 3 +- rewatch/src/build/namespaces.rs | 2 +- rewatch/src/build/packages.rs | 6 +-- rewatch/src/build/parse.rs | 38 ++++++++++++++++++- rewatch/src/main.rs | 15 +++++++- rewatch/src/watcher.rs | 8 +++- rewatch/tests/compile.sh | 37 ++++++++++++------ rewatch/tests/snapshots/dependency-cycle.txt | 2 +- rewatch/tests/snapshots/remove-file.txt | 2 +- .../rename-file-internal-dep-namespace.txt | 24 ++++++++++++ .../snapshots/rename-file-internal-dep.txt | 24 ++++++++++++ .../snapshots/rename-file-with-interface.txt | 2 +- rewatch/tests/snapshots/rename-file.txt | 2 +- .../tests/snapshots/rename-interface-file.txt | 2 +- rewatch/tests/suffix.sh | 12 +++--- 20 files changed, 192 insertions(+), 47 deletions(-) create mode 100644 rewatch/tests/snapshots/rename-file-internal-dep-namespace.txt create mode 100644 rewatch/tests/snapshots/rename-file-internal-dep.txt diff --git a/rewatch/Cargo.lock b/rewatch/Cargo.lock index c07c072241..2bec9e740b 100644 --- a/rewatch/Cargo.lock +++ b/rewatch/Cargo.lock @@ -921,7 +921,7 @@ checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" [[package]] name = "rewatch" -version = "1.0.6" +version = "1.0.9" dependencies = [ "ahash", "blake3", diff --git a/rewatch/Cargo.toml b/rewatch/Cargo.toml index bcbdf1a87a..a17f55d39c 100644 --- a/rewatch/Cargo.toml +++ b/rewatch/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rewatch" -version = "1.0.6" +version = "1.0.9" edition = "2021" [dependencies] diff --git a/rewatch/src/build.rs b/rewatch/src/build.rs index 082bc6cf91..aece691c98 100644 --- a/rewatch/src/build.rs +++ b/rewatch/src/build.rs @@ -18,6 +18,7 @@ use console::style; use indicatif::{ProgressBar, ProgressStyle}; use serde::Serialize; use std::fmt; +use std::fs::File; use std::io::{stdout, Write}; use std::path::PathBuf; use std::time::{Duration, Instant}; @@ -52,7 +53,7 @@ pub struct CompilerArgs { pub parser_args: Vec, } -pub fn get_compiler_args(path: &str, rescript_version: Option) -> String { +pub fn get_compiler_args(path: &str, rescript_version: Option, bsc_path: Option) -> String { let filename = &helpers::get_abs_path(path); let package_root = helpers::get_abs_path( &helpers::get_nearest_bsconfig(&std::path::PathBuf::from(path)).expect("Couldn't find package root"), @@ -64,7 +65,10 @@ pub fn get_compiler_args(path: &str, rescript_version: Option) -> String let rescript_version = if let Some(rescript_version) = rescript_version { rescript_version } else { - let bsc_path = helpers::get_bsc(&package_root, workspace_root.to_owned()); + let bsc_path = match bsc_path { + Some(bsc_path) => bsc_path, + None => helpers::get_bsc(&package_root, workspace_root.to_owned()), + }; helpers::get_rescript_version(&bsc_path) }; // make PathBuf from package root and get the relative path for filename @@ -134,10 +138,14 @@ pub fn initialize_build( default_timing: Option, filter: &Option, path: &str, + bsc_path: Option, ) -> Result { let project_root = helpers::get_abs_path(path); let workspace_root = helpers::get_workspace_root(&project_root); - let bsc_path = helpers::get_bsc(&project_root, workspace_root.to_owned()); + let bsc_path = match bsc_path { + Some(bsc_path) => bsc_path, + None => helpers::get_bsc(&project_root, workspace_root.to_owned()), + }; let root_config_name = packages::get_package_name(&project_root); let rescript_version = helpers::get_rescript_version(&bsc_path); @@ -407,11 +415,26 @@ impl fmt::Display for BuildError { } } +pub fn write_build_ninja(build_state: &BuildState) { + // write build.ninja files in the packages after a non-incremental build + // this is necessary to bust the editor tooling cache. The editor tooling + // is watching this file. + // we don't need to do this in an incremental build because there are no file + // changes (deletes / additions) + for package in build_state.packages.values() { + // write empty file: + let mut f = File::create(std::path::Path::new(&package.get_bs_build_path()).join("build.ninja")) + .expect("Unable to write file"); + f.write_all(b"").expect("unable to write to ninja file"); + } +} + pub fn build( filter: &Option, path: &str, no_timing: bool, create_sourcedirs: bool, + bsc_path: Option, ) -> Result { let default_timing: Option = if no_timing { Some(std::time::Duration::new(0.0 as u64, 0.0 as u32)) @@ -420,7 +443,7 @@ pub fn build( }; let timing_total = Instant::now(); let mut build_state = - initialize_build(default_timing, filter, path).map_err(BuildError::InitializeBuild)?; + initialize_build(default_timing, filter, path, bsc_path).map_err(BuildError::InitializeBuild)?; match incremental_build(&mut build_state, default_timing, true, false, create_sourcedirs) { Ok(_) => { @@ -432,10 +455,12 @@ pub fn build( default_timing.unwrap_or(timing_total_elapsed).as_secs_f64() ); clean::cleanup_after_build(&build_state); + write_build_ninja(&build_state); Ok(build_state) } Err(e) => { clean::cleanup_after_build(&build_state); + write_build_ninja(&build_state); Err(BuildError::IncrementalBuild(e)) } } diff --git a/rewatch/src/build/clean.rs b/rewatch/src/build/clean.rs index e4bde12a00..b55f2ee20f 100644 --- a/rewatch/src/build/clean.rs +++ b/rewatch/src/build/clean.rs @@ -51,7 +51,7 @@ fn remove_compile_asset(package: &packages::Package, source_file: &str, extensio pub fn remove_compile_assets(package: &packages::Package, source_file: &str) { // optimization - // only issue cmti if htere is an interfacce file + // only issue cmti if there is an interfacce file for extension in &["cmj", "cmi", "cmt", "cmti"] { remove_compile_asset(package, source_file, extension); } @@ -237,10 +237,11 @@ pub fn cleanup_previous_build( .map(|module_name| { // if the module is a namespace, we need to mark the whole namespace as dirty when a module has been deleted if let Some(namespace) = helpers::get_namespace_from_module_name(module_name) { - return namespace; + return vec![namespace, module_name.to_string()]; } - module_name.to_string() + vec![module_name.to_string()] }) + .flatten() .collect::>(); build_state.deleted_modules = deleted_module_names; @@ -318,12 +319,16 @@ pub fn cleanup_after_build(build_state: &BuildState) { }); } -pub fn clean(path: &str) { +pub fn clean(path: &str, bsc_path: Option) { let project_root = helpers::get_abs_path(path); let workspace_root = helpers::get_workspace_root(&project_root); let packages = packages::make(&None, &project_root, &workspace_root); let root_config_name = packages::get_package_name(&project_root); - let bsc_path = helpers::get_bsc(&project_root, workspace_root.to_owned()); + let bsc_path = match bsc_path { + Some(bsc_path) => bsc_path, + None => helpers::get_bsc(&project_root, workspace_root.to_owned()), + }; + let rescript_version = helpers::get_rescript_version(&bsc_path); let timing_clean_compiler_assets = Instant::now(); diff --git a/rewatch/src/build/compile.rs b/rewatch/src/build/compile.rs index cdf16953e5..ea52e6a3f3 100644 --- a/rewatch/src/build/compile.rs +++ b/rewatch/src/build/compile.rs @@ -46,10 +46,10 @@ pub fn compile( // for sure clean modules -- after checking the hash of the cmi let mut clean_modules = AHashSet::::new(); - // TODO: calculate the real dirty modules from the orginal dirty modules in each iteration + // TODO: calculate the real dirty modules from the original dirty modules in each iteration // taken into account the modules that we know are clean, so they don't propagate through the // deps graph - // create a hashset of all clean modules form the file-hashes + // create a hashset of all clean modules from the file-hashes let mut loop_count = 0; let mut files_total_count = compiled_modules.len(); let mut files_current_loop_count; @@ -575,7 +575,7 @@ fn compile_file( // because editor tooling doesn't support namespace entries yet // we just remove the @ for now. This makes sure the editor support // doesn't break - .join(module_name.to_owned().replace('@', "") + ".cmi"), + .join(module_name.to_owned() + ".cmi"), ); let _ = std::fs::copy( build_path_abs.to_string() + "/" + &module_name + ".cmj", @@ -590,7 +590,7 @@ fn compile_file( // because editor tooling doesn't support namespace entries yet // we just remove the @ for now. This makes sure the editor support // doesn't break - .join(module_name.to_owned().replace('@', "") + ".cmt"), + .join(module_name.to_owned() + ".cmt"), ); } else { let _ = std::fs::copy( diff --git a/rewatch/src/build/deps.rs b/rewatch/src/build/deps.rs index dad31311b1..5bd19395a8 100644 --- a/rewatch/src/build/deps.rs +++ b/rewatch/src/build/deps.rs @@ -44,7 +44,8 @@ fn get_dep_modules( _ => dep_first, }; let namespaced_name = dep.to_owned() + "-" + namespace; - if package_modules.contains(&namespaced_name) { + if package_modules.contains(&namespaced_name) || valid_modules.contains(&namespaced_name) + { namespaced_name } else { dep.to_string() diff --git a/rewatch/src/build/namespaces.rs b/rewatch/src/build/namespaces.rs index 394b582972..39b943d848 100644 --- a/rewatch/src/build/namespaces.rs +++ b/rewatch/src/build/namespaces.rs @@ -32,7 +32,7 @@ pub fn gen_mlmap( let path = build_path_abs.to_string() + "/" + namespace + ".mlmap"; let mut file = File::create(&path).expect("Unable to create mlmap"); - file.write_all(b"randjbuildsystem\n" as &[u8]) + file.write_all(b"randjbuildsystem\n") .expect("Unable to write mlmap"); let mut modules = Vec::from_iter(depending_modules.to_owned()); diff --git a/rewatch/src/build/packages.rs b/rewatch/src/build/packages.rs index 171bc0cae9..b5b3ec10b8 100644 --- a/rewatch/src/build/packages.rs +++ b/rewatch/src/build/packages.rs @@ -180,7 +180,7 @@ pub fn read_folders( /// Given a projects' root folder and a `bsconfig::Source`, this recursively creates all the /// sources in a flat list. In the process, it removes the children, as they are being resolved /// because of the recursiveness. So you get a flat list of files back, retaining the type_ and -/// wether it needs to recurse into all structures +/// whether it needs to recurse into all structures fn get_source_dirs(source: bsconfig::Source, sub_path: Option) -> AHashSet { let mut source_folders: AHashSet = AHashSet::new(); @@ -276,7 +276,7 @@ pub fn read_dependency( /// # Make Package -/// Given a bsconfig, reqursively finds all dependencies. +/// Given a bsconfig, recursively finds all dependencies. /// 1. It starts with registering dependencies and /// prevents the operation for the ones which are already /// registerd for the parent packages. Especially relevant for peerDependencies. @@ -430,7 +430,7 @@ fn read_packages(project_root: &str, workspace_root: Option) -> AHashMap /// data from the config and pushes it forwards. Another thing is the 'type_', some files / folders /// can be marked with the type 'dev'. Which means that they may not be around in the distributed /// NPM package. The file reader allows for this, just warns when this happens. -/// TODO -> Check wether we actually need the `fs::Metadata` +/// TODO -> Check whether we actually need the `fs::Metadata` pub fn get_source_files( package_dir: &Path, filter: &Option, diff --git a/rewatch/src/build/parse.rs b/rewatch/src/build/parse.rs index 4409d65c34..678a4a353c 100644 --- a/rewatch/src/build/parse.rs +++ b/rewatch/src/build/parse.rs @@ -203,6 +203,29 @@ pub fn generate_asts( namespaces::compile_mlmap(package, module_name, &build_state.bsc_path); let mlmap_hash_after = helpers::compute_file_hash(&compile_path); + let suffix = package + .namespace + .to_suffix() + .expect("namespace should be set for mlmap module"); + // copy the mlmap to the bs build path for editor tooling + let base_build_path = package.get_build_path() + "/" + &suffix; + let base_bs_build_path = package.get_bs_build_path() + "/" + &suffix; + let _ = std::fs::copy( + base_build_path.to_string() + ".cmi", + base_bs_build_path.to_string() + ".cmi", + ); + let _ = std::fs::copy( + base_build_path.to_string() + ".cmt", + base_bs_build_path.to_string() + ".cmt", + ); + let _ = std::fs::copy( + base_build_path.to_string() + ".cmj", + base_bs_build_path.to_string() + ".cmj", + ); + let _ = std::fs::copy( + base_build_path.to_string() + ".mlmap", + base_bs_build_path.to_string() + ".mlmap", + ); match (mlmap_hash, mlmap_hash_after) { (Some(digest), Some(digest_after)) => !digest.eq(&digest_after), _ => true, @@ -299,7 +322,7 @@ fn generate_ast( ); /* Create .ast */ - if let Some(res_to_ast) = Some( + let result = if let Some(res_to_ast) = Some( Command::new(bsc_path) .current_dir(&build_path_abs) .args(parser_args) @@ -322,7 +345,20 @@ fn generate_ast( "Could not find canonicalize_string_path for file {} in package {}", filename, package.name )) + }; + match &result { + Ok((ast_path, _)) => { + let dir = std::path::Path::new(filename).parent().unwrap(); + let _ = std::fs::copy( + build_path_abs.to_string() + "/" + ast_path, + std::path::Path::new(&package.get_bs_build_path()) + .join(dir) + .join(ast_path), + ); + } + Err(_) => (), } + result } fn path_to_ast_extension(path: &Path) -> &str { diff --git a/rewatch/src/main.rs b/rewatch/src/main.rs index 9a5b98ef6f..3624035212 100644 --- a/rewatch/src/main.rs +++ b/rewatch/src/main.rs @@ -45,11 +45,18 @@ struct Args { #[arg(short, long)] create_sourcedirs: Option, + /// This prints the compiler arguments. It expects the path to a rescript.json file. + /// This also requires --bsc-path and --rescript-version to be present #[arg(long)] compiler_args: Option, + /// To be used in conjunction with compiler_args #[arg(long)] rescript_version: Option, + + /// A custom path to bsc + #[arg(long)] + bsc_path: Option, } fn main() { @@ -65,7 +72,10 @@ fn main() { match args.compiler_args { None => (), Some(path) => { - println!("{}", build::get_compiler_args(&path, args.rescript_version)); + println!( + "{}", + build::get_compiler_args(&path, args.rescript_version, args.bsc_path) + ); std::process::exit(0); } } @@ -76,13 +86,14 @@ fn main() { std::process::exit(1) } lock::Lock::Aquired(_) => match command { - Command::Clean => build::clean::clean(&folder), + Command::Clean => build::clean::clean(&folder, args.bsc_path), Command::Build => { match build::build( &filter, &folder, args.no_timing.unwrap_or(false), args.create_sourcedirs.unwrap_or(false), + args.bsc_path, ) { Err(e) => { eprintln!("Error Building: {e}"); diff --git a/rewatch/src/watcher.rs b/rewatch/src/watcher.rs index b5685d8361..74251e5045 100644 --- a/rewatch/src/watcher.rs +++ b/rewatch/src/watcher.rs @@ -53,7 +53,7 @@ async fn async_watch( after_build: Option, create_sourcedirs: bool, ) -> notify::Result<()> { - let mut build_state = build::initialize_build(None, filter, path).expect("Can't initialize build"); + let mut build_state = build::initialize_build(None, filter, path, None).expect("Can't initialize build"); let mut needs_compile_type = CompileType::Incremental; // create a mutex to capture if ctrl-c was pressed let ctrlc_pressed = Arc::new(Mutex::new(false)); @@ -205,12 +205,16 @@ async fn async_watch( } CompileType::Full => { let timing_total = Instant::now(); - build_state = build::initialize_build(None, filter, path).expect("Can't initialize build"); + build_state = + build::initialize_build(None, filter, path, None).expect("Can't initialize build"); let _ = build::incremental_build(&mut build_state, None, initial_build, false, create_sourcedirs); if let Some(a) = after_build.clone() { cmd::run(a) } + + build::write_build_ninja(&build_state); + let timing_total_elapsed = timing_total.elapsed(); println!( "\n{}{}Finished compilation in {:.2}s\n", diff --git a/rewatch/tests/compile.sh b/rewatch/tests/compile.sh index 2b7173ee57..2697d274f4 100755 --- a/rewatch/tests/compile.sh +++ b/rewatch/tests/compile.sh @@ -8,24 +8,24 @@ bold "Test: It should compile" if rewatch clean &> /dev/null; then success "Repo Cleaned" -else +else error "Error Cleaning Repo" exit 1 fi -if rewatch &> /dev/null; +if rewatch &> /dev/null; then success "Repo Built" -else +else error "Error Building Repo" exit 1 fi -if git diff --exit-code ./; +if git diff --exit-code ./; then success "Testrepo has no changes" -else +else error "Build has changed" exit 1 fi @@ -35,6 +35,21 @@ node ./packages/main/src/Main.mjs > ./packages/main/src/output.txt mv ./packages/main/src/Main.res ./packages/main/src/Main2.res rewatch build --no-timing=true &> ../tests/snapshots/rename-file.txt mv ./packages/main/src/Main2.res ./packages/main/src/Main.res + +# Rename a file with a dependent - this should trigger an error +mv ./packages/main/src/InternalDep.res ./packages/main/src/InternalDep2.res +rewatch build --no-timing=true &> ../tests/snapshots/rename-file-internal-dep.txt +# replace the absolute path so the snapshot is the same on all machines +replace "s/$(pwd | sed "s/\//\\\\\//g")//g" ../tests/snapshots/rename-file-internal-dep.txt +mv ./packages/main/src/InternalDep2.res ./packages/main/src/InternalDep.res + +# Rename a file with a dependent in a namespaced package - this should trigger an error (regression) +mv ./packages/new-namespace/src/Other_module.res ./packages/new-namespace/src/Other_module2.res +rewatch build --no-timing=true &> ../tests/snapshots/rename-file-internal-dep-namespace.txt +# replace the absolute path so the snapshot is the same on all machines +replace "s/$(pwd | sed "s/\//\\\\\//g")//g" ../tests/snapshots/rename-file-internal-dep-namespace.txt +mv ./packages/new-namespace/src/Other_module2.res ./packages/new-namespace/src/Other_module.res + rewatch build &> /dev/null mv ./packages/main/src/ModuleWithInterface.resi ./packages/main/src/ModuleWithInterface2.resi rewatch build --no-timing=true &> ../tests/snapshots/rename-interface-file.txt @@ -66,10 +81,10 @@ git checkout -- packages/new-namespace/src/NS_alias.res rewatch build &> /dev/null # make sure we don't have changes in the test repo -if git diff --exit-code ./; +if git diff --exit-code ./; then success "Output is correct" -else +else error "Output is incorrect" exit 1 fi @@ -81,7 +96,7 @@ new_files=$(git ls-files --others --exclude-standard ./) if [[ $new_files = "" ]]; then success "No new files created" -else +else error "โŒ - New files created" printf "${new_files}\n" exit 1 @@ -89,10 +104,10 @@ fi # see if the snapshots have changed changed_snapshots=$(git ls-files --modified ../tests/snapshots) -if git diff --exit-code ../tests/snapshots &> /dev/null; +if git diff --exit-code ../tests/snapshots &> /dev/null; then success "Snapshots are correct" -else +else error "Snapshots are incorrect:" # print filenames in the snapshot dir call bold with the filename # and then cat their contents @@ -105,4 +120,4 @@ else done exit 1 -fi \ No newline at end of file +fi diff --git a/rewatch/tests/snapshots/dependency-cycle.txt b/rewatch/tests/snapshots/dependency-cycle.txt index 10c4e55922..ff0f93b536 100644 --- a/rewatch/tests/snapshots/dependency-cycle.txt +++ b/rewatch/tests/snapshots/dependency-cycle.txt @@ -1,7 +1,7 @@ [1/7]๐Ÿ“ฆ Building package tree... [1/7] ๐Ÿ“ฆ Built package tree in 0.00s [2/7] ๐Ÿ•ต๏ธ Finding source files... [2/7] ๐Ÿ•ต๏ธ Found source files in 0.00s [3/7] ๐Ÿ“ Reading compile state... [3/7] ๐Ÿ“ Read compile state 0.00s -[4/7] ๐Ÿงน Cleaning up previous build... [4/7] ๐Ÿงน Cleaned 0/10 0.00s +[4/7] ๐Ÿงน Cleaning up previous build... [4/7] ๐Ÿงน Cleaned 0/11 0.00s  [5/7] ๐Ÿงฑ Parsed 1 source files in 0.00s  [6/7] ๏ธ๐ŸŒด Collected deps in 0.00s  [7/7] ๏ธ๐Ÿ›‘ Compiled 0 modules in 0.00s diff --git a/rewatch/tests/snapshots/remove-file.txt b/rewatch/tests/snapshots/remove-file.txt index 228ef79c00..08447639b3 100644 --- a/rewatch/tests/snapshots/remove-file.txt +++ b/rewatch/tests/snapshots/remove-file.txt @@ -1,7 +1,7 @@ [1/7]๐Ÿ“ฆ Building package tree... [1/7] ๐Ÿ“ฆ Built package tree in 0.00s [2/7] ๐Ÿ•ต๏ธ Finding source files... [2/7] ๐Ÿ•ต๏ธ Found source files in 0.00s [3/7] ๐Ÿ“ Reading compile state... [3/7] ๐Ÿ“ Read compile state 0.00s -[4/7] ๐Ÿงน Cleaning up previous build... [4/7] ๐Ÿงน Cleaned 1/10 0.00s +[4/7] ๐Ÿงน Cleaning up previous build... [4/7] ๐Ÿงน Cleaned 1/11 0.00s  [5/7] ๐Ÿงฑ Parsed 0 source files in 0.00s  [6/7] ๏ธ๐ŸŒด Collected deps in 0.00s  [7/7] ๏ธ๐Ÿ›‘ Compiled 1 modules in 0.00s diff --git a/rewatch/tests/snapshots/rename-file-internal-dep-namespace.txt b/rewatch/tests/snapshots/rename-file-internal-dep-namespace.txt new file mode 100644 index 0000000000..5230dcfbe5 --- /dev/null +++ b/rewatch/tests/snapshots/rename-file-internal-dep-namespace.txt @@ -0,0 +1,24 @@ +[1/7]๐Ÿ“ฆ Building package tree... [1/7] ๐Ÿ“ฆ Built package tree in 0.00s +[2/7] ๐Ÿ•ต๏ธ Finding source files... [2/7] ๐Ÿ•ต๏ธ Found source files in 0.00s +[3/7] ๐Ÿ“ Reading compile state... [3/7] ๐Ÿ“ Read compile state 0.00s +[4/7] ๐Ÿงน Cleaning up previous build... [4/7] ๐Ÿงน Cleaned 2/11 0.00s + [5/7] ๐Ÿงฑ Parsed 2 source files in 0.00s + [6/7] ๏ธ๐ŸŒด Collected deps in 0.00s + [7/7] ๏ธ๐Ÿ›‘ Compiled 3 modules in 0.00s + + We've found a bug for you! + /packages/new-namespace/src/NS_alias.res:2:1-16 + + 1 โ”‚ let hello_world = () => "Hello world" + 2 โ”‚ Other_module.bla() + 3 โ”‚ + + The module or file Other_module can't be found. + - If it's a third-party dependency: + - Did you add it to the "bs-dependencies" or "bs-dev-dependencies" in bsconfig.json? + - Did you include the file's directory to the "sources" in bsconfig.json? + + + Hint: Did you mean Other_module2? + +Error Building:  ๏ธ๐Ÿ›‘ Error Running Incremental Build:  ๏ธ๐Ÿ›‘ Failed to Compile. See Errors Above diff --git a/rewatch/tests/snapshots/rename-file-internal-dep.txt b/rewatch/tests/snapshots/rename-file-internal-dep.txt new file mode 100644 index 0000000000..c22caa4230 --- /dev/null +++ b/rewatch/tests/snapshots/rename-file-internal-dep.txt @@ -0,0 +1,24 @@ +[1/7]๐Ÿ“ฆ Building package tree... [1/7] ๐Ÿ“ฆ Built package tree in 0.00s +[2/7] ๐Ÿ•ต๏ธ Finding source files... [2/7] ๐Ÿ•ต๏ธ Found source files in 0.00s +[3/7] ๐Ÿ“ Reading compile state... [3/7] ๐Ÿ“ Read compile state 0.00s +[4/7] ๐Ÿงน Cleaning up previous build... [4/7] ๐Ÿงน Cleaned 2/11 0.00s + [5/7] ๐Ÿงฑ Parsed 2 source files in 0.00s + [6/7] ๏ธ๐ŸŒด Collected deps in 0.00s + [7/7] ๏ธ๐Ÿ›‘ Compiled 2 modules in 0.00s + + We've found a bug for you! + /packages/main/src/Main.res:4:8-24 + + 2 โ”‚ Dep01.log() + 3 โ”‚ + 4 โ”‚ Js.log(InternalDep.value) + 5 โ”‚ + 6 โ”‚ module Array = Belt.Array + + The module or file InternalDep can't be found. + - If it's a third-party dependency: + - Did you add it to the "bs-dependencies" or "bs-dev-dependencies" in bsconfig.json? + - Did you include the file's directory to the "sources" in bsconfig.json? + + +Error Building:  ๏ธ๐Ÿ›‘ Error Running Incremental Build:  ๏ธ๐Ÿ›‘ Failed to Compile. See Errors Above diff --git a/rewatch/tests/snapshots/rename-file-with-interface.txt b/rewatch/tests/snapshots/rename-file-with-interface.txt index e16ce55028..30534637f4 100644 --- a/rewatch/tests/snapshots/rename-file-with-interface.txt +++ b/rewatch/tests/snapshots/rename-file-with-interface.txt @@ -2,7 +2,7 @@ [2/7] ๐Ÿ•ต๏ธ Finding source files... Warning: No implementation file found for interface file (skipping): src/ModuleWithInterface.resi  [2/7] ๐Ÿ•ต๏ธ Found source files in 0.00s [3/7] ๐Ÿ“ Reading compile state... [3/7] ๐Ÿ“ Read compile state 0.00s -[4/7] ๐Ÿงน Cleaning up previous build... [4/7] ๐Ÿงน Cleaned 2/10 0.00s +[4/7] ๐Ÿงน Cleaning up previous build... [4/7] ๐Ÿงน Cleaned 2/11 0.00s  [5/7] ๐Ÿงฑ Parsed 1 source files in 0.00s  [6/7] ๏ธ๐ŸŒด Collected deps in 0.00s  [7/7] ๐Ÿคบ ๏ธCompiled 1 modules in 0.00s diff --git a/rewatch/tests/snapshots/rename-file.txt b/rewatch/tests/snapshots/rename-file.txt index 68d3ebf198..43550cc620 100644 --- a/rewatch/tests/snapshots/rename-file.txt +++ b/rewatch/tests/snapshots/rename-file.txt @@ -1,7 +1,7 @@ [1/7]๐Ÿ“ฆ Building package tree... [1/7] ๐Ÿ“ฆ Built package tree in 0.00s [2/7] ๐Ÿ•ต๏ธ Finding source files... [2/7] ๐Ÿ•ต๏ธ Found source files in 0.00s [3/7] ๐Ÿ“ Reading compile state... [3/7] ๐Ÿ“ Read compile state 0.00s -[4/7] ๐Ÿงน Cleaning up previous build... [4/7] ๐Ÿงน Cleaned 1/10 0.00s +[4/7] ๐Ÿงน Cleaning up previous build... [4/7] ๐Ÿงน Cleaned 1/11 0.00s  [5/7] ๐Ÿงฑ Parsed 1 source files in 0.00s  [6/7] ๏ธ๐ŸŒด Collected deps in 0.00s  [7/7] ๐Ÿคบ ๏ธCompiled 1 modules in 0.00s diff --git a/rewatch/tests/snapshots/rename-interface-file.txt b/rewatch/tests/snapshots/rename-interface-file.txt index d9805848a0..a46d80f66d 100644 --- a/rewatch/tests/snapshots/rename-interface-file.txt +++ b/rewatch/tests/snapshots/rename-interface-file.txt @@ -2,7 +2,7 @@ [2/7] ๐Ÿ•ต๏ธ Finding source files... Warning: No implementation file found for interface file (skipping): src/ModuleWithInterface2.resi  [2/7] ๐Ÿ•ต๏ธ Found source files in 0.00s [3/7] ๐Ÿ“ Reading compile state... [3/7] ๐Ÿ“ Read compile state 0.00s -[4/7] ๐Ÿงน Cleaning up previous build... [4/7] ๐Ÿงน Cleaned 1/10 0.00s +[4/7] ๐Ÿงน Cleaning up previous build... [4/7] ๐Ÿงน Cleaned 1/11 0.00s  [5/7] ๐Ÿงฑ Parsed 1 source files in 0.00s  [6/7] ๏ธ๐ŸŒด Collected deps in 0.00s  [7/7] ๐Ÿคบ ๏ธCompiled 1 modules in 0.00s diff --git a/rewatch/tests/suffix.sh b/rewatch/tests/suffix.sh index a7fe97875e..6790d99fb5 100755 --- a/rewatch/tests/suffix.sh +++ b/rewatch/tests/suffix.sh @@ -8,7 +8,7 @@ sleep 1 if rewatch clean &> /dev/null; then success "Repo Cleaned" -else +else error "Error Cleaning Repo" exit 1 fi @@ -19,7 +19,7 @@ replace "s/.mjs/.res.js/g" bsconfig.json if rewatch build &> /dev/null; then success "Repo Built" -else +else error "Error building repo" exit 1 fi @@ -27,10 +27,10 @@ fi # Count files with new extension file_count=$(find . -name *.res.js | wc -l) -if [ "$file_count" -eq 9 ]; +if [ "$file_count" -eq 10 ]; then success "Found files with correct suffix" -else +else error "Suffix not correctly used" exit 1 fi @@ -38,7 +38,7 @@ fi if rewatch clean &> /dev/null; then success "Repo Cleaned" -else +else error "Error Cleaning Repo" exit 1 fi @@ -50,7 +50,7 @@ replace "s/.res.js/.mjs/g" bsconfig.json if rewatch build &> /dev/null; then success "Repo Built" -else +else error "Error building repo" exit 1 fi From 37f3e247e91cda01ea5c499f2c87eb0efc8e3f2c Mon Sep 17 00:00:00 2001 From: Christoph Knittel Date: Thu, 5 Sep 2024 08:59:41 +0200 Subject: [PATCH 2/2] CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d95e14360..f6ee32d6c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ - Removed empty `default` case from `switch` statement in the generated code - Optimised the Type Extension runtime code and removed trailing `/1` from `RE_EXN_ID` https://github.com/rescript-lang/rescript-compiler/pull/6958 - Compact output for anonymous functions. https://github.com/rescript-lang/rescript-compiler/pull/6945 +- Rewatch 1.0.9. https://github.com/rescript-lang/rescript-compiler/pull/7010 #### :bug: Bug Fix - Fix issue where long layout break added a trailing comma in partial application `...`. https://github.com/rescript-lang/rescript-compiler/pull/6949