| wychen | f7d9e91 | 2017-06-05 19:35:17 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | # Copyright 2017 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 | |
| 6 | import json |
| 7 | import os |
| 8 | import sys |
| 9 | |
| Joshua Hood | 3fade1f | 2022-05-04 16:00:42 | [diff] [blame] | 10 | # Add src/testing/ into sys.path for importing common without pylint errors. |
| 11 | sys.path.append( |
| 12 | os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir))) |
| 13 | from scripts import common |
| wychen | f7d9e91 | 2017-06-05 19:35:17 | [diff] [blame] | 14 | |
| 15 | |
| 16 | def main_run(args): |
| 17 | with common.temporary_file() as tempfile_path: |
| 18 | rc = common.run_command([ |
| 19 | sys.executable, |
| 20 | os.path.join(common.SRC_DIR, 'build', 'check_gn_headers.py'), |
| 21 | '--out-dir', |
| 22 | os.path.join(args.paths['checkout'], 'out', args.build_config_fs), |
| 23 | '--whitelist', |
| 24 | os.path.join(common.SRC_DIR, 'build', 'check_gn_headers_whitelist.txt'), |
| wychen | 8cc3123 | 2017-06-13 10:21:23 | [diff] [blame] | 25 | '--json', tempfile_path, |
| 26 | '--verbose', |
| wychen | f7d9e91 | 2017-06-05 19:35:17 | [diff] [blame] | 27 | ], cwd=common.SRC_DIR) |
| 28 | |
| 29 | with open(tempfile_path) as f: |
| 30 | failures = json.load(f) |
| 31 | |
| 32 | json.dump({ |
| 33 | 'valid': True, |
| 34 | 'failures': failures, |
| 35 | }, args.output) |
| 36 | |
| 37 | return rc |
| 38 | |
| 39 | |
| 40 | def main_compile_targets(args): |
| 41 | json.dump([], args.output) |
| 42 | |
| 43 | |
| 44 | if __name__ == '__main__': |
| 45 | funcs = { |
| 46 | 'run': main_run, |
| 47 | 'compile_targets': main_compile_targets, |
| 48 | } |
| Wei-Yin Chen (陳威尹) | 2c7c438 | 2017-07-14 16:29:12 | [diff] [blame] | 49 | common.run_script(sys.argv[1:], funcs) |