]> git.tdb.fi Git - builder.git/blob - source/builder.h
Change conf_all into a normal commandline option
[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         Package  *get_package(const std::string &);
23         Target   *get_target(const std::string &);
24         Target   *get_header(const std::string &, const std::string &, const std::list<std::string> &);
25         Target   *get_library(const std::string &, const std::list<std::string> &);
26         int      main();
27         ~Builder();
28 private:
29         class Loader: public Msp::Parser::Loader
30         {
31         public:
32                 Loader(Builder &, const Msp::Path::Path &);
33         private:
34                 Builder &bld;
35                 Msp::Path::Path src;
36                 
37                 void package(const std::string &);
38         };
39
40         typedef std::map<std::string, Package *>   PackageMap;
41         typedef std::map<std::string, Target *>    TargetMap;
42         typedef std::map<std::string, std::string> ToolMap;
43         
44         std::list<std::string> cmdline_targets;
45         RawOptionMap cmdline_options;
46         
47         PackageMap  packages;
48         std::list<Package *> new_pkgs;
49         Package     *default_pkg;
50
51         TargetMap   targets;
52         std::list<Target *> new_tgts;
53         TargetMap   includes;
54         TargetMap   libraries;
55
56         ToolMap     tools;
57         unsigned    verbose;
58         Msp::Path::Path cwd;
59         Msp::Path::Path build_file;
60         bool        do_build;
61         bool        dry_run;
62         Analyzer    *analyzer;
63         unsigned    jobs;
64         std::list<std::string> what_if;
65         bool        chrome;
66         bool        conf_all;
67
68         int load_build_file(const Msp::Path::Path &);
69         int create_targets();
70         Target *check_header(const Msp::Path::Path &);
71         void add_target(Target *);
72         void update_hash(std::string &, const std::string &);
73         int build();
74         
75         static Msp::Application::RegApp<Builder> reg;
76 };
77
78 #endif