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

Side by Side Diff: build/android/gyp/ant.py

Issue 197693002: [Android] Lint build/android/gyp/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: now using extra_paths_list to avoid F0401s Created 6 years, 9 months 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 | « build/android/PRESUBMIT.py ('k') | build/android/gyp/apk_install.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright 2013 The Chromium Authors. All rights reserved. 3 # Copyright 2013 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """An Ant wrapper that suppresses useless Ant output. 7 """An Ant wrapper that suppresses useless Ant output.
8 8
9 Ant build scripts output "BUILD SUCCESSFUL" and build timing at the end of 9 Ant build scripts output "BUILD SUCCESSFUL" and build timing at the end of
10 every build. In the Android build, this just adds a lot of useless noise to the 10 every build. In the Android build, this just adds a lot of useless noise to the
11 build output. This script forwards its arguments to ant, and prints Ant's 11 build output. This script forwards its arguments to ant, and prints Ant's
12 output up until the BUILD SUCCESSFUL line. 12 output up until the BUILD SUCCESSFUL line.
13 13
14 Also, when a command fails, this script will re-run that ant command with the 14 Also, when a command fails, this script will re-run that ant command with the
15 '-verbose' argument so that the failure is easier to debug. 15 '-verbose' argument so that the failure is easier to debug.
16 """ 16 """
17 17
18 import sys 18 import sys
19 import traceback 19 import traceback
20 20
21 from util import build_utils 21 from util import build_utils
22 22
23 23
24 def main(argv): 24 def main(argv):
25 try: 25 try:
26 args = argv[1:] 26 args = argv[1:]
27 stdout = build_utils.CheckOutput(['ant'] + args) 27 stdout = build_utils.CheckOutput(['ant'] + args)
28 except build_utils.CalledProcessError as e: 28 except build_utils.CalledProcessError:
29 # It is very difficult to diagnose ant failures without the '-verbose' 29 # It is very difficult to diagnose ant failures without the '-verbose'
30 # argument. So, when an ant command fails, re-run it with '-verbose' so that 30 # argument. So, when an ant command fails, re-run it with '-verbose' so that
31 # the cause of the failure is easier to identify. 31 # the cause of the failure is easier to identify.
32 verbose_args = ['-verbose'] + [a for a in argv[1:] if a != '-quiet'] 32 verbose_args = ['-verbose'] + [a for a in argv[1:] if a != '-quiet']
33 try: 33 try:
34 stdout = build_utils.CheckOutput(['ant'] + verbose_args) 34 stdout = build_utils.CheckOutput(['ant'] + verbose_args)
35 except build_utils.CalledProcessError as e: 35 except build_utils.CalledProcessError:
36 traceback.print_exc() 36 traceback.print_exc()
37 sys.exit(1) 37 sys.exit(1)
38 38
39 # If this did sys.exit(1), building again would succeed (which would be 39 # If this did sys.exit(1), building again would succeed (which would be
40 # awkward). Instead, just print a big warning. 40 # awkward). Instead, just print a big warning.
41 build_util.PrintBigWarning( 41 build_utils.PrintBigWarning(
42 'This is unexpected. `ant ' + ' '.join(args) + '` failed.' + 42 'This is unexpected. `ant ' + ' '.join(args) + '` failed.' +
43 'But, running `ant ' + ' '.join(verbose_args) + '` passed.') 43 'But, running `ant ' + ' '.join(verbose_args) + '` passed.')
44 44
45 stdout = stdout.strip().split('\n') 45 stdout = stdout.strip().split('\n')
46 for line in stdout: 46 for line in stdout:
47 if line.strip() == 'BUILD SUCCESSFUL': 47 if line.strip() == 'BUILD SUCCESSFUL':
48 break 48 break
49 print line 49 print line
50 50
51 51
52 if __name__ == '__main__': 52 if __name__ == '__main__':
53 sys.exit(main(sys.argv)) 53 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « build/android/PRESUBMIT.py ('k') | build/android/gyp/apk_install.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698