diff --git a/src/build.rs b/src/build.rs index 3122b9a..4461225 100644 --- a/src/build.rs +++ b/src/build.rs @@ -204,13 +204,14 @@ pub fn initialize_build<'a>( total_cleanup, default_timing.unwrap_or(timing_cleanup_elapsed).as_secs_f64() ); - // repair broken state - mark_modules_with_expired_deps_dirty(&mut build_state); - mark_modules_with_deleted_deps_dirty(&mut build_state); Ok(build_state) } -pub fn incremental_build(build_state: &mut BuildState, default_timing: Option) -> Result<(), ()> { +pub fn incremental_build( + build_state: &mut BuildState, + default_timing: Option, + initial_build: bool, +) -> Result<(), ()> { logs::initialize(&build_state.packages); let num_dirty_modules = build_state.modules.values().filter(|m| is_dirty(m)).count() as u64; @@ -265,6 +266,12 @@ pub fn incremental_build(build_state: &mut BuildState, default_timing: Option, path: &str, no_timing: bool) -> Resu }; let timing_total = Instant::now(); let mut build_state = initialize_build(default_timing, filter, path)?; - match incremental_build(&mut build_state, default_timing) { + match incremental_build(&mut build_state, default_timing, true) { Ok(_) => { let timing_total_elapsed = timing_total.elapsed(); println!( diff --git a/src/watcher.rs b/src/watcher.rs index dd3f5e6..2294c1a 100644 --- a/src/watcher.rs +++ b/src/watcher.rs @@ -30,6 +30,7 @@ async fn async_watch( // create a mutex to capture if ctrl-c was pressed let ctrlc_pressed = Arc::new(Mutex::new(false)); let ctrlc_pressed_clone = Arc::clone(&ctrlc_pressed); + let mut initial_build = true; ctrlc::set_handler(move || { let pressed = Arc::clone(&ctrlc_pressed); @@ -158,7 +159,7 @@ async fn async_watch( match needs_compile_type { CompileType::Incremental => { let timing_total = Instant::now(); - let _ = build::incremental_build(&mut build_state, None); + let _ = build::incremental_build(&mut build_state, None, initial_build); after_build.clone().map(|command| cmd::run(command)); let timing_total_elapsed = timing_total.elapsed(); println!( @@ -168,11 +169,12 @@ async fn async_watch( timing_total_elapsed.as_secs_f64() ); needs_compile_type = CompileType::None; + initial_build = false; } CompileType::Full => { let timing_total = Instant::now(); build_state = build::initialize_build(None, filter, path).expect("Can't initialize build"); - let _ = build::incremental_build(&mut build_state, None); + let _ = build::incremental_build(&mut build_state, None, initial_build); after_build.clone().map(|command| cmd::run(command)); let timing_total_elapsed = timing_total.elapsed(); println!( @@ -182,6 +184,7 @@ async fn async_watch( timing_total_elapsed.as_secs_f64() ); needs_compile_type = CompileType::None; + initial_build = false; } CompileType::None => { // We want to sleep for a little while so the CPU can schedule other work. That way we end