1 # Copyright (c) 2013 The Chromium 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.
6 """Top-level presubmit script for Skia.
8 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
9 for more details about the presubmit API built into gcl.
12 def _CommonChecks(input_api, output_api):
13 """Presubmit checks common to upload and commit."""
15 sources = lambda x: (x.LocalPath().endswith('.h') or
16 x.LocalPath().endswith('.gypi') or
17 x.LocalPath().endswith('.gyp') or
18 x.LocalPath().endswith('.py') or
19 x.LocalPath().endswith('.sh') or
20 x.LocalPath().endswith('.cpp'))
22 input_api.canned_checks.CheckChangeHasOnlyOneEol(
23 input_api, output_api, source_file_filter=sources))
27 def CheckChangeOnUpload(input_api, output_api):
28 """Presubmit checks for the change on upload.
30 The following are the presubmit checks:
31 * Check change has one and only one EOL.
34 results.extend(_CommonChecks(input_api, output_api))
38 def CheckChangeOnCommit(input_api, output_api):
39 """Presubmit checks for the change on commit.
41 The following are the presubmit checks:
42 * Check change has one and only one EOL.
43 * Ensures that the Skia tree is not closed in
44 http://skia-tree-status.appspot.com/
47 results.extend(_CommonChecks(input_api, output_api))
49 input_api.canned_checks.CheckTreeIsOpen(
50 input_api, output_api, json_url=(
51 'http://skia-tree-status.appspot.com/banner-status?format=json')))