Index: tools/gn/scheduler.h |
diff --git a/tools/gn/scheduler.h b/tools/gn/scheduler.h |
index 912ca7e10ad089ccc3db26395adc3d66187d7f8a..4375f6366fdd0bd9986cb1428a1fddcc1f34aa25 100644 |
--- a/tools/gn/scheduler.h |
+++ b/tools/gn/scheduler.h |
@@ -5,6 +5,8 @@ |
#ifndef TOOLS_GN_SCHEDULER_H_ |
#define TOOLS_GN_SCHEDULER_H_ |
+#include <map> |
+ |
#include "base/atomic_ref_count.h" |
#include "base/basictypes.h" |
#include "base/files/file_path.h" |
@@ -47,9 +49,33 @@ class Scheduler { |
// TODO(brettw) this is global rather than per-BuildSettings. If we |
// start using >1 build settings, then we probably want this to take a |
// BuildSettings object so we know the depdency on a per-build basis. |
+ // If moved, most of the Add/Get functions below should move as well. |
void AddGenDependency(const base::FilePath& file); |
std::vector<base::FilePath> GetGenDependencies() const; |
+ // Tracks calls to write_file for resolving with the unknown generated |
+ // inputs (see AddUnknownGeneratedInput below). |
+ void AddWrittenFile(const SourceFile& file); |
+ |
+ // Unknown generated inputs are files that a target declares as an input |
+ // in the output directory, but which aren't generated by any dependency. |
+ // |
+ // Some of these files will be files written by write_file and will be |
+ // GenDependencies (see AddWrittenFile above). There are OK and include |
+ // things like response files for scripts. Others cases will be ones where |
+ // the file is generated by a target that's not a dependency. |
+ // |
+ // In order to distinguish these two cases, the checking for these input |
+ // files needs to be done after all targets are complete. This also has the |
+ // nice side effect that if a target generates the file we can find it and |
+ // tell the user which dependency is missing. |
+ // |
+ // The result returned by GetUnknownGeneratedInputs will not count any files |
+ // that were written by write_file during execution. |
+ void AddUnknownGeneratedInput(const Target* target, const SourceFile& file); |
+ std::multimap<SourceFile, const Target*> GetUnknownGeneratedInputs() const; |
+ void ClearUnknownGeneratedInputsAndWrittenFiles(); // For testing. |
+ |
// We maintain a count of the things we need to do that works like a |
// refcount. When this reaches 0, the program exits. |
void IncrementWorkCount(); |
@@ -84,8 +110,10 @@ class Scheduler { |
// loop. |
bool has_been_shutdown_; |
- // Additional input dependencies. Protected by the lock. |
+ // Protected by the lock. See the corresponding Add/Get functions above. |
std::vector<base::FilePath> gen_dependencies_; |
+ std::vector<SourceFile> written_files_; |
+ std::multimap<SourceFile, const Target*> unknown_generated_inputs_; |
DISALLOW_COPY_AND_ASSIGN(Scheduler); |
}; |