blob: 31599477e957577488d3b495d8c0cdc30b751d1e [file] [log] [blame]
rmistry@google.com8e3ff8c2013-01-17 12:55:34 +00001# 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.
4
5
6"""Top-level presubmit script for Skia.
7
8See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
9for more details about the presubmit API built into gcl.
10"""
11
rmistry@google.com6be0b4c2013-01-17 14:50:59 +000012def _CommonChecks(input_api, output_api):
13 """Presubmit checks common to upload and commit."""
14 results = []
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'))
21 results.extend(
22 input_api.canned_checks.CheckChangeHasOnlyOneEol(
23 input_api, output_api, source_file_filter=sources))
24 return results
25
rmistry@google.com8e3ff8c2013-01-17 12:55:34 +000026
27def CheckChangeOnUpload(input_api, output_api):
rmistry@google.com6be0b4c2013-01-17 14:50:59 +000028 """Presubmit checks for the change on upload.
29
30 The following are the presubmit checks:
31 * Check change has one and only one EOL.
32 """
33 results = []
34 results.extend(_CommonChecks(input_api, output_api))
35 return results
rmistry@google.com8e3ff8c2013-01-17 12:55:34 +000036
37
38def CheckChangeOnCommit(input_api, output_api):
39 """Presubmit checks for the change on commit.
40
41 The following are the presubmit checks:
rmistry@google.com6be0b4c2013-01-17 14:50:59 +000042 * Check change has one and only one EOL.
rmistry@google.com8e3ff8c2013-01-17 12:55:34 +000043 * Ensures that the Skia tree is not closed in
44 http://skia-tree-status.appspot.com/
45 """
46 results = []
rmistry@google.com6be0b4c2013-01-17 14:50:59 +000047 results.extend(_CommonChecks(input_api, output_api))
rmistry@google.com8e3ff8c2013-01-17 12:55:34 +000048 results.extend(
49 input_api.canned_checks.CheckTreeIsOpen(
50 input_api, output_api, json_url=(
51 'http://skia-tree-status.appspot.com/banner-status?format=json')))
52 return results