]> git.tdb.fi Git - builder.git/blob - source/sourcegenerator.h
Redesign how tools are run
[builder.git] / source / sourcegenerator.h
1 #ifndef SOURCEGENERATOR_H_
2 #define SOURCEGENERATOR_H_
3
4 #include <msp/datafile/objectloader.h>
5 #include "conditionalloader.h"
6 #include "sourcepackage.h"
7 #include "tool.h"
8
9 class SourceFile;
10
11 class SourceGenerator: public Tool
12 {
13 public:
14         class Loader: public Msp::DataFile::ObjectLoader<SourceGenerator>, public ConditionalLoader
15         {
16         public:
17                 Loader(SourceGenerator &);
18
19         private:
20                 void argument(const std::string &);
21                 void arguments(const std::vector<std::string> &);
22                 void command(const std::string &);
23                 void in_suffix(const std::string &);
24                 void out_argument(const std::string &);
25                 void out_suffix(const std::string &);
26         };
27
28 private:
29         const SourcePackage &package;
30         std::vector<std::string> out_suffixes;
31         std::vector<std::string> arguments;
32         std::string out_argument;
33
34 public:
35         SourceGenerator(Builder &, const SourcePackage &, const std::string &);
36
37         Target *create_source(const Component &, const Msp::FS::Path &) const override;
38         Target *create_target(const std::vector<Target *> &, const std::string &) override;
39
40 private:
41         static Task *_run(const SourceFile &);
42 };
43
44 #endif