2
0
mirror of https://gitlab.com/ita1024/waf.git synced 2024-11-25 11:19:52 +01:00
This commit is contained in:
Thomas Nagy 2016-08-13 19:53:41 +02:00
parent f5cfef4be3
commit 51c5df5a11
No known key found for this signature in database
GPG Key ID: 49B4C67C05277AAA

View File

@ -3,14 +3,15 @@
""" """
This is a hack; In general two tasks should not provide This is a hack; In general two tasks should not provide
the same output nodes (bad abstraction), and this cannot the same output nodes (bad abstraction), and this cannot
scale to do more operations than just stripping scale to more than one operation
In this case, the strip task has the same inputs as outputs In this case, the strip task has the same inputs as outputs
so the constraints added by Task.set_file_constraints so the constraints added by Task.set_file_constraints
will cause a deadlock: to prevent race conditions:
- By setting the input node to be the link task output node - By setting the input node to be the link task output node
the strip tasks will run after the link task the strip tasks will run after their link tasks
- By setting the output node to be the link task output node - By setting the output node to be the link task output node,
any other task that also uses this output node will wait any other task that also uses this output node will wait
for the strip task to finish too for the strip task to finish too
- By overriding the runnable_status method, the strip task - By overriding the runnable_status method, the strip task
@ -38,18 +39,16 @@ class strip(Task.Task):
return ret return ret
if self.generator.link_task.hasrun == Task.SUCCESS: if self.generator.link_task.hasrun == Task.SUCCESS:
# ensure that stripping always runs
# when a binary is written
return Task.RUN_ME return Task.RUN_ME
return Task.SKIP_ME return Task.SKIP_ME
@TaskGen.feature('cshlib', 'cxxshlib', 'cprogram', 'cxxprogram', 'fcprogram', 'fcshlib') @TaskGen.feature('cshlib', 'cxxshlib', 'cprogram', 'cxxprogram', 'fcprogram', 'fcshlib')
@TaskGen.after('apply_link') @TaskGen.after('apply_link')
def add_strip_task(self): def add_strip_task(self):
try: if getattr(self, 'link_task', None):
link_task = self.link_task exe_node = self.link_task.outputs[0]
except AttributeError: # special case: same inputs and outputs for a task
return self.create_task('strip', exe_node, exe_node)
# special case, a task with same inputs and outputs
exe_node = link_task.outputs[0]
self.create_task('strip', exe_node, exe_node)