]> git.tdb.fi Git - builder.git/commitdiff
Turn the force rebuild logic around
authorMikko Rasa <tdb@tdb.fi>
Sat, 23 Jun 2012 18:46:14 +0000 (21:46 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sun, 8 Jul 2012 21:08:54 +0000 (00:08 +0300)
source/builder.cpp
source/filetarget.cpp
source/target.cpp
source/target.h

index 4a9370fc19a0468ebe1ddb2b19cf57d7be8766ee..2c28b7931631e2a3d06bf7f32b2c4e8539f8a0ac 100644 (file)
@@ -529,6 +529,13 @@ int Builder::create_targets()
                tgt->touch();
        }
 
+       if(build_all)
+       {
+               for(TargetMap::iterator i=targets.begin(); i!=targets.end(); ++i)
+                       if(i->second->is_buildable() && !i->second->needs_rebuild())
+                               i->second->force_rebuild();
+       }
+
        for(PackageMap::iterator i=packages.begin(); i!=packages.end(); ++i)
                if(SourcePackage *spkg = dynamic_cast<SourcePackage *>(i->second))
                        spkg->get_deps_cache().save();
index 74f7833187cce39e275956c1c6edb8e0b3b4a14a..6626db8ded177b79ed8ecd1f0b8bd5a81f3bf456 100644 (file)
@@ -36,9 +36,7 @@ void FileTarget::check_rebuild()
        if(!tool)
                return;
 
-       if(builder.get_build_all())
-               mark_rebuild("Rebuilding everything");
-       else if(!mtime)
+       if(!mtime)
                mark_rebuild("Does not exist");
        else
        {
index 88d8b70e2c1cce48cb545c6c8e1a52708700c10c..1aab4b1fdef5a2f16fc04d4a674a0b5efb043a71 100644 (file)
@@ -47,6 +47,13 @@ void Target::set_tool(const Tool &t)
        tool = &t;
 }
 
+void Target::force_rebuild()
+{
+       if(!is_buildable())
+               throw logic_error("Target::force_rebuild");
+       mark_rebuild("Forced rebuild");
+}
+
 void Target::add_depend(Target *dep)
 {
        if(dep==this)
index 0f0afc6310b24d8fc88b924608d2a4bb2ec30aad..88642dc9ff5f446e1e30ee67e6c64a90df17c919 100644 (file)
@@ -86,6 +86,9 @@ public:
        the target has been prepared. */
        const std::string &get_rebuild_reason() const { return rebuild_reason; }
 
+       /** Forces rebuild of the target. */
+       void force_rebuild();
+
        bool is_installable() const { return !install_location.empty(); }
        const std::string &get_install_location() const { return install_location; }
        void add_depend(Target *);