blob: d904a315d8e41fe349b5926af8e2ca0e13b09fc7 [file] [log] [blame]
Shahbaz Youssefi98a35502019-01-08 22:09:39 -05001# 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
7See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
8for more details on the presubmit API built into depot_tools.
9"""
10
11from subprocess import call
12
13def 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
27def 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
35def CheckChangeOnCommit(input_api, output_api):
36 return []