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 10 11# Add src/testing/ into sys.path for importing common without pylint errors. 12sys.path.append( 13 os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir))) 14from scripts import common 15 16 17def main_run(args): 18 with common.temporary_file() as tempfile_path: 19 rc = common.run_command([ 20 os.path.join(common.SRC_DIR, 'buildtools', 'checkdeps', 'checkdeps.py'), 21 '--json', tempfile_path 22 ]) 23 24 with open(tempfile_path) as f: 25 checkdeps_results = json.load(f) 26 27 result_set = set() 28 for result in checkdeps_results: 29 for violation in result['violations']: 30 result_set.add((result['dependee_path'], violation['include_path'])) 31 32 failures = ['%s: %s' % (r[0], r[1]) for r in result_set] 33 common.record_local_script_results('checkdeps', args.output, failures, True) 34 35 return rc 36 37 38def main_compile_targets(args): 39 json.dump([], args.output) 40 41 42if __name__ == '__main__': 43 funcs = { 44 'run': main_run, 45 'compile_targets': main_compile_targets, 46 } 47 sys.exit(common.run_script(sys.argv[1:], funcs)) 48