]> git.tdb.fi Git - builder.git/commitdiff
Reload includes from CSourceFiles when they are modified
authorMikko Rasa <tdb@tdb.fi>
Tue, 4 Sep 2012 20:02:44 +0000 (23:02 +0300)
committerMikko Rasa <tdb@tdb.fi>
Tue, 4 Sep 2012 20:02:44 +0000 (23:02 +0300)
Without this, -W did not cause includes to be read if they were present
in the cache.  It'll also come in handy for generated source files some
time in the future.

source/csourcefile.cpp
source/csourcefile.h
source/filetarget.cpp
source/target.cpp
source/target.h

index ee301d7254d35b9699687e80f9d20d8663e83adb..ca061d2b19e581ccdc1f6f308c2848533f8135c9 100644 (file)
@@ -59,3 +59,10 @@ void CSourceFile::find_dependencies()
                        add_dependency(*hdr);
        }
 }
+
+void CSourceFile::modified()
+{
+       includes.clear();
+       depends.clear();
+       find_dependencies();
+}
index 8c61a515db5544ef4e274d7037a41e456725fd07..9ed736a4f770566e943cbdbf447235d37af9b067 100644 (file)
@@ -22,6 +22,7 @@ public:
        const IncludeList &get_includes() const { return includes; }
 private:
        virtual void find_dependencies();
+       virtual void modified();
 };
 
 #endif
index fca8cea51f651d5409f9da90b8e893acd4738901..ec89be897721d063bf2fe5fa82a8498ef265f681 100644 (file)
@@ -64,6 +64,7 @@ string FileTarget::generate_name(Builder &builder, const SourcePackage *pkg, con
 void FileTarget::touch()
 {
        mtime = Time::now();
+       modified();
        signal_bubble_rebuild.emit();
 }
 
index cd4cf36370b252ca55ca6a954a1d51b5c1c10dd9..64e1115adbd7bdc43134c3ef185764f944a40848 100644 (file)
@@ -122,7 +122,9 @@ Task *Target::build()
        return task;
 }
 
-void Target::build_finished(bool /*success*/)
+void Target::build_finished(bool success)
 {
        state = UPTODATE;
+       if(success)
+               modified();
 }
index 5143dcf77fe0898895918b5588840259a5e39bc7..48b3424d2f39d908d4792b05ba54fc0fce43c5c4 100644 (file)
@@ -123,6 +123,8 @@ protected:
        /** Handler for Task::signal_finished. */
        virtual void build_finished(bool);
 
+       virtual void modified() { }
+
 public:
        /** Removes any results of building the target. */
        virtual void clean() { }