Enable the stale.py tool to work with Qt projects

This commit is contained in:
Thomas Nagy 2014-10-25 13:19:22 +02:00
parent a3e882dbba
commit ddfabfd80a
No known key found for this signature in database
GPG Key ID: 67A565EDFDF90E64
1 changed files with 17 additions and 5 deletions

View File

@ -15,17 +15,25 @@ nodes/tasks, in which case the method will have to be modified
to exclude some folders for example.
"""
from waflib import Logs
from waflib import Logs, Build
from waflib.Runner import Parallel
DYNAMIC_EXT = ['.moc']
old = Parallel.refill_task_list
def refill_task_list(self):
iit = old(self)
bld = self.bld
# this does not work in partial builds
if bld.options.targets and bld.options.targets != '*':
return iit
# execute only once
# this does not work in dynamic builds
if bld.post_mode == Build.POST_LAZY:
return iit
# execute this operation only once - using refill_task_list is
if getattr(self, 'clean', False):
return iit
self.clean = True
@ -47,9 +55,13 @@ def refill_task_list(self):
if x.name != "c4che":
iter(x)
else:
if not node in nodes:
Logs.warn("stale file found -> %s" % node.abspath())
node.delete()
for ext in DYNAMIC_EXT:
if node.name.endswith(ext):
break
else:
if not node in nodes:
Logs.warn("Removing stale file -> %s" % node.abspath())
node.delete()
iter(bld.bldnode)
return iit