diff options
-rw-r--r-- | flags.cc | 3 | ||||
-rw-r--r-- | flags.h | 1 | ||||
-rw-r--r-- | func.cc | 12 | ||||
-rw-r--r-- | ninja.cc | 5 |
4 files changed, 14 insertions, 7 deletions
@@ -110,6 +110,9 @@ void Flags::Parse(int argc, char** argv) { } else if (ParseCommandLineOptionWithArg( "--ignore_dirty", argv, &i, &ignore_dirty_pattern)) { + } else if (ParseCommandLineOptionWithArg( + "--no_ignore_dirty", + argv, &i, &no_ignore_dirty_pattern)) { } else if (arg[0] == '-') { ERROR("Unknown flag: %s", arg); } else { @@ -38,6 +38,7 @@ struct Flags { bool use_find_emulator; const char* goma_dir; const char* ignore_dirty_pattern; + const char* no_ignore_dirty_pattern; const char* ignore_optional_include_pattern; const char* makefile; const char* ninja_dir; @@ -523,13 +523,15 @@ static vector<CommandResult*> g_command_results; bool ShouldStoreCommandResult(StringPiece cmd) { if (HasWord(cmd, "date") || HasWord(cmd, "echo")) return false; - if (g_flags.ignore_dirty_pattern) { - Pattern pat(g_flags.ignore_dirty_pattern); - for (StringPiece tok : WordScanner(cmd)) { - if (pat.Match(tok)) - return false; + + Pattern pat(g_flags.ignore_dirty_pattern); + Pattern nopat(g_flags.no_ignore_dirty_pattern); + for (StringPiece tok : WordScanner(cmd)) { + if (pat.Match(tok) && !nopat.Match(tok)) { + return false; } } + return true; } @@ -765,8 +765,9 @@ void GenerateNinja(const vector<DepNode*>& nodes, } static bool ShouldIgnoreDirty(StringPiece s) { - return (g_flags.ignore_dirty_pattern && - Pattern(g_flags.ignore_dirty_pattern).Match(s)); + Pattern pat(g_flags.ignore_dirty_pattern); + Pattern nopat(g_flags.no_ignore_dirty_pattern); + return pat.Match(s) && !nopat.Match(s); } bool NeedsRegen(double start_time, const string& orig_args) { |