X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fanalyzer.h;h=373150b847690039a77e402a737e5d57c8bdef9f;hb=c3968651eb8a2ba66a95398f0571dd5afd37225c;hp=c5c6ba2891de6cf8ba144763b488d69f05e1d889;hpb=74266a6e650f019063cdcd1c9a7bd26d8f99041b;p=builder.git diff --git a/source/analyzer.h b/source/analyzer.h index c5c6ba2..373150b 100644 --- a/source/analyzer.h +++ b/source/analyzer.h @@ -2,6 +2,8 @@ #define ANALYZER_H_ #include +#include +#include #include #include @@ -16,31 +18,42 @@ class Analyzer public: enum Mode { - DEPS, /// Skip over "trivial" targets such as Install and Compile - ALLDEPS, /// Print out absolutely every target - REBUILD, /// Print targets that are going to be rebuilt - RDEPS /// Print targets that depend on the given targets (NYI) + DEPS, //< Skip over "trivial" targets such as InstalledFile + ALLDEPS, //< Print out absolutely every target + REBUILD, //< Print targets that are going to be rebuilt + RDEPS //< Print targets that depend on the given targets }; - Analyzer(Builder &); - void set_mode(Mode m) { mode=m; } - void set_max_depth(unsigned m) { max_depth=m; } - void set_full_paths(bool f) { full_paths=f; } - void analyze(); private: - typedef std::vector TableRow; - typedef std::list Table; + using TableRow = std::vector; - Builder &builder; - Mode mode; - Table table; + Builder &builder; + Mode mode; + std::list table; unsigned max_depth; - bool full_paths; + bool full_paths; + std::map > rdepends; + +public: + Analyzer(Builder &); + void set_mode(Mode m) { mode = m; } + void set_max_depth(unsigned m) { max_depth = m; } + void set_full_paths(bool f) { full_paths = f; } + + /// Performs the analysis and prints out the resulting dependency tree. + void analyze(); + +private: + /** Adds rows for a target, then recursively adds rows for dependencies as + needed. */ void build_depend_table(Target &, unsigned); + + /// Prints out the table that resulted from the analysis. void print_table() const; - static bool target_order(Target *, Target *); + static bool target_order(const Target *, const Target *); + static bool target_order_full(const Target *, const Target *); }; #endif