]> git.tdb.fi Git - builder.git/commitdiff
Allow specifying fixed arguments for source generators
authorMikko Rasa <tdb@tdb.fi>
Wed, 15 Oct 2014 18:28:12 +0000 (21:28 +0300)
committerMikko Rasa <tdb@tdb.fi>
Wed, 15 Oct 2014 18:28:12 +0000 (21:28 +0300)
Currently, the fixed arguments are placed at the front of the command
line, with the template file coming last.

source/sourcegenerator.cpp
source/sourcegenerator.h

index 76d6c892a20942647316b8c2eb8ac83629c215f0..9acd69658173657db5cc02d0f86094d247be1e63 100644 (file)
@@ -57,6 +57,7 @@ Task *SourceGenerator::run(const Target &target) const
 
        vector<string> args;
        args.push_back(executable->get_path().str());
+       args.insert(args.end(), arguments.begin(), arguments.end());
 
        const Target::Dependencies &deps = target.get_dependencies();
        for(Target::Dependencies::const_iterator i=deps.begin(); i!=deps.end(); ++i)
@@ -73,11 +74,17 @@ SourceGenerator::Loader::Loader(SourceGenerator &sg):
        DataFile::ObjectLoader<SourceGenerator>(sg),
        ConditionalLoader(sg.package, format("%s/%s", sg.package.get_name(), sg.tag))
 {
+       add("argument",   &Loader::argument);
        add("command",    &Loader::command);
        add("in_suffix",  &Loader::in_suffix);
        add("out_suffix", &Loader::out_suffix);
 }
 
+void SourceGenerator::Loader::argument(const string &a)
+{
+       obj.arguments.push_back(a);
+}
+
 void SourceGenerator::Loader::command(const string &c)
 {
        obj.set_command((obj.package.get_source_directory()/c).str());
index bb1a88e6a5f99abb871e4cdd0723611980683084..be7d675fe8027aee3bb8a6a9c96c221e07325235 100644 (file)
@@ -15,6 +15,7 @@ public:
                Loader(SourceGenerator &);
 
        private:
+               void argument(const std::string &);
                void command(const std::string &);
                void in_suffix(const std::string &);
                void out_suffix(const std::string &);
@@ -23,6 +24,7 @@ public:
 private:
        const SourcePackage &package;
        std::list<std::string> out_suffixes;
+       std::list<std::string> arguments;
 
 public:
        SourceGenerator(Builder &, const SourcePackage &, const std::string &);