mirror of https://gitlab.com/ita1024/waf.git
Cleanup
This commit is contained in:
parent
76eac19c02
commit
3169e0bd4b
|
@ -15,15 +15,14 @@ Usage:
|
|||
"""
|
||||
|
||||
import sys, os, json, shlex, pipes
|
||||
from waflib import Logs, TaskGen
|
||||
from waflib.Tools import c, cxx
|
||||
from waflib import Logs, TaskGen, Task
|
||||
|
||||
if sys.hexversion >= 0x3030000:
|
||||
quote = shlex.quote
|
||||
else:
|
||||
quote = pipes.quote
|
||||
|
||||
@TaskGen.feature('*')
|
||||
@TaskGen.feature('c', 'cxx')
|
||||
@TaskGen.after_method('process_use')
|
||||
def collect_compilation_db_tasks(self):
|
||||
"Add a compilation database entry for compiled tasks"
|
||||
|
@ -33,8 +32,9 @@ def collect_compilation_db_tasks(self):
|
|||
clang_db = self.bld.clang_compilation_database_tasks = []
|
||||
self.bld.add_post_fun(write_compilation_database)
|
||||
|
||||
tup = tuple(y for y in [Task.classes.get(x) for x in ('c', 'cxx')] if y)
|
||||
for task in getattr(self, 'compiled_tasks', []):
|
||||
if isinstance(task, (c.c, cxx.cxx)):
|
||||
if isinstance(task, tup):
|
||||
clang_db.append(task)
|
||||
|
||||
def write_compilation_database(ctx):
|
||||
|
@ -45,7 +45,7 @@ def write_compilation_database(ctx):
|
|||
root = json.load(database_file)
|
||||
except IOError:
|
||||
root = []
|
||||
clang_db = dict((x["file"], x) for x in root)
|
||||
clang_db = dict((x['file'], x) for x in root)
|
||||
for task in getattr(ctx, 'clang_compilation_database_tasks', []):
|
||||
try:
|
||||
cmd = task.last_cmd
|
||||
|
|
Loading…
Reference in New Issue