3 # Thomas Nagy, 2010 (ita)
6 This tool modifies the task signature scheme to store and obtain
7 information about the task execution (why it must run, etc)::
12 After adding the tool, a full rebuild is necessary:
13 waf clean build --zones=task
16 from waflib import Task, Utils, Logs, Errors
19 # compute the result one time, and suppose the scan_signature will give the good result
22 except AttributeError:
26 self.m.update(self.hcode)
27 id_sig = self.m.digest()
31 self.sig_explicit_deps()
32 exp_sig = self.m.digest()
37 var_sig = self.m.digest()
39 # implicit deps / scanner results
43 self.sig_implicit_deps()
44 except Errors.TaskRescan:
45 return self.signature()
46 impl_sig = self.m.digest()
48 ret = self.cache_sig = impl_sig + id_sig + exp_sig + var_sig
52 Task.Task.signature = signature
54 old = Task.Task.runnable_status
55 def runnable_status(self):
57 if ret == Task.RUN_ME:
59 old_sigs = self.generator.bld.task_sigs[self.uid()]
60 except (KeyError, AttributeError):
61 Logs.debug("task: task must run as no previous signature exists")
63 new_sigs = self.cache_sig
65 return Utils.to_hex(x)
67 Logs.debug('Task %r', self)
68 msgs = ['* Implicit or scanner dependency', '* Task code', '* Source file, explicit or manual dependency', '* Configuration data variable']
69 tmp = 'task: -> %s: %s %s'
70 for x in range(len(msgs)):
71 l = len(Utils.SIG_NIL)
72 a = new_sigs[x*l : (x+1)*l]
73 b = old_sigs[x*l : (x+1)*l]
75 Logs.debug(tmp, msgs[x].ljust(35), v(a), v(b))
77 Task.Task.runnable_status = runnable_status