Shahbaz Youssefi | 98a3550 | 2019-01-08 22:09:39 -0500 | [diff] [blame^] | 1 | # Copyright 2019 The ANGLE Project Authors. All rights reserved. |
| 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
| 4 | |
| 5 | """Top-level presubmit script for code generation. |
| 6 | |
| 7 | See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts |
| 8 | for more details on the presubmit API built into depot_tools. |
| 9 | """ |
| 10 | |
| 11 | from subprocess import call |
| 12 | |
| 13 | def TestCodeGeneration(input_api, output_api): |
| 14 | code_gen_path = input_api.os_path.join(input_api.PresubmitLocalPath(), |
| 15 | 'scripts/run_code_generation.py') |
| 16 | cmd_name = 'run_code_generation' |
| 17 | cmd = [input_api.python_executable, code_gen_path, '--verify-no-dirty'] |
| 18 | test_cmd = input_api.Command( |
| 19 | name=cmd_name, |
| 20 | cmd=cmd, |
| 21 | kwargs={}, |
| 22 | message=output_api.PresubmitError) |
| 23 | if input_api.verbose: |
| 24 | print('Running ' + cmd_name) |
| 25 | return input_api.RunTests([test_cmd]) |
| 26 | |
| 27 | def CheckChangeOnUpload(input_api, output_api): |
| 28 | output = TestCodeGeneration(input_api, output_api) |
| 29 | |
| 30 | if not input_api.change.BUG: |
| 31 | output += [output_api.PresubmitError( |
| 32 | 'Must provide a Bug: line.')] |
| 33 | return output |
| 34 | |
| 35 | def CheckChangeOnCommit(input_api, output_api): |
| 36 | return [] |