Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(590)

Side by Side Diff: PRESUBMIT.py

Issue 808703005: Run gn check for an android build on presubmit (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebase Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | examples/device_name/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 """Top-level presubmit script for Chromium. 5 """Top-level presubmit script for Chromium.
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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 def __enter__(self): 420 def __enter__(self):
421 self.path = input_api.tempfile.mkdtemp() 421 self.path = input_api.tempfile.mkdtemp()
422 return self.path 422 return self.path
423 423
424 def __exit__(self, exc_type, exc_value, traceback): 424 def __exit__(self, exc_type, exc_value, traceback):
425 # input_api does not include shutil or any nice way to delete 425 # input_api does not include shutil or any nice way to delete
426 # a directory, so we hackishly import it here. 426 # a directory, so we hackishly import it here.
427 import shutil 427 import shutil
428 shutil.rmtree(self.path) 428 shutil.rmtree(self.path)
429 429
430 with _TemporaryDirectory() as out_dir: 430 for target_os in [None, 'android']:
431 try: 431 with _TemporaryDirectory() as out_dir:
432 input_api.subprocess.check_output(['gn', 'gen', out_dir]) 432 try:
433 except input_api.subprocess.CalledProcessError, error: 433 command = ['gn', 'gen', out_dir]
434 return [output_api.PresubmitError( 434 if target_os:
435 'gn gen must not fail.', long_text=error.output)] 435 command.append('--args=%s' % r'''os="android"''')
436 input_api.subprocess.check_output(command)
437 except input_api.subprocess.CalledProcessError, error:
438 return [output_api.PresubmitError(
439 'gn gen must not fail.', long_text=error.output)]
436 440
437 # TODO(eseidel): Currently only these are known to pass, 441 # TODO(eseidel): Currently only these are known to pass, once everything
438 # once everything passes we can just call 'gn check' once without a filter! 442 # passes we can just call 'gn check' once without a filter!
439 KNOWN_PASSING = [ 443 KNOWN_PASSING = [
440 '//examples/*', 444 '//examples/*',
441 '//mojo/*', 445 '//mojo/*',
442 '//services/*', 446 '//services/*',
443 '//shell/*', 447 '//shell/*',
444 ]
445 if input_api.platform != 'win32':
446 KNOWN_PASSING += [
447 '//sky/*',
448 ] 448 ]
449 for target_filter in KNOWN_PASSING: 449 if input_api.platform != 'win32':
450 try: 450 KNOWN_PASSING += [
451 input_api.subprocess.check_output(['gn', 'check', out_dir, 451 '//sky/*',
452 target_filter]) 452 ]
453 except input_api.subprocess.CalledProcessError, error: 453 for target_filter in KNOWN_PASSING:
454 error_title = 'gn check %s must not fail.' % target_filter 454 try:
455 return [output_api.PresubmitError(error_title, long_text=error.output)] 455 input_api.subprocess.check_output(['gn', 'check', out_dir,
456 target_filter])
457 except input_api.subprocess.CalledProcessError, error:
458 error_title = 'gn check %s must not fail.' % target_filter
459 return [output_api.PresubmitError(error_title,
460 long_text=error.output)]
456 return [] 461 return []
457 462
458 463
459 def _CheckNoBannedFunctions(input_api, output_api): 464 def _CheckNoBannedFunctions(input_api, output_api):
460 """Make sure that banned functions are not used.""" 465 """Make sure that banned functions are not used."""
461 warnings = [] 466 warnings = []
462 errors = [] 467 errors = []
463 468
464 file_filter = lambda f: f.LocalPath().endswith(('.mm', '.m', '.h')) 469 file_filter = lambda f: f.LocalPath().endswith(('.mm', '.m', '.h'))
465 for f in input_api.AffectedFiles(file_filter=file_filter): 470 for f in input_api.AffectedFiles(file_filter=file_filter):
(...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1579 builders = [ 1584 builders = [
1580 'Mojo Linux Try', 1585 'Mojo Linux Try',
1581 'Mojo Linux (dbg) Try', 1586 'Mojo Linux (dbg) Try',
1582 'Mojo Android Builder Try', 1587 'Mojo Android Builder Try',
1583 'Mojo Android Builder (dbg) Try', 1588 'Mojo Android Builder (dbg) Try',
1584 'Mojo ChromeOS Builder Try', 1589 'Mojo ChromeOS Builder Try',
1585 'Mojo ChromeOS Builder (dbg) Try', 1590 'Mojo ChromeOS Builder (dbg) Try',
1586 ] 1591 ]
1587 1592
1588 return GetDefaultTryConfigs(builders) 1593 return GetDefaultTryConfigs(builders)
OLDNEW
« no previous file with comments | « no previous file | examples/device_name/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698