• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python
2# Copyright 2017 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        sys.executable,
17        os.path.join(common.SRC_DIR, 'build', 'check_gn_headers.py'),
18        '--out-dir',
19        args.build_dir,
20        '--whitelist',
21        os.path.join(common.SRC_DIR, 'build', 'check_gn_headers_whitelist.txt'),
22        '--json',
23        tempfile_path,
24        '--verbose',
25    ],
26                            cwd=common.SRC_DIR)
27
28    with open(tempfile_path) as f:
29      failures = json.load(f)
30
31  json.dump({
32      'valid': True,
33      'failures': failures,
34  }, args.output)
35
36  return rc
37
38
39def main_compile_targets(args):
40  json.dump([], args.output)
41
42
43if __name__ == '__main__':
44  funcs = {
45      'run': main_run,
46      'compile_targets': main_compile_targets,
47  }
48  common.run_script(sys.argv[1:], funcs)
49