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

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

Issue 2101243005: Add a snapshot of flutter/engine/src/build to our sdk (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: add README.dart Created 4 years, 5 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/findbugs_action.gypi ('k') | build/android/findbugs_filter/findbugs_exclude.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 #
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
5 # found in the LICENSE file.
6
7 """Runs findbugs, and returns an error code if there are new warnings.
8
9 Other options
10 --only-analyze used to only analyze the class you are interested.
11 --relase-build analyze the classes in out/Release directory.
12 --findbugs-args used to passin other findbugs's options.
13
14 Run
15 $CHROMIUM_SRC/third_party/findbugs/bin/findbugs -textui for details.
16
17 """
18
19 import argparse
20 import os
21 import sys
22
23 from pylib import constants
24 from pylib.utils import findbugs
25
26 _DEFAULT_BASE_DIR = os.path.join(
27 constants.DIR_SOURCE_ROOT, 'build', 'android', 'findbugs_filter')
28
29 sys.path.append(
30 os.path.join(constants.DIR_SOURCE_ROOT, 'build', 'android', 'gyp'))
31 from util import build_utils
32
33
34 def main():
35 parser = argparse.ArgumentParser()
36
37 parser.add_argument(
38 '-a', '--auxclasspath', default=None, dest='auxclasspath',
39 help='Set aux classpath for analysis.')
40 parser.add_argument(
41 '--auxclasspath-gyp', dest='auxclasspath_gyp',
42 help='A gyp list containing the aux classpath for analysis')
43 parser.add_argument(
44 '-o', '--only-analyze', default=None,
45 dest='only_analyze', help='Only analyze the given classes and packages.')
46 parser.add_argument(
47 '-e', '--exclude', default=None, dest='exclude',
48 help='Exclude bugs matching given filter.')
49 parser.add_argument(
50 '-l', '--release-build', action='store_true', dest='release_build',
51 help='Analyze release build instead of debug.')
52 parser.add_argument(
53 '-f', '--findbug-args', default=None, dest='findbug_args',
54 help='Additional findbug arguments.')
55 parser.add_argument(
56 '-b', '--base-dir', default=_DEFAULT_BASE_DIR,
57 dest='base_dir', help='Base directory for configuration file.')
58 parser.add_argument(
59 '--output-file', dest='output_file',
60 help='Path to save the output to.')
61 parser.add_argument(
62 '--stamp', help='Path to touch on success.')
63 parser.add_argument(
64 '--depfile', help='Path to the depfile. This must be specified as the '
65 "action's first output.")
66
67 parser.add_argument(
68 'jar_paths', metavar='JAR_PATH', nargs='+',
69 help='JAR file to analyze')
70
71 args = parser.parse_args(build_utils.ExpandFileArgs(sys.argv[1:]))
72 if args.auxclasspath:
73 args.auxclasspath = args.auxclasspath.split(':')
74 elif args.auxclasspath_gyp:
75 args.auxclasspath = build_utils.ParseGypList(args.auxclasspath_gyp)
76
77 if args.base_dir:
78 if not args.exclude:
79 args.exclude = os.path.join(args.base_dir, 'findbugs_exclude.xml')
80
81 findbugs_command, findbugs_warnings = findbugs.Run(
82 args.exclude, args.only_analyze, args.auxclasspath,
83 args.output_file, args.findbug_args, args.jar_paths)
84
85 if findbugs_warnings:
86 print
87 print '*' * 80
88 print 'FindBugs run via:'
89 print findbugs_command
90 print
91 print 'FindBugs reported the following issues:'
92 for warning in sorted(findbugs_warnings):
93 print str(warning)
94 print '*' * 80
95 print
96 else:
97 if args.depfile:
98 build_utils.WriteDepfile(
99 args.depfile,
100 build_utils.GetPythonDependencies() + args.auxclasspath
101 + args.jar_paths)
102 if args.stamp:
103 build_utils.Touch(args.stamp)
104
105 return len(findbugs_warnings)
106
107
108 if __name__ == '__main__':
109 sys.exit(main())
110
OLDNEW
« no previous file with comments | « build/android/findbugs_action.gypi ('k') | build/android/findbugs_filter/findbugs_exclude.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698