3 # WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
7 # Thomas Nagy, 2010 (ita)
10 This tool modifies the task signature scheme to store and obtain
11 information about the task execution (why it must run, etc)::
16 After adding the tool, a full rebuild is necessary:
17 waf clean build --zones=task
20 from waflib import Task, Utils, Logs, Errors
23 # compute the result one time, and suppose the scan_signature will give the good result
26 except AttributeError:
30 self.m.update(self.hcode)
31 id_sig = self.m.digest()
35 self.sig_explicit_deps()
36 exp_sig = self.m.digest()
41 var_sig = self.m.digest()
43 # implicit deps / scanner results
47 self.sig_implicit_deps()
48 except Errors.TaskRescan:
49 return self.signature()
50 impl_sig = self.m.digest()
52 ret = self.cache_sig = impl_sig + id_sig + exp_sig + var_sig
56 Task.Task.signature = signature
58 old = Task.Task.runnable_status
59 def runnable_status(self):
61 if ret == Task.RUN_ME:
63 old_sigs = self.generator.bld.task_sigs[self.uid()]
64 except (KeyError, AttributeError):
65 Logs.debug("task: task must run as no previous signature exists")
67 new_sigs = self.cache_sig
69 return Utils.to_hex(x)
71 Logs.debug('Task %r', self)
72 msgs = ['* Implicit or scanner dependency', '* Task code', '* Source file, explicit or manual dependency', '* Configuration data variable']
73 tmp = 'task: -> %s: %s %s'
74 for x in range(len(msgs)):
75 l = len(Utils.SIG_NIL)
76 a = new_sigs[x*l : (x+1)*l]
77 b = old_sigs[x*l : (x+1)*l]
79 Logs.debug(tmp, msgs[x].ljust(35), v(a), v(b))
81 Task.Task.runnable_status = runnable_status