X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbuilder.cpp;h=9968792ac69279dab08731d960912391f77798a0;hb=d1f9551e05c9d341149eb490e05b1465d3d6b711;hp=21592661624742d5085d48a73a1c4ccf76e79572;hpb=8f99b70eb78bdb5537afc77aa283961a2e825506;p=builder.git diff --git a/source/builder.cpp b/source/builder.cpp index 2159266..9968792 100644 --- a/source/builder.cpp +++ b/source/builder.cpp @@ -1,4 +1,6 @@ +#include #include +#include #include #include #include @@ -30,13 +32,9 @@ using namespace Msp; 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()); } @@ -70,6 +68,13 @@ vector Builder::get_build_types() const 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); @@ -105,9 +110,9 @@ void Builder::set_logger(const Logger *l) logger = (l ? l : &default_logger); } -list Builder::collect_problems() const +vector Builder::collect_problems() const { - list problems; + vector problems; set broken_packages; set broken_components; set broken_tools; @@ -151,7 +156,7 @@ void Builder::load_build_file(const FS::Path &fn, const Config::InputOptions *op { 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); @@ -173,7 +178,7 @@ int Builder::build(unsigned jobs, bool dry_run, bool show_progress) 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 tasks; @@ -191,11 +196,11 @@ int Builder::build(unsigned jobs, bool dry_run, bool show_progress) if(tgt) { if(tgt->get_tool()) - get_logger().log("tasks", format("%-4s %s", tgt->get_tool()->get_tag(), tgt->get_name())); + 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); @@ -259,7 +264,7 @@ int Builder::clean(bool all, bool dry_run) // Cleaning doesn't care about ordering, so a simpler method can be used set clean_tgts; - list queue; + deque queue; queue.push_back(&build_graph.get_goals()); while(!queue.empty()) @@ -277,7 +282,7 @@ int Builder::clean(bool all, bool dry_run) 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(); } @@ -324,7 +329,7 @@ void Builder::Loader::build_type(const string &n) { 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; }