OLD | NEW |
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 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 | 5 |
6 """Top-level presubmit script for Skia. | 6 """Top-level presubmit script for Skia. |
7 | 7 |
8 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts | 8 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts |
9 for more details about the presubmit API built into gcl. | 9 for more details about the presubmit API built into gcl. |
10 """ | 10 """ |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 | 272 |
273 For public API files make sure there is an LGTM from the list of owners in | 273 For public API files make sure there is an LGTM from the list of owners in |
274 PUBLIC_API_OWNERS. | 274 PUBLIC_API_OWNERS. |
275 """ | 275 """ |
276 results = [] | 276 results = [] |
277 requires_owner_check = False | 277 requires_owner_check = False |
278 for affected_file in input_api.AffectedFiles(): | 278 for affected_file in input_api.AffectedFiles(): |
279 affected_file_path = affected_file.LocalPath() | 279 affected_file_path = affected_file.LocalPath() |
280 file_path, file_ext = os.path.splitext(affected_file_path) | 280 file_path, file_ext = os.path.splitext(affected_file_path) |
281 # We only care about files that end in .h and are under the top-level | 281 # We only care about files that end in .h and are under the top-level |
282 # include dir, but not include/private. | 282 # include dir. |
283 if (file_ext == '.h' and | 283 if file_ext == '.h' and 'include' == file_path.split(os.path.sep)[0]: |
284 'include' == file_path.split(os.path.sep)[0] and | |
285 'private' not in file_path): | |
286 requires_owner_check = True | 284 requires_owner_check = True |
287 | 285 |
288 if not requires_owner_check: | 286 if not requires_owner_check: |
289 return results | 287 return results |
290 | 288 |
291 lgtm_from_owner = False | 289 lgtm_from_owner = False |
292 issue = input_api.change.issue | 290 issue = input_api.change.issue |
293 if issue and input_api.rietveld: | 291 if issue and input_api.rietveld: |
294 issue_properties = input_api.rietveld.get_issue_properties( | 292 issue_properties = input_api.rietveld.get_issue_properties( |
295 issue=int(issue), messages=True) | 293 issue=int(issue), messages=True) |
(...skipping 27 matching lines...) Expand all Loading... |
323 for message in messages: | 321 for message in messages: |
324 if (message['sender'] in PUBLIC_API_OWNERS and | 322 if (message['sender'] in PUBLIC_API_OWNERS and |
325 'lgtm' in message['text'].lower()): | 323 'lgtm' in message['text'].lower()): |
326 # Found an lgtm in a message from an owner. | 324 # Found an lgtm in a message from an owner. |
327 lgtm_from_owner = True | 325 lgtm_from_owner = True |
328 break | 326 break |
329 | 327 |
330 if not lgtm_from_owner: | 328 if not lgtm_from_owner: |
331 results.append( | 329 results.append( |
332 output_api.PresubmitError( | 330 output_api.PresubmitError( |
333 "If this CL adds to or changes Skia's public API, you need an LGTM " | 331 'Since the CL is editing public API, you must have an LGTM from ' |
334 "from any of %s. If this CL only removes from or doesn't change " | 332 'one of: %s' % str(PUBLIC_API_OWNERS))) |
335 "Skia's public API, please add a short note to your CL saying so " | |
336 "and add one of those reviewers on a TBR= line. If you don't know " | |
337 "this CL affects Skia's public API, please treat it like it does." | |
338 % str(PUBLIC_API_OWNERS))) | |
339 return results | 333 return results |
340 | 334 |
341 | 335 |
342 def PostUploadHook(cl, change, output_api): | 336 def PostUploadHook(cl, change, output_api): |
343 """git cl upload will call this hook after the issue is created/modified. | 337 """git cl upload will call this hook after the issue is created/modified. |
344 | 338 |
345 This hook does the following: | 339 This hook does the following: |
346 * Adds a link to preview docs changes if there are any docs changes in the CL. | 340 * Adds a link to preview docs changes if there are any docs changes in the CL. |
347 * Adds 'NOTRY=true' if the CL contains only docs changes. | 341 * Adds 'NOTRY=true' if the CL contains only docs changes. |
348 * Adds 'NOTREECHECKS=true' for non master branch changes since they do not | 342 * Adds 'NOTREECHECKS=true' for non master branch changes since they do not |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 state and an error if it is in 'Closed' state. | 485 state and an error if it is in 'Closed' state. |
492 """ | 486 """ |
493 results = [] | 487 results = [] |
494 results.extend(_CommonChecks(input_api, output_api)) | 488 results.extend(_CommonChecks(input_api, output_api)) |
495 results.extend( | 489 results.extend( |
496 _CheckTreeStatus(input_api, output_api, json_url=( | 490 _CheckTreeStatus(input_api, output_api, json_url=( |
497 SKIA_TREE_STATUS_URL + '/banner-status?format=json'))) | 491 SKIA_TREE_STATUS_URL + '/banner-status?format=json'))) |
498 results.extend(_CheckLGTMsForPublicAPI(input_api, output_api)) | 492 results.extend(_CheckLGTMsForPublicAPI(input_api, output_api)) |
499 results.extend(_CheckOwnerIsInAuthorsFile(input_api, output_api)) | 493 results.extend(_CheckOwnerIsInAuthorsFile(input_api, output_api)) |
500 return results | 494 return results |
OLD | NEW |