From: Mikko Rasa Date: Tue, 4 Sep 2012 20:02:44 +0000 (+0300) Subject: Reload includes from CSourceFiles when they are modified X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=93c0466ccf46aa3d43541a1aa6a75192d237b3eb;p=builder.git Reload includes from CSourceFiles when they are modified 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. --- diff --git a/source/csourcefile.cpp b/source/csourcefile.cpp index ee301d7..ca061d2 100644 --- a/source/csourcefile.cpp +++ b/source/csourcefile.cpp @@ -59,3 +59,10 @@ void CSourceFile::find_dependencies() add_dependency(*hdr); } } + +void CSourceFile::modified() +{ + includes.clear(); + depends.clear(); + find_dependencies(); +} diff --git a/source/csourcefile.h b/source/csourcefile.h index 8c61a51..9ed736a 100644 --- a/source/csourcefile.h +++ b/source/csourcefile.h @@ -22,6 +22,7 @@ public: const IncludeList &get_includes() const { return includes; } private: virtual void find_dependencies(); + virtual void modified(); }; #endif diff --git a/source/filetarget.cpp b/source/filetarget.cpp index fca8cea..ec89be8 100644 --- a/source/filetarget.cpp +++ b/source/filetarget.cpp @@ -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(); } diff --git a/source/target.cpp b/source/target.cpp index cd4cf36..64e1115 100644 --- a/source/target.cpp +++ b/source/target.cpp @@ -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(); } diff --git a/source/target.h b/source/target.h index 5143dcf..48b3424 100644 --- a/source/target.h +++ b/source/target.h @@ -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() { }