Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Unified Diff: tools/clang/scripts/generate_win_compdb.py

Issue 2542563002: Clang scripts updates. (Closed)
Patch Set: nits Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/clang/scripts/run_tool.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/clang/scripts/generate_win_compdb.py
diff --git a/tools/clang/scripts/generate_win_compdb.py b/tools/clang/scripts/generate_win_compdb.py
index 32f5f753c5316b3489249ae57379a64b92855d29..a7a7ba647d83a926c55c7bf195fcd88022bc6a50 100755
--- a/tools/clang/scripts/generate_win_compdb.py
+++ b/tools/clang/scripts/generate_win_compdb.py
@@ -11,6 +11,7 @@ which also confuses clang. This script generates a compile DB that should mostly
work until clang tooling can be improved upstream.
"""
+import argparse
import os
import re
import json
@@ -60,10 +61,18 @@ def _ProcessEntry(e):
def main(argv):
+ # Parse argument
+ parser = argparse.ArgumentParser()
+ parser.add_argument(
+ 'build_path',
+ nargs='?',
+ help='Path to build directory',
+ default='out/Debug')
+ args = parser.parse_args()
# First, generate the compile database.
print 'Generating compile DB with ninja...'
compile_db_as_json = subprocess.check_output(shlex.split(
- 'ninja -C out/Debug -t compdb cc cxx objc objcxx'))
+ 'ninja -C %s -t compdb cc cxx objc objcxx' % args.build_path))
compile_db = json.loads(compile_db_as_json)
print 'Read in %d entries from the compile db' % len(compile_db)
@@ -74,7 +83,7 @@ def main(argv):
compile_db = [e for e in compile_db if '_nacl.cc.pdb' not in e['command']
and '_nacl_win64.cc.pdb' not in e['command']]
print 'Filtered out %d entries...' % (original_length - len(compile_db))
- f = file('out/Debug/compile_commands.json', 'w')
+ f = file('%s/compile_commands.json' % args.build_path, 'w')
f.write(json.dumps(compile_db, indent=2))
print 'Done!'
« no previous file with comments | « no previous file | tools/clang/scripts/run_tool.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698