]> git.tdb.fi Git - builder.git/blobdiff - source/lib/builder.cpp
Make it possible to use built-in plugins
[builder.git] / source / lib / builder.cpp
index 08e9cd7ef69f68b8d12d2bb61c081d3145db789e..f979d28f38ce35c6f01976cc5109886f83b50ab7 100644 (file)
@@ -87,6 +87,11 @@ void Builder::load_plugins()
                }
        }
 
+       add_plugins(unordered_plugins);
+}
+
+void Builder::add_plugins(vector<LoadedPlugin> &unordered_plugins)
+{
        auto have_plugin = [this](const string &r){
                return any_of(plugins.begin(), plugins.end(), [&r](const LoadedPlugin &p){ return FS::basepart(FS::basename(p.path))==r; });
        };
@@ -282,6 +287,7 @@ void Builder::save_caches()
 int Builder::build(unsigned jobs, bool dry_run, bool show_progress)
 {
        unsigned total = build_graph.count_rebuild_targets();
+       Time::TimeStamp start_time = Time::now();
 
        if(!total)
        {
@@ -293,6 +299,7 @@ int Builder::build(unsigned jobs, bool dry_run, bool show_progress)
        vector<Task *> tasks;
 
        unsigned count = 0;
+       Time::TimeDelta sum_time;
 
        bool fail = false;
        bool finish = false;
@@ -350,6 +357,13 @@ int Builder::build(unsigned jobs, bool dry_run, bool show_progress)
                        {
                                ++count;
 
+                               const vector<const FileTarget *> &targets = tasks[i]->get_targets();
+                               if(!targets.empty())
+                               {
+                                       sum_time += tasks[i]->get_duration();
+                                       get_logger().log("timings", "%s built in %s", targets.front()->get_name(), tasks[i]->get_duration());
+                               }
+
                                delete tasks[i];
                                tasks.erase(tasks.begin()+i);
                                if(status==Task::ERROR)
@@ -370,6 +384,9 @@ int Builder::build(unsigned jobs, bool dry_run, bool show_progress)
        else if(show_progress)
                get_logger().log("summary", "Build complete");
 
+       Time::TimeStamp end_time = Time::now();
+       get_logger().log("timings", "Build took %s, with a total %s spent on tasks", end_time-start_time, sum_time);
+
        return fail;
 }