Commit 7e7e8721 authored by Owen Rodley's avatar Owen Rodley Committed by Commit Bot

Add '-o' argument to generate_compdb, to write to a file.

We currently need to work around ninja writing to stdout in the
codesearch builders by using a wrapper script. If we're to use this
script instead, we may as well bake this in here and remove the need for
a wrapper.

Bug: 396230
Change-Id: If161310d2b93c4fed2ee2de1c4b3fba8b9aa2313
Reviewed-on: https://chromium-review.googlesource.com/1124124
Commit-Queue: Owen Rodley <orodley@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#572424}
parent e7571198
......@@ -32,11 +32,20 @@ def main(argv):
'targets',
nargs='*',
help='Additional targets to pass to ninja')
parser.add_argument(
'-o',
help='File to write the compilation database to. Defaults to stdout')
args = parser.parse_args()
print json.dumps(
compdb_text = json.dumps(
compile_db.ProcessCompileDatabaseIfNeeded(
compile_db.GenerateWithNinja(args.p, args.targets))
if args.o is None:
print(compdb_text)
else:
with open(args.o, 'w') as f:
f.write(compdb_text)
if __name__ == '__main__':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment