2
0
mirror of https://gitlab.com/ita1024/waf.git synced 2024-11-22 01:46:15 +01:00

Stop adding incompatible task data into the same dict objects

This commit is contained in:
Thomas Nagy 2015-12-24 18:28:20 +01:00
parent 6648d3e6e7
commit 5a3a89b4de
8 changed files with 26 additions and 21 deletions

2
TODO
View File

@ -1,7 +1,6 @@
Waf 1.9
-------
* Reduce the key size in bld.task_sigs
* Provide a more efficient ConfigSet implementation
* Ensure _cache.py are valid python files
* Rework qt5
@ -25,4 +24,5 @@ Done
* Remove Node.cache_sig and Node.sig #1580
* Remove __hash__ and __eq__ from Node and Task #1629
* Set cflags in the beginning / cppflags at the end #1505
* Reduce the key size in bld.task_sigs by adding bld.node_sigs and bld.imp_sigs

View File

@ -73,7 +73,7 @@ def runnable_status(self):
if add:
# recompute the task signature
delattr(self, 'cache_sig')
del bld.task_sigs[(self.uid(), 'imp')]
del bld.imp_sigs[self.uid()]
return self.runnable_status()
for x in bld.node_deps[self.uid()]:

View File

@ -29,8 +29,8 @@ INSTALL = 1337
UNINSTALL = -1337
"""Negative value '<-' uninstall, see :py:attr:`waflib.Build.BuildContext.is_install`"""
SAVED_ATTRS = 'root node_deps raw_deps task_sigs'.split()
"""Build class members to save between the runs (root, node_deps, raw_deps, task_sigs)"""
SAVED_ATTRS = 'root node_sigs task_sigs imp_sigs raw_deps node_deps'.split()
"""Build class members to save between the runs (root, node_sigs, task_sigs, node_sigs, imp_sigs, raw_deps, node_deps)"""
CFG_FILES = 'cfg_files'
"""Files from the build directory to hash before starting the build (``config.h`` written during the configuration)"""
@ -80,14 +80,20 @@ class BuildContext(Context.Context):
# ======================================= #
# cache variables
self.node_sigs = {}
"""Dict mapping build nodes to task identifier (uid), it indicates whether a task created a particular file (persists between builds)"""
self.task_sigs = {}
"""Signatures of the tasks (persists between build executions)"""
"""Dict mapping task identifiers (uid) to task signatures (persists between builds)"""
self.imp_sigs = {}
"""Dict mapping task identifiers (uid) to implicit task dependencies used for scanning targets (persists between builds)"""
self.node_deps = {}
"""Dict of node dependencies found by :py:meth:`waflib.Task.Task.scan` (persists between build executions)"""
"""Dict mapping task identifiers (uid) to node dependencies found by :py:meth:`waflib.Task.Task.scan` (persists between builds)"""
self.raw_deps = {}
"""Dict of custom data returned by :py:meth:`waflib.Task.Task.scan` (persists between build executions)"""
"""Dict mapping task identifiers (uid) to custom data returned by :py:meth:`waflib.Task.Task.scan` (persists between builds)"""
# list of folders that are already scanned
# so that we do not need to stat them one more time
@ -1214,7 +1220,7 @@ class CleanContext(BuildContext):
n.delete()
self.root.children = {}
for v in 'node_deps task_sigs raw_deps'.split():
for v in 'node_sigs task_sigs imp_sigs raw_deps node_deps'.split():
setattr(self, v, {})
class ListContext(BuildContext):

View File

@ -816,7 +816,7 @@ class Node(object):
the signature calculation relies on an existing attribute. Else the
signature is calculated automatically.
"""
# previous behaviour can be set by returning self.ctx.task_sigs[self] when a build node
# previous behaviour can be set by returning self.ctx.node_sigs[self] when a build node
return Utils.h_file(self.abspath())
# --------------------------------------------

View File

@ -280,9 +280,8 @@ class Parallel(object):
"""
if hasattr(tsk, 'scan') and hasattr(tsk, 'uid'):
# TODO waf 1.9 - this breaks encapsulation
key = (tsk.uid(), 'imp')
try:
del self.bld.task_sigs[key]
del self.bld.imp_sigs[tsk.uid()]
except KeyError:
pass
if not self.bld.keep:

View File

@ -607,7 +607,7 @@ class Task(TaskBase):
# compare the signatures of the outputs
for node in self.outputs:
sig = bld.task_sigs.get(node, None)
sig = bld.node_sigs.get(node, None)
if not sig:
Logs.debug("task: task %r must run: an output node has no signature" % self)
return RUN_ME
@ -628,14 +628,14 @@ class Task(TaskBase):
The node signature is obtained from the task signature, but the output nodes may also get the signature
of their contents. See the class decorator :py:func:`waflib.Task.update_outputs` if you need this behaviour.
"""
dct = self.generator.bld.task_sigs
bld = self.generator.bld
for node in self.outputs:
if not node.exists():
self.hasrun = MISSING
self.err_msg = '-> missing file: %r' % node.abspath()
raise Errors.WafError(self.err_msg)
dct[node] = self.uid() # make sure this task produced the files in question
dct[self.uid()] = self.signature()
bld.node_sigs[node] = self.uid() # make sure this task produced the files in question
bld.task_sigs[self.uid()] = self.signature()
def sig_explicit_deps(self):
"""
@ -729,7 +729,7 @@ class Task(TaskBase):
# get the task signatures from previous runs
key = self.uid()
prev = bld.task_sigs.get((key, 'imp'), [])
prev = bld.imp_sigs.get(key, [])
# for issue #379
if prev:
@ -751,7 +751,7 @@ class Task(TaskBase):
del x.parent.children[x.name]
except KeyError:
pass
del bld.task_sigs[(key, 'imp')]
del bld.imp_sigs[key]
raise Errors.TaskRescan('rescan')
# no previous run or the signature of the dependencies has changed, rescan the dependencies
@ -768,7 +768,7 @@ class Task(TaskBase):
# recompute the signature and return it
try:
bld.task_sigs[(key, 'imp')] = sig = self.compute_sig_implicit_deps()
bld.imp_sigs[key] = sig = self.compute_sig_implicit_deps()
except Exception:
if Logs.verbose:
for k in bld.node_deps.get(self.uid(), []):

View File

@ -301,7 +301,7 @@ class javac(Task.Task):
"""
"""
for node in self.generator.outdir.ant_glob('**/*.class'):
bld.task_sigs[node] = self.uid()
bld.node_sigs[node] = self.uid()
self.generator.bld.task_sigs[self.uid()] = self.cache_sig
@feature('javadoc')
@ -351,7 +351,7 @@ class javadoc(Task.Task):
def post_run(self):
nodes = self.generator.javadoc_output.ant_glob('**')
for nodes in nodes:
bld.task_sigs[node] = self.uid()
bld.node_sigs[node] = self.uid()
self.generator.bld.task_sigs[self.uid()] = self.cache_sig
def configure(self):

View File

@ -148,7 +148,7 @@ class doxygen(Task.Task):
def post_run(self):
nodes = self.output_dir.ant_glob('**/*', quiet=True)
for x in nodes:
self.generator.bld.task_sigs[x.abspath()] = self.uid()
self.generator.bld.node_sigs[x] = self.uid()
self.add_install()
return Task.Task.post_run(self)