]> git.tdb.fi Git - builder.git/commitdiff
Check an ObjectFile's dependencies again if a dependency is modified
authorMikko Rasa <tdb@tdb.fi>
Thu, 22 Aug 2013 12:06:07 +0000 (15:06 +0300)
committerMikko Rasa <tdb@tdb.fi>
Thu, 22 Aug 2013 12:06:07 +0000 (15:06 +0300)
This is necessary to get generated sources to behave correctly.  Includes
can only be read after they're built for the first time.  The ObjectFile
must then add the necessary dependencies to ensure that required headers
are installed.

source/objectfile.cpp
source/target.cpp
source/target.h

index 97b5c75a523b34b0cfeff3d0c48413781a109834..7208f424bd1b001493cec14420df2d92bf7c4fae 100644 (file)
@@ -86,5 +86,9 @@ void ObjectFile::find_dependencies(FileTarget *tgt)
 
        for(Dependencies::const_iterator i=deps_to_add.begin(); i!=deps_to_add.end(); ++i)
                if(find(depends.begin(), depends.end(), *i)==depends.end())
+               {
                        add_dependency(**i);
+                       if((*i)->get_real_target()->is_buildable())
+                               (*i)->signal_modified.connect(sigc::mem_fun(this, static_cast<void (ObjectFile::*)()>(&ObjectFile::find_dependencies)));
+               }
 }
index 55f73a09cfe725dd2978f6c7d199992c61da9cba..0d8c2da0d81ecc8b5ec3621e4a3a2d2aa86eac19 100644 (file)
@@ -175,5 +175,6 @@ void Target::build_finished(bool success)
                modified();
                for(Dependencies::const_iterator i=side_effects.begin(); i!=side_effects.end(); ++i)
                        (*i)->build_finished(success);
+               signal_modified.emit();
        }
 }
index 64a132c9f13a0460f8608695cb632b88f3ed5522..114a51ec35ae934faf1ed89acdf9b99a749c9382 100644 (file)
@@ -41,6 +41,7 @@ protected:
 
 public:
        sigc::signal<void> signal_bubble_rebuild;
+       sigc::signal<void> signal_modified;
 
 protected:
        Builder &builder;