X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbuilder.cpp;h=b3e096848f5de0db856a644450f2482ca90e20bc;hb=afd944a9a8b9d727326cdc4d3b7122384a8d9b5d;hp=6623c2d033423981a5930016936756cc67c6fb3d;hpb=b1f8964a6b466f9b0c86e82706bf9e72133ecfcf;p=builder.git diff --git a/source/builder.cpp b/source/builder.cpp index 6623c2d..b3e0968 100644 --- a/source/builder.cpp +++ b/source/builder.cpp @@ -24,11 +24,10 @@ #include "installedfile.h" #include "misc.h" #include "package.h" -#include "pkgconfig.h" +#include "pkgconfigfile.h" #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) @@ -505,22 +504,13 @@ int Builder::create_targets() if(spkg->get_install_flags()&(SourcePackage::LIB|SourcePackage::INCLUDE)) { - PkgConfig *pc = new PkgConfig(*this, *spkg); - install->add_depend(new InstalledFile(*this, *spkg, *pc)); + PkgConfigFile *pc = new PkgConfigFile(*this, *spkg); + install->add_depend(toolchain.get_tool("CP").create_target(*pc)); } } - // 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,23 @@ 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(verbose>=2) + IO::print("%s\n", task->get_command()); + 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 +661,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; }