| 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. | 282 # include dir, but not include/private. |
| 283 if file_ext == '.h' and 'include' == file_path.split(os.path.sep)[0]: | 283 if (file_ext == '.h' and |
| 284 'include' == file_path.split(os.path.sep)[0] and |
| 285 'private' not in file_path): |
| 284 requires_owner_check = True | 286 requires_owner_check = True |
| 285 | 287 |
| 286 if not requires_owner_check: | 288 if not requires_owner_check: |
| 287 return results | 289 return results |
| 288 | 290 |
| 289 lgtm_from_owner = False | 291 lgtm_from_owner = False |
| 290 issue = input_api.change.issue | 292 issue = input_api.change.issue |
| 291 if issue and input_api.rietveld: | 293 if issue and input_api.rietveld: |
| 292 issue_properties = input_api.rietveld.get_issue_properties( | 294 issue_properties = input_api.rietveld.get_issue_properties( |
| 293 issue=int(issue), messages=True) | 295 issue=int(issue), messages=True) |
| (...skipping 27 matching lines...) Expand all Loading... |
| 321 for message in messages: | 323 for message in messages: |
| 322 if (message['sender'] in PUBLIC_API_OWNERS and | 324 if (message['sender'] in PUBLIC_API_OWNERS and |
| 323 'lgtm' in message['text'].lower()): | 325 'lgtm' in message['text'].lower()): |
| 324 # Found an lgtm in a message from an owner. | 326 # Found an lgtm in a message from an owner. |
| 325 lgtm_from_owner = True | 327 lgtm_from_owner = True |
| 326 break | 328 break |
| 327 | 329 |
| 328 if not lgtm_from_owner: | 330 if not lgtm_from_owner: |
| 329 results.append( | 331 results.append( |
| 330 output_api.PresubmitError( | 332 output_api.PresubmitError( |
| 331 'Since the CL is editing public API, you must have an LGTM from ' | 333 "If this CL adds to or changes Skia's public API, you need an LGTM " |
| 332 'one of: %s' % str(PUBLIC_API_OWNERS))) | 334 "from any of %s. If this CL only removes from or doesn't change " |
| 335 "Skia's public API, please add a short note to the CL saying so " |
| 336 "and add one of those reviewers on a TBR= line. If you don't know " |
| 337 "if this CL affects Skia's public API, treat it like it does." |
| 338 % str(PUBLIC_API_OWNERS))) |
| 333 return results | 339 return results |
| 334 | 340 |
| 335 | 341 |
| 336 def PostUploadHook(cl, change, output_api): | 342 def PostUploadHook(cl, change, output_api): |
| 337 """git cl upload will call this hook after the issue is created/modified. | 343 """git cl upload will call this hook after the issue is created/modified. |
| 338 | 344 |
| 339 This hook does the following: | 345 This hook does the following: |
| 340 * Adds a link to preview docs changes if there are any docs changes in the CL. | 346 * Adds a link to preview docs changes if there are any docs changes in the CL. |
| 341 * Adds 'NOTRY=true' if the CL contains only docs changes. | 347 * Adds 'NOTRY=true' if the CL contains only docs changes. |
| 342 * Adds 'NOTREECHECKS=true' for non master branch changes since they do not | 348 * 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... |
| 485 state and an error if it is in 'Closed' state. | 491 state and an error if it is in 'Closed' state. |
| 486 """ | 492 """ |
| 487 results = [] | 493 results = [] |
| 488 results.extend(_CommonChecks(input_api, output_api)) | 494 results.extend(_CommonChecks(input_api, output_api)) |
| 489 results.extend( | 495 results.extend( |
| 490 _CheckTreeStatus(input_api, output_api, json_url=( | 496 _CheckTreeStatus(input_api, output_api, json_url=( |
| 491 SKIA_TREE_STATUS_URL + '/banner-status?format=json'))) | 497 SKIA_TREE_STATUS_URL + '/banner-status?format=json'))) |
| 492 results.extend(_CheckLGTMsForPublicAPI(input_api, output_api)) | 498 results.extend(_CheckLGTMsForPublicAPI(input_api, output_api)) |
| 493 results.extend(_CheckOwnerIsInAuthorsFile(input_api, output_api)) | 499 results.extend(_CheckOwnerIsInAuthorsFile(input_api, output_api)) |
| 494 return results | 500 return results |
| OLD | NEW |