blob: ccf0ba216a94a2150aafb5d3c2cd4a579341bfbf [file] [log] [blame]
wychenf7d9e912017-06-05 19:35:171#!/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
6import json
7import os
8import sys
9
Joshua Hood3fade1f2022-05-04 16:00:4210# Add src/testing/ into sys.path for importing common without pylint errors.
11sys.path.append(
12 os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
13from scripts import common
wychenf7d9e912017-06-05 19:35:1714
15
16def 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'),
wychen8cc31232017-06-13 10:21:2325 '--json', tempfile_path,
26 '--verbose',
wychenf7d9e912017-06-05 19:35:1727 ], 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
40def main_compile_targets(args):
41 json.dump([], args.output)
42
43
44if __name__ == '__main__':
45 funcs = {
46 'run': main_run,
47 'compile_targets': main_compile_targets,
48 }
Wei-Yin Chen (陳威尹)2c7c4382017-07-14 16:29:1249 common.run_script(sys.argv[1:], funcs)