OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Presubmit script for changes affecting extensions docs server | 5 """Presubmit script for changes affecting extensions docs server |
6 | 6 |
7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts | 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts |
8 for more details about the presubmit API built into gcl. | 8 for more details about the presubmit API built into gcl. |
9 """ | 9 """ |
10 | 10 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 Q: Is this a non-trivial change to the server? | 57 Q: Is this a non-trivial change to the server? |
58 Yes? Bump the end version. | 58 Yes? Bump the end version. |
59 Unlike above, the server will *not* stop updating. | 59 Unlike above, the server will *not* stop updating. |
60 No? Are you sure? How much do you bet? This can't be rolled back... | 60 No? Are you sure? How much do you bet? This can't be rolled back... |
61 | 61 |
62 Q: Is this a spelling correction? New test? Better comments? | 62 Q: Is this a spelling correction? New test? Better comments? |
63 Yes? Ok fine. Ignore this warning. | 63 Yes? Ok fine. Ignore this warning. |
64 No? I guess this presubmit check doesn't work. | 64 No? I guess this presubmit check doesn't work. |
65 ''')] | 65 ''')] |
66 | 66 |
67 def _CheckYamlConsistency(input_api, output_api): | |
68 app_yaml_path = os.path.join(input_api.PresubmitLocalPath(), 'app.yaml') | |
69 cron_yaml_path = os.path.join(input_api.PresubmitLocalPath(), 'cron.yaml') | |
70 if not (app_yaml_path in input_api.AbsoluteLocalPaths() or | |
71 cron_yaml_path in input_api.AbsoluteLocalPaths()): | |
72 return [] | |
73 | |
74 AppYamlHelper = _ImportAppYamlHelper(input_api) | |
75 app_yaml_version = AppYamlHelper.ExtractVersion( | |
76 input_api.ReadFile(app_yaml_path)) | |
77 cron_yaml_version = AppYamlHelper.ExtractVersion( | |
78 input_api.ReadFile(cron_yaml_path), key='target') | |
79 | |
80 if app_yaml_version == cron_yaml_version: | |
81 return [] | |
82 return [output_api.PresubmitError( | |
83 'Versions of app.yaml (%s) and cron.yaml (%s) must match' % ( | |
84 app_yaml_version, cron_yaml_version))] | |
85 | |
86 def _RunPresubmit(input_api, output_api): | 67 def _RunPresubmit(input_api, output_api): |
87 _BuildServer(input_api) | 68 _BuildServer(input_api) |
88 return ( | 69 return ( |
89 _WarnIfAppYamlHasntChanged(input_api, output_api) + | 70 _WarnIfAppYamlHasntChanged(input_api, output_api) + |
90 _CheckYamlConsistency(input_api, output_api) + | |
91 input_api.canned_checks.RunUnitTestsInDirectory( | 71 input_api.canned_checks.RunUnitTestsInDirectory( |
92 input_api, output_api, '.', whitelist=WHITELIST, blacklist=BLACKLIST) | 72 input_api, output_api, '.', whitelist=WHITELIST, blacklist=BLACKLIST) |
93 ) | 73 ) |
94 | 74 |
95 def CheckChangeOnUpload(input_api, output_api): | 75 def CheckChangeOnUpload(input_api, output_api): |
96 return _RunPresubmit(input_api, output_api) | 76 return _RunPresubmit(input_api, output_api) |
97 | 77 |
98 def CheckChangeOnCommit(input_api, output_api): | 78 def CheckChangeOnCommit(input_api, output_api): |
99 return _RunPresubmit(input_api, output_api) | 79 return _RunPresubmit(input_api, output_api) |
OLD | NEW |