]> git.tdb.fi Git - builder.git/blobdiff - source/target.cpp
Add a method to query the existence of dependencies in cache
[builder.git] / source / target.cpp
index c43ad99ea8361cb71934f3fb57a5f4dce27e23ff..297ae3f4211b9a4b3be3b2f68e1fd2ab43dc2ec5 100644 (file)
@@ -16,8 +16,7 @@ Target::Target(Builder &b, const string &n):
        component(0),
        name(n),
        tool(0),
-       state(INIT),
-       deps_ready(false)
+       state(INIT)
 {
        builder.add_target(this);
 }
@@ -66,6 +65,8 @@ void Target::prepare()
        }
 
        state = PREPARING;
+       find_depends();
+
        for(Dependencies::iterator i=depends.begin(); i!=depends.end(); ++i)
                (*i)->prepare();
 
@@ -96,6 +97,9 @@ Task *Target::build()
 
 void Target::mark_rebuild(const std::string &reason)
 {
+       if(reason.empty())
+               throw invalid_argument("No reason given for rebuilding "+name);
+
        state = REBUILD;
        rebuild_reason = reason;
 }