mirror of
https://github.com/reactos/ninja.git
synced 2025-02-02 17:32:55 +00:00
Merge pull request #152 from pcc/clean-depfiles
Have the clean tool remove depfiles
This commit is contained in:
commit
0301500009
@ -111,6 +111,8 @@ int Cleaner::CleanAll(bool generator) {
|
||||
out_node != (*e)->outputs_.end(); ++out_node) {
|
||||
Remove((*out_node)->file_->path_);
|
||||
}
|
||||
if (!(*e)->rule_->depfile_.empty())
|
||||
Remove((*e)->EvaluateDepFile());
|
||||
}
|
||||
PrintFooter();
|
||||
return status_;
|
||||
|
@ -234,6 +234,21 @@ TEST_F(CleanTest, CleanRuleGenerator) {
|
||||
EXPECT_EQ(2u, fs_.files_removed_.size());
|
||||
}
|
||||
|
||||
TEST_F(CleanTest, CleanDepFile) {
|
||||
ASSERT_NO_FATAL_FAILURE(AssertParse(&state_,
|
||||
"rule cc\n"
|
||||
" command = cc $in > $out\n"
|
||||
" depfile = $out.d\n"
|
||||
"build out1: cc in1\n"));
|
||||
fs_.Create("out1", 1, "");
|
||||
fs_.Create("out1.d", 1, "");
|
||||
|
||||
Cleaner cleaner(&state_, config_, &fs_);
|
||||
EXPECT_EQ(0, cleaner.CleanAll());
|
||||
EXPECT_EQ(2, cleaner.cleaned_files_count());
|
||||
EXPECT_EQ(2u, fs_.files_removed_.size());
|
||||
}
|
||||
|
||||
TEST_F(CleanTest, CleanFailure) {
|
||||
ASSERT_NO_FATAL_FAILURE(AssertParse(&state_,
|
||||
"build dir: cat src1\n"));
|
||||
|
Loading…
x
Reference in New Issue
Block a user