1#!/usr/bin/env python 2# Copyright 2014 The Chromium Authors 3# Use of this source code is governed by a BSD-style license that can be 4# found in the LICENSE file. 5 6import json 7import os 8import sys 9 10import common 11 12 13def main_run(args): 14 with common.temporary_file() as tempfile_path: 15 rc = common.run_command([ 16 os.path.join(common.SRC_DIR, 'buildtools', 'checkdeps', 'checkdeps.py'), 17 '--json', tempfile_path 18 ]) 19 20 with open(tempfile_path) as f: 21 checkdeps_results = json.load(f) 22 23 result_set = set() 24 for result in checkdeps_results: 25 for violation in result['violations']: 26 result_set.add((result['dependee_path'], violation['include_path'])) 27 28 failures = ['%s: %s' % (r[0], r[1]) for r in result_set] 29 common.record_local_script_results('checkdeps', args.output, failures, True) 30 31 return rc 32 33 34def main_compile_targets(args): 35 json.dump([], args.output) 36 37 38if __name__ == '__main__': 39 funcs = { 40 'run': main_run, 41 'compile_targets': main_compile_targets, 42 } 43 sys.exit(common.run_script(sys.argv[1:], funcs)) 44