]> git.tdb.fi Git - builder.git/commitdiff
Connect to bubble_rebuild signals after preparing to avoid confusion
authorMikko Rasa <tdb@tdb.fi>
Sun, 8 Jul 2012 22:39:37 +0000 (01:39 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sun, 8 Jul 2012 22:39:37 +0000 (01:39 +0300)
source/target.cpp

index cf227a42edf421377817e1740240e808900ec0a0..095228b3b397c86434539e98c51cdc23ba4ef4e0 100644 (file)
@@ -60,7 +60,8 @@ void Target::add_depend(Target *dep)
        if(dep==this)
                throw invalid_argument("Target::add_depend");
        depends.push_back(dep);
-       dep->signal_bubble_rebuild.connect(sigc::mem_fun(this, &Target::check_rebuild));
+       if(state>PREPARING)
+               dep->signal_bubble_rebuild.connect(sigc::mem_fun(this, &Target::check_rebuild));
 }
 
 void Target::prepare()
@@ -87,6 +88,9 @@ void Target::prepare()
        check_rebuild();
        if(state==PREPARING)
                state = UPTODATE;
+
+       for(Dependencies::iterator i=depends.begin(); i!=depends.end(); ++i)
+               (*i)->signal_bubble_rebuild.connect(sigc::mem_fun(this, &Target::check_rebuild));
 }
 
 Task *Target::build()
@@ -116,9 +120,10 @@ void Target::mark_rebuild(const string &reason)
 
        state = REBUILD;
        rebuild_reason = reason;
-       signal_bubble_rebuild.emit();
 
        builder.get_logger().log("rebuild", format("Rebuilding %s: %s", name, reason));
+
+       signal_bubble_rebuild.emit();
 }
 
 void Target::build_finished(bool /*success*/)