mirror of
https://gitlab.com/ita1024/waf.git
synced 2024-11-26 03:39:53 +01:00
Make clang_compilation_database add-on always output complete listings.
This commit is contained in:
parent
7779706bc9
commit
70616f2b7d
@ -66,3 +66,24 @@ def write_compilation_database(ctx):
|
||||
root = list(clang_db.values())
|
||||
database_file.write(json.dumps(root, indent=2))
|
||||
|
||||
# Override the runnable_status function to do a dummy/dry run when the file doesn't need to be compiled.
|
||||
# This will make sure compile_commands.json is always fully up to date.
|
||||
# Previously you could end up with a partial compile_commands.json if the build failed.
|
||||
for x in ('c', 'cxx'):
|
||||
t = Task.classes[x]
|
||||
|
||||
def runnable_status(self):
|
||||
def exec_command(cmd, **kw):
|
||||
pass
|
||||
|
||||
run_status = self.old_runnable_status()
|
||||
if run_status == Task.SKIP_ME:
|
||||
setattr(self, 'old_exec_command', getattr(self, 'exec_command', None))
|
||||
setattr(self, 'exec_command', exec_command)
|
||||
self.run()
|
||||
setattr(self, 'exec_command', getattr(self, 'old_exec_command', None))
|
||||
return run_status
|
||||
|
||||
setattr(t, 'old_runnable_status', getattr(t, 'runnable_status', None))
|
||||
setattr(t, 'runnable_status', runnable_status)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user