]> git.tdb.fi Git - builder.git/blob - source/builder.h
Implement --build-all
[builder.git] / source / builder.h
1 #ifndef BUILDER_H_
2 #define BUILDER_H_
3
4 #include <list>
5 #include <map>
6 #include <string>
7 #include <msp/core/application.h>
8 #include <msp/parser/loader.h>
9 #include <msp/path/path.h>
10 #include "config.h"
11
12 class Analyzer;
13 class Package;
14 class Target;
15
16 class Builder: public Msp::Application
17 {
18 public:
19         Builder(int, char **);
20         unsigned get_verbose() const { return verbose; }
21         bool     get_dry_run() const { return dry_run; }
22         bool     get_build_all() const { return build_all; }
23         Package  *get_package(const std::string &);
24         Target   *get_target(const std::string &);
25         Target   *get_header(const std::string &, const std::string &, const std::list<std::string> &);
26         Target   *get_library(const std::string &, const std::list<std::string> &);
27         int      main();
28         ~Builder();
29 private:
30         class Loader: public Msp::Parser::Loader
31         {
32         public:
33                 Loader(Builder &, const Msp::Path::Path &);
34         private:
35                 Builder &bld;
36                 Msp::Path::Path src;
37                 
38                 void package(const std::string &);
39         };
40
41         typedef std::map<std::string, Package *>   PackageMap;
42         typedef std::map<std::string, Target *>    TargetMap;
43         typedef std::map<std::string, std::string> ToolMap;
44         
45         std::list<std::string> cmdline_targets;
46         RawOptionMap cmdline_options;
47         
48         PackageMap  packages;
49         std::list<Package *> new_pkgs;
50         Package     *default_pkg;
51
52         TargetMap   targets;
53         std::list<Target *> new_tgts;
54         TargetMap   includes;
55         TargetMap   libraries;
56
57         ToolMap     tools;
58         unsigned    verbose;
59         Msp::Path::Path cwd;
60         Msp::Path::Path build_file;
61         bool        do_build;
62         bool        dry_run;
63         Analyzer    *analyzer;
64         unsigned    jobs;
65         std::list<std::string> what_if;
66         bool        chrome;
67         bool        conf_all;
68         bool        build_all;
69
70         int load_build_file(const Msp::Path::Path &);
71         int create_targets();
72         Target *check_header(const Msp::Path::Path &);
73         void add_target(Target *);
74         void update_hash(std::string &, const std::string &);
75         int build();
76         
77         static Msp::Application::RegApp<Builder> reg;
78 };
79
80 #endif