| 3323 | } |
| 3324 | |
| 3325 | bool |
| 3326 | clean_during_match (tracer& trace, action a, const target& t) |
| 3327 | { |
| 3328 | // Let's keep this as close to update_during_match() semantically as |
| 3329 | // possible until we see a clear reason to deviate. |
| 3330 | |
| 3331 | // We have a problem with fsdir{}: if the directory is not empty because |
| 3332 | // there are other targets that depend on it and we execute it here and |
| 3333 | // now, it will not remove the directory (because it's not yet empty) but |
| 3334 | // will cause the target to be in the executed state, which means that |
| 3335 | // when other targets try to execute it, it will be a noop and the |
| 3336 | // directory will be left behind. |
| 3337 | |
| 3338 | assert (a == perform_clean_id && !t.is_a<fsdir> ()); |
| 3339 | |
| 3340 | target_state os (t.matched_state (a)); |
| 3341 | |
| 3342 | if (os == target_state::unchanged) |
| 3343 | return false; |
| 3344 | else |
| 3345 | { |
| 3346 | target_state ns; |
| 3347 | if (os != target_state::changed) |
| 3348 | { |
| 3349 | phase_switch ps (t.ctx, run_phase::execute); |
| 3350 | ns = execute_direct_sync (a, t); |
| 3351 | } |
| 3352 | else |
| 3353 | ns = os; |
| 3354 | |
| 3355 | if (ns != os && ns != target_state::unchanged) |
| 3356 | { |
| 3357 | l6 ([&]{trace << "cleaned " << t |
| 3358 | << "; old state " << os |
| 3359 | << "; new state " << ns;}); |
| 3360 | return true; |
| 3361 | } |
| 3362 | else |
| 3363 | return false; |
| 3364 | } |
| 3365 | } |
| 3366 | |
| 3367 | bool |
| 3368 | clean_during_match_prerequisites (tracer& trace, |
nothing calls this directly
no outgoing calls
no test coverage detected