blob: d6140dac127c1f9ebb0cf3af04003f756263aad6 [file] [log] [blame]
James Robinsone2ac7e82014-10-15 13:21:59 -07001#!/usr/bin/env python
2# Copyright 2014 The Chromium Authors. All rights reserved.
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
James Robinsone2ac7e82014-10-15 13:21:59 -07006import json
7import os
James Robinsone2ac7e82014-10-15 13:21:59 -07008import sys
James Robinsone2ac7e82014-10-15 13:21:59 -07009
10
James Robinson30d547e2014-10-23 18:20:06 -070011import common
James Robinsone2ac7e82014-10-15 13:21:59 -070012
13
James Robinson30d547e2014-10-23 18:20:06 -070014def main_run(args):
15 with common.temporary_file() as tempfile_path:
16 rc = common.run_command([
17 os.path.join(common.SRC_DIR, 'buildtools', 'checkdeps', 'checkdeps.py'),
James Robinsone2ac7e82014-10-15 13:21:59 -070018 '--json', tempfile_path
19 ])
20
21 with open(tempfile_path) as f:
22 checkdeps_results = json.load(f)
23
24 result_set = set()
25 for result in checkdeps_results:
26 for violation in result['violations']:
27 result_set.add((result['dependee_path'], violation['include_path']))
28
James Robinson30d547e2014-10-23 18:20:06 -070029 json.dump({
30 'valid': True,
31 'failures': ['%s: %s' % (r[0], r[1]) for r in result_set],
32 }, args.output)
James Robinsone2ac7e82014-10-15 13:21:59 -070033
34 return rc
35
36
James Robinson30d547e2014-10-23 18:20:06 -070037def main_compile_targets(args):
38 json.dump([], args.output)
James Robinsone2ac7e82014-10-15 13:21:59 -070039
40
41if __name__ == '__main__':
James Robinson30d547e2014-10-23 18:20:06 -070042 funcs = {
43 'run': main_run,
44 'compile_targets': main_compile_targets,
45 }
46 sys.exit(common.run_script(sys.argv[1:], funcs))