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:
parent
6648d3e6e7
commit
5a3a89b4de
2
TODO
2
TODO
@ -1,7 +1,6 @@
|
|||||||
Waf 1.9
|
Waf 1.9
|
||||||
-------
|
-------
|
||||||
|
|
||||||
* Reduce the key size in bld.task_sigs
|
|
||||||
* Provide a more efficient ConfigSet implementation
|
* Provide a more efficient ConfigSet implementation
|
||||||
* Ensure _cache.py are valid python files
|
* Ensure _cache.py are valid python files
|
||||||
* Rework qt5
|
* Rework qt5
|
||||||
@ -25,4 +24,5 @@ Done
|
|||||||
* Remove Node.cache_sig and Node.sig #1580
|
* Remove Node.cache_sig and Node.sig #1580
|
||||||
* Remove __hash__ and __eq__ from Node and Task #1629
|
* Remove __hash__ and __eq__ from Node and Task #1629
|
||||||
* Set cflags in the beginning / cppflags at the end #1505
|
* 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
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ def runnable_status(self):
|
|||||||
if add:
|
if add:
|
||||||
# recompute the task signature
|
# recompute the task signature
|
||||||
delattr(self, 'cache_sig')
|
delattr(self, 'cache_sig')
|
||||||
del bld.task_sigs[(self.uid(), 'imp')]
|
del bld.imp_sigs[self.uid()]
|
||||||
return self.runnable_status()
|
return self.runnable_status()
|
||||||
|
|
||||||
for x in bld.node_deps[self.uid()]:
|
for x in bld.node_deps[self.uid()]:
|
||||||
|
@ -29,8 +29,8 @@ INSTALL = 1337
|
|||||||
UNINSTALL = -1337
|
UNINSTALL = -1337
|
||||||
"""Negative value '<-' uninstall, see :py:attr:`waflib.Build.BuildContext.is_install`"""
|
"""Negative value '<-' uninstall, see :py:attr:`waflib.Build.BuildContext.is_install`"""
|
||||||
|
|
||||||
SAVED_ATTRS = 'root node_deps raw_deps task_sigs'.split()
|
SAVED_ATTRS = 'root node_sigs task_sigs imp_sigs raw_deps node_deps'.split()
|
||||||
"""Build class members to save between the runs (root, node_deps, raw_deps, task_sigs)"""
|
"""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'
|
CFG_FILES = 'cfg_files'
|
||||||
"""Files from the build directory to hash before starting the build (``config.h`` written during the configuration)"""
|
"""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
|
# 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 = {}
|
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 = {}
|
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 = {}
|
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
|
# list of folders that are already scanned
|
||||||
# so that we do not need to stat them one more time
|
# so that we do not need to stat them one more time
|
||||||
@ -1214,7 +1220,7 @@ class CleanContext(BuildContext):
|
|||||||
n.delete()
|
n.delete()
|
||||||
self.root.children = {}
|
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, {})
|
setattr(self, v, {})
|
||||||
|
|
||||||
class ListContext(BuildContext):
|
class ListContext(BuildContext):
|
||||||
|
@ -816,7 +816,7 @@ class Node(object):
|
|||||||
the signature calculation relies on an existing attribute. Else the
|
the signature calculation relies on an existing attribute. Else the
|
||||||
signature is calculated automatically.
|
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())
|
return Utils.h_file(self.abspath())
|
||||||
|
|
||||||
# --------------------------------------------
|
# --------------------------------------------
|
||||||
|
@ -280,9 +280,8 @@ class Parallel(object):
|
|||||||
"""
|
"""
|
||||||
if hasattr(tsk, 'scan') and hasattr(tsk, 'uid'):
|
if hasattr(tsk, 'scan') and hasattr(tsk, 'uid'):
|
||||||
# TODO waf 1.9 - this breaks encapsulation
|
# TODO waf 1.9 - this breaks encapsulation
|
||||||
key = (tsk.uid(), 'imp')
|
|
||||||
try:
|
try:
|
||||||
del self.bld.task_sigs[key]
|
del self.bld.imp_sigs[tsk.uid()]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
if not self.bld.keep:
|
if not self.bld.keep:
|
||||||
|
@ -607,7 +607,7 @@ class Task(TaskBase):
|
|||||||
|
|
||||||
# compare the signatures of the outputs
|
# compare the signatures of the outputs
|
||||||
for node in self.outputs:
|
for node in self.outputs:
|
||||||
sig = bld.task_sigs.get(node, None)
|
sig = bld.node_sigs.get(node, None)
|
||||||
if not sig:
|
if not sig:
|
||||||
Logs.debug("task: task %r must run: an output node has no signature" % self)
|
Logs.debug("task: task %r must run: an output node has no signature" % self)
|
||||||
return RUN_ME
|
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
|
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.
|
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:
|
for node in self.outputs:
|
||||||
if not node.exists():
|
if not node.exists():
|
||||||
self.hasrun = MISSING
|
self.hasrun = MISSING
|
||||||
self.err_msg = '-> missing file: %r' % node.abspath()
|
self.err_msg = '-> missing file: %r' % node.abspath()
|
||||||
raise Errors.WafError(self.err_msg)
|
raise Errors.WafError(self.err_msg)
|
||||||
dct[node] = self.uid() # make sure this task produced the files in question
|
bld.node_sigs[node] = self.uid() # make sure this task produced the files in question
|
||||||
dct[self.uid()] = self.signature()
|
bld.task_sigs[self.uid()] = self.signature()
|
||||||
|
|
||||||
def sig_explicit_deps(self):
|
def sig_explicit_deps(self):
|
||||||
"""
|
"""
|
||||||
@ -729,7 +729,7 @@ class Task(TaskBase):
|
|||||||
|
|
||||||
# get the task signatures from previous runs
|
# get the task signatures from previous runs
|
||||||
key = self.uid()
|
key = self.uid()
|
||||||
prev = bld.task_sigs.get((key, 'imp'), [])
|
prev = bld.imp_sigs.get(key, [])
|
||||||
|
|
||||||
# for issue #379
|
# for issue #379
|
||||||
if prev:
|
if prev:
|
||||||
@ -751,7 +751,7 @@ class Task(TaskBase):
|
|||||||
del x.parent.children[x.name]
|
del x.parent.children[x.name]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
del bld.task_sigs[(key, 'imp')]
|
del bld.imp_sigs[key]
|
||||||
raise Errors.TaskRescan('rescan')
|
raise Errors.TaskRescan('rescan')
|
||||||
|
|
||||||
# no previous run or the signature of the dependencies has changed, rescan the dependencies
|
# 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
|
# recompute the signature and return it
|
||||||
try:
|
try:
|
||||||
bld.task_sigs[(key, 'imp')] = sig = self.compute_sig_implicit_deps()
|
bld.imp_sigs[key] = sig = self.compute_sig_implicit_deps()
|
||||||
except Exception:
|
except Exception:
|
||||||
if Logs.verbose:
|
if Logs.verbose:
|
||||||
for k in bld.node_deps.get(self.uid(), []):
|
for k in bld.node_deps.get(self.uid(), []):
|
||||||
|
@ -301,7 +301,7 @@ class javac(Task.Task):
|
|||||||
"""
|
"""
|
||||||
"""
|
"""
|
||||||
for node in self.generator.outdir.ant_glob('**/*.class'):
|
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
|
self.generator.bld.task_sigs[self.uid()] = self.cache_sig
|
||||||
|
|
||||||
@feature('javadoc')
|
@feature('javadoc')
|
||||||
@ -351,7 +351,7 @@ class javadoc(Task.Task):
|
|||||||
def post_run(self):
|
def post_run(self):
|
||||||
nodes = self.generator.javadoc_output.ant_glob('**')
|
nodes = self.generator.javadoc_output.ant_glob('**')
|
||||||
for nodes in nodes:
|
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
|
self.generator.bld.task_sigs[self.uid()] = self.cache_sig
|
||||||
|
|
||||||
def configure(self):
|
def configure(self):
|
||||||
|
@ -148,7 +148,7 @@ class doxygen(Task.Task):
|
|||||||
def post_run(self):
|
def post_run(self):
|
||||||
nodes = self.output_dir.ant_glob('**/*', quiet=True)
|
nodes = self.output_dir.ant_glob('**/*', quiet=True)
|
||||||
for x in nodes:
|
for x in nodes:
|
||||||
self.generator.bld.task_sigs[x.abspath()] = self.uid()
|
self.generator.bld.node_sigs[x] = self.uid()
|
||||||
self.add_install()
|
self.add_install()
|
||||||
return Task.Task.post_run(self)
|
return Task.Task.post_run(self)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user