check_gn_headers.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. import json
  6. import os
  7. import sys
  8. # Add src/testing/ into sys.path for importing common without pylint errors.
  9. sys.path.append(
  10. os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
  11. from scripts import common
  12. def main_run(args):
  13. with common.temporary_file() as tempfile_path:
  14. rc = common.run_command([
  15. sys.executable,
  16. os.path.join(common.SRC_DIR, 'build', 'check_gn_headers.py'),
  17. '--out-dir',
  18. os.path.join(args.paths['checkout'], 'out', args.build_config_fs),
  19. '--whitelist',
  20. os.path.join(common.SRC_DIR, 'build', 'check_gn_headers_whitelist.txt'),
  21. '--json', tempfile_path,
  22. '--verbose',
  23. ], cwd=common.SRC_DIR)
  24. with open(tempfile_path) as f:
  25. failures = json.load(f)
  26. json.dump({
  27. 'valid': True,
  28. 'failures': failures,
  29. }, args.output)
  30. return rc
  31. def main_compile_targets(args):
  32. json.dump([], args.output)
  33. if __name__ == '__main__':
  34. funcs = {
  35. 'run': main_run,
  36. 'compile_targets': main_compile_targets,
  37. }
  38. common.run_script(sys.argv[1:], funcs)