X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbuilder.cpp;h=21e5484b32cda923bcfb0719f5dfd9aee6c7703c;hb=64cd148dcd762ea368d9a552e982fdff83781ef2;hp=6623c2d033423981a5930016936756cc67c6fb3d;hpb=b1f8964a6b466f9b0c86e82706bf9e72133ecfcf;p=builder.git diff --git a/source/builder.cpp b/source/builder.cpp index 6623c2d..21e5484 100644 --- a/source/builder.cpp +++ b/source/builder.cpp @@ -28,7 +28,6 @@ #include "pkgconfiggenerator.h" #include "sharedlibrary.h" #include "sourcepackage.h" -#include "systemlibrary.h" #include "tar.h" #include "task.h" #include "virtualtarget.h" @@ -269,7 +268,7 @@ int Builder::main() if(j->second->get_package()==i->second) { ++count; - if(j->second->get_rebuild()) + if(j->second->needs_rebuild()) ++to_be_built; } if(count) @@ -510,17 +509,8 @@ int Builder::create_targets() } } - // Find dependencies until no new targets are created - while(!new_tgts.empty()) - { - Target *tgt = new_tgts.front(); - new_tgts.erase(new_tgts.begin()); - tgt->find_depends(); - if(!tgt->get_depends_ready()) - new_tgts.push_back(tgt); - } - // Apply what-ifs + // XXX This does not currently work with targets found during dependency discovery for(StringList::iterator i=what_if.begin(); i!=what_if.end(); ++i) { FileTarget *tgt = vfs.get_target(cwd/ *i); @@ -565,7 +555,7 @@ int Builder::do_build() unsigned total = 0; for(map::const_iterator i=targets.begin(); i!=targets.end(); ++i) - if(i->second->is_buildable() && i->second->get_rebuild()) + if(i->second->is_buildable() && i->second->needs_rebuild()) ++total; if(!total) @@ -591,10 +581,21 @@ int Builder::do_build() if(tgt) { if(tgt->get_tool()) - IO::print("[%-10s] [%-4s] %s\n", tgt->get_package()->get_name(), tgt->get_tool()->get_tag(), tgt->get_name()); + IO::print("%-4s %s\n", tgt->get_tool()->get_tag(), tgt->get_name()); Task *task = tgt->build(); if(task) - tasks.push_back(task); + { + if(dry_run) + { + task->signal_finished.emit(true); + delete task; + } + else + { + task->start(); + tasks.push_back(task); + } + } if(show_progress) IO::print("%d of %d target%s built\033[1G", count, total, (total!=1 ? "s" : "")); @@ -658,7 +659,8 @@ int Builder::do_clean() for(set::iterator i=clean_tgts.begin(); i!=clean_tgts.end(); ++i) if(FileTarget *ft = dynamic_cast(*i)) - unlink(ft->get_path()); + if(ft->get_mtime()) + FS::unlink(ft->get_path()); return 0; }