]> git.tdb.fi Git - builder.git/blobdiff - source/target.cpp
Further changes for library compatibility
[builder.git] / source / target.cpp
index c0c3c18051bbfcd4d8c76250b59f1c081c694b85..bfb78672afb08e4e787236452b831b060a78632e 100644 (file)
@@ -7,12 +7,10 @@ Distributed under the LGPL
 
 #include <msp/fs/stat.h>
 #include <msp/fs/utils.h>
-#include <msp/time/utils.h>
 #include "action.h"
 #include "builder.h"
 #include "filetarget.h"
 #include "package.h"
-#include "sourcepackage.h"
 #include "target.h"
 
 using namespace std;
@@ -54,7 +52,7 @@ Target *Target::get_buildable_target()
 void Target::add_depend(Target *dep)
 {
        if(dep==this)
-               throw InvalidParameterValue("A target can't depend on itself");
+               throw invalid_argument("Target::add_depend");
        depends.push_back(dep);
 }
 
@@ -85,6 +83,7 @@ Action *Target::build()
                return 0;
        }
 
+       // XXX Minor breach of OO here
        if(FileTarget *ft = dynamic_cast<FileTarget *>(this))
                if(!builder.get_dry_run() && FS::exists(ft->get_path()))
                        FS::unlink(ft->get_path());
@@ -100,42 +99,12 @@ Action *Target::build()
        return action;
 }
 
-void Target::touch()
-{
-       mtime = Time::now();
-}
-
 void Target::mark_rebuild(const std::string &reason)
 {
        rebuild = true;
        rebuild_reason = reason;
 }
 
-void Target::check_rebuild()
-{
-       if(!buildable)
-               return;
-
-       if(builder.get_build_all())
-               mark_rebuild("Rebuilding everything");
-       else if(!mtime)
-               mark_rebuild("Does not exist");
-       else
-       {
-               for(TargetList::iterator i=depends.begin(); (i!=depends.end() && !rebuild); ++i)
-               {
-                       if((*i)->get_mtime()>mtime)
-                               mark_rebuild((*i)->get_name()+" has changed");
-                       else if((*i)->get_rebuild())
-                               mark_rebuild((*i)->get_name()+" needs rebuilding");
-               }
-       }
-
-       const SourcePackage *spkg = dynamic_cast<const SourcePackage *>(package);
-       if(!rebuild && spkg && spkg->get_config().get_mtime()>mtime)
-               mark_rebuild("Package options changed");
-}
-
 void Target::build_done()
 {
        building = false;