+#include <deque>
#include <set>
+#include <msp/core/except.h>
#include <msp/core/maputils.h>
#include <msp/datafile/parser.h>
#include <msp/fs/dir.h>
Builder::Builder():
package_manager(*this),
native_arch(*this, string()),
- current_arch(0),
- build_type(0),
vfs(*this),
build_graph(*this),
- logger(&default_logger),
- tempdir("temp"),
- top_loader(0)
+ logger(&default_logger)
{
set_architecture(string());
}
return keys;
}
+const BuildType &Builder::get_build_type() const
+{
+ if(!build_type)
+ throw invalid_state("no build type");
+ return *build_type;
+}
+
void Builder::set_build_type(const string &name)
{
build_type = &get_item(build_types, name);
logger = (l ? l : &default_logger);
}
-list<string> Builder::collect_problems() const
+vector<string> Builder::collect_problems() const
{
- list<string> problems;
+ vector<string> problems;
set<const Package *> broken_packages;
set<const Component *> broken_components;
set<const Tool *> broken_tools;
{
IO::BufferedFile in(fn.str());
- get_logger().log("files", format("Reading %s", fn));
+ get_logger().log("files", "Reading %s", fn);
DataFile::Parser parser(in, fn.str());
Loader loader(*this, opts, all);
get_logger().log("summary", "Already up to date");
return 0;
}
- get_logger().log("summary", format("Will build %d target%s", total, (total!=1 ? "s" : "")));
+ get_logger().log("summary", "Will build %d target%s", total, (total!=1 ? "s" : ""));
vector<Task *> tasks;
if(tgt)
{
if(tgt->get_tool())
- get_logger().log("tasks", format("%-4s %s", tgt->get_tool()->get_tag(), tgt->get_name()));
+ {
+ if(show_progress)
+ IO::print("\033[K");
+ get_logger().log("tasks", "%-4s %s", tgt->get_tool()->get_tag(), tgt->get_name());
+ }
Task *task = tgt->build();
if(task)
{
- get_logger().log("commands", format("%s", task->get_command()));
+ get_logger().log("commands", "%s", task->get_command());
if(dry_run)
{
task->signal_finished.emit(true);
// Cleaning doesn't care about ordering, so a simpler method can be used
set<Target *> clean_tgts;
- list<Target *> queue;
+ deque<Target *> queue;
queue.push_back(&build_graph.get_goals());
while(!queue.empty())
for(Target *t: clean_tgts)
{
- get_logger().log("tasks", format("RM %s", t->get_name()));
+ get_logger().log("tasks", "RM %s", t->get_name());
if(!dry_run)
t->clean();
}
{
BuildType btype(n);
load_sub(btype);
- auto i = obj.build_types.insert(BuildTypeMap::value_type(n, btype)).first;
+ auto i = obj.build_types.insert({ n, btype }).first;
if(!obj.build_type)
obj.build_type = &i->second;
}