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

Side by Side Diff: build/android/findbugs_diff.py

Issue 1258303003: [Android] Suppress findbugs stderr output. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase + reenable findbugs_verbose on GN Created 5 years, 4 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
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2012 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 """Runs findbugs, and returns an error code if there are new warnings. 7 """Runs findbugs, and returns an error code if there are new warnings.
8 8
9 Other options 9 Other options
10 --only-analyze used to only analyze the class you are interested. 10 --only-analyze used to only analyze the class you are interested.
11 --relase-build analyze the classes in out/Release directory. 11 --relase-build analyze the classes in out/Release directory.
12 --findbugs-args used to passin other findbugs's options. 12 --findbugs-args used to passin other findbugs's options.
13 13
14 Run 14 Run
15 $CHROMIUM_SRC/third_party/findbugs/bin/findbugs -textui for details. 15 $CHROMIUM_SRC/third_party/findbugs/bin/findbugs -textui for details.
16 16
17 """ 17 """
18 18
19 import argparse 19 import argparse
20 import os 20 import os
21 import sys 21 import sys
22 22
23 from pylib import constants 23 from pylib import constants
24 from pylib.utils import findbugs 24 from pylib.utils import findbugs
25 from pylib.utils import run_tests_helper
25 26
26 _DEFAULT_BASE_DIR = os.path.join( 27 _DEFAULT_BASE_DIR = os.path.join(
27 constants.DIR_SOURCE_ROOT, 'build', 'android', 'findbugs_filter') 28 constants.DIR_SOURCE_ROOT, 'build', 'android', 'findbugs_filter')
28 29
29 sys.path.append( 30 sys.path.append(
30 os.path.join(constants.DIR_SOURCE_ROOT, 'build', 'android', 'gyp')) 31 os.path.join(constants.DIR_SOURCE_ROOT, 'build', 'android', 'gyp'))
31 from util import build_utils 32 from util import build_utils
32 33
33 34
34 def main(): 35 def main():
35 parser = argparse.ArgumentParser() 36 parser = argparse.ArgumentParser()
36 37
37 parser.add_argument( 38 parser.add_argument(
39 '-v', '--verbose', action='count', help='Enable verbose logging.')
40 parser.add_argument(
38 '-a', '--auxclasspath', default=None, dest='auxclasspath', 41 '-a', '--auxclasspath', default=None, dest='auxclasspath',
39 help='Set aux classpath for analysis.') 42 help='Set aux classpath for analysis.')
40 parser.add_argument( 43 parser.add_argument(
41 '--auxclasspath-gyp', dest='auxclasspath_gyp', 44 '--auxclasspath-gyp', dest='auxclasspath_gyp',
42 help='A gyp list containing the aux classpath for analysis') 45 help='A gyp list containing the aux classpath for analysis')
43 parser.add_argument( 46 parser.add_argument(
44 '-o', '--only-analyze', default=None, 47 '-o', '--only-analyze', default=None,
45 dest='only_analyze', help='Only analyze the given classes and packages.') 48 dest='only_analyze', help='Only analyze the given classes and packages.')
46 parser.add_argument( 49 parser.add_argument(
47 '-e', '--exclude', default=None, dest='exclude', 50 '-e', '--exclude', default=None, dest='exclude',
(...skipping 14 matching lines...) Expand all
62 '--stamp', help='Path to touch on success.') 65 '--stamp', help='Path to touch on success.')
63 parser.add_argument( 66 parser.add_argument(
64 '--depfile', help='Path to the depfile. This must be specified as the ' 67 '--depfile', help='Path to the depfile. This must be specified as the '
65 "action's first output.") 68 "action's first output.")
66 69
67 parser.add_argument( 70 parser.add_argument(
68 'jar_paths', metavar='JAR_PATH', nargs='+', 71 'jar_paths', metavar='JAR_PATH', nargs='+',
69 help='JAR file to analyze') 72 help='JAR file to analyze')
70 73
71 args = parser.parse_args(build_utils.ExpandFileArgs(sys.argv[1:])) 74 args = parser.parse_args(build_utils.ExpandFileArgs(sys.argv[1:]))
75
76 run_tests_helper.SetLogLevel(args.verbose)
77
72 if args.auxclasspath: 78 if args.auxclasspath:
73 args.auxclasspath = args.auxclasspath.split(':') 79 args.auxclasspath = args.auxclasspath.split(':')
74 elif args.auxclasspath_gyp: 80 elif args.auxclasspath_gyp:
75 args.auxclasspath = build_utils.ParseGypList(args.auxclasspath_gyp) 81 args.auxclasspath = build_utils.ParseGypList(args.auxclasspath_gyp)
76 82
77 if args.base_dir: 83 if args.base_dir:
78 if not args.exclude: 84 if not args.exclude:
79 args.exclude = os.path.join(args.base_dir, 'findbugs_exclude.xml') 85 args.exclude = os.path.join(args.base_dir, 'findbugs_exclude.xml')
80 86
81 findbugs_command, findbugs_warnings = findbugs.Run( 87 findbugs_command, findbugs_warnings = findbugs.Run(
(...skipping 19 matching lines...) Expand all
101 + args.jar_paths) 107 + args.jar_paths)
102 if args.stamp: 108 if args.stamp:
103 build_utils.Touch(args.stamp) 109 build_utils.Touch(args.stamp)
104 110
105 return len(findbugs_warnings) 111 return len(findbugs_warnings)
106 112
107 113
108 if __name__ == '__main__': 114 if __name__ == '__main__':
109 sys.exit(main()) 115 sys.exit(main())
110 116
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698