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

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

Issue 132463007: Enable presubmit pylint in build/android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase vs tot and only disabling F0401 in specific spots Created 6 years, 10 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/gyp/dex.py ('k') | build/android/gyp/finalize_apk.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 """Instruments classes and jar files. 7 """Instruments classes and jar files.
8 8
9 This script corresponds to the 'emma_instr' action in the java build process. 9 This script corresponds to the 'emma_instr' action in the java build process.
10 Depending on whether emma_instrument is set, the 'emma_instr' action will either 10 Depending on whether emma_instrument is set, the 'emma_instr' action will either
(...skipping 11 matching lines...) Expand all
22 import collections 22 import collections
23 import json 23 import json
24 import os 24 import os
25 import shutil 25 import shutil
26 import sys 26 import sys
27 import tempfile 27 import tempfile
28 28
29 sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir)) 29 sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir))
30 from pylib.utils import command_option_parser 30 from pylib.utils import command_option_parser
31 31
32 from util import build_utils 32 from util import build_utils # pylint: disable=F0401
33 33
34 34
35 def _AddCommonOptions(option_parser): 35 def _AddCommonOptions(option_parser):
36 """Adds common options to |option_parser|.""" 36 """Adds common options to |option_parser|."""
37 option_parser.add_option('--input-path', 37 option_parser.add_option('--input-path',
38 help=('Path to input file(s). Either the classes ' 38 help=('Path to input file(s). Either the classes '
39 'directory, or the path to a jar.')) 39 'directory, or the path to a jar.'))
40 option_parser.add_option('--output-path', 40 option_parser.add_option('--output-path',
41 help=('Path to output final file(s) to. Either the ' 41 help=('Path to output final file(s) to. Either the '
42 'final classes directory, or the directory in ' 42 'final classes directory, or the directory in '
(...skipping 13 matching lines...) Expand all
56 option_parser.add_option('--src-root', 56 option_parser.add_option('--src-root',
57 help='Root of the src repository.') 57 help='Root of the src repository.')
58 option_parser.add_option('--emma-jar', 58 option_parser.add_option('--emma-jar',
59 help='Path to emma.jar.') 59 help='Path to emma.jar.')
60 option_parser.add_option( 60 option_parser.add_option(
61 '--filter-string', default='', 61 '--filter-string', default='',
62 help=('Filter string consisting of a list of inclusion/exclusion ' 62 help=('Filter string consisting of a list of inclusion/exclusion '
63 'patterns separated with whitespace and/or comma.')) 63 'patterns separated with whitespace and/or comma.'))
64 64
65 65
66 def _RunCopyCommand(command, options, args, option_parser): 66 def _RunCopyCommand(_command, options, _, option_parser):
67 """Copies the jar from input to output locations. 67 """Copies the jar from input to output locations.
68 68
69 Also removes any old coverage/sources file. 69 Also removes any old coverage/sources file.
70 70
71 Args: 71 Args:
72 command: String indicating the command that was received to trigger 72 command: String indicating the command that was received to trigger
73 this function. 73 this function.
74 options: optparse options dictionary. 74 options: optparse options dictionary.
75 args: List of extra args from optparse. 75 args: List of extra args from optparse.
76 option_parser: optparse.OptionParser object. 76 option_parser: optparse.OptionParser object.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 % (abs_source, src_root)) 122 % (abs_source, src_root))
123 return 1 123 return 1
124 rel_source = os.path.relpath(abs_source, src_root) 124 rel_source = os.path.relpath(abs_source, src_root)
125 125
126 relative_sources.append(rel_source) 126 relative_sources.append(rel_source)
127 127
128 with open(sources_file, 'w') as f: 128 with open(sources_file, 'w') as f:
129 json.dump(relative_sources, f) 129 json.dump(relative_sources, f)
130 130
131 131
132 def _RunInstrumentCommand(command, options, args, option_parser): 132 def _RunInstrumentCommand(command, options, _, option_parser):
133 """Instruments the classes/jar files using EMMA. 133 """Instruments the classes/jar files using EMMA.
134 134
135 Args: 135 Args:
136 command: 'instrument_jar' or 'instrument_classes'. This distinguishes 136 command: 'instrument_jar' or 'instrument_classes'. This distinguishes
137 whether we copy the output from the created lib/ directory, or classes/ 137 whether we copy the output from the created lib/ directory, or classes/
138 directory. 138 directory.
139 options: optparse options dictionary. 139 options: optparse options dictionary.
140 args: List of extra args from optparse. 140 args: List of extra args from optparse.
141 option_parser: optparse.OptionParser object. 141 option_parser: optparse.OptionParser object.
142 142
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 VALID_COMMANDS = { 190 VALID_COMMANDS = {
191 'copy': CommandFunctionTuple(_AddCommonOptions, 191 'copy': CommandFunctionTuple(_AddCommonOptions,
192 _RunCopyCommand), 192 _RunCopyCommand),
193 'instrument_jar': CommandFunctionTuple(_AddInstrumentOptions, 193 'instrument_jar': CommandFunctionTuple(_AddInstrumentOptions,
194 _RunInstrumentCommand), 194 _RunInstrumentCommand),
195 'instrument_classes': CommandFunctionTuple(_AddInstrumentOptions, 195 'instrument_classes': CommandFunctionTuple(_AddInstrumentOptions,
196 _RunInstrumentCommand), 196 _RunInstrumentCommand),
197 } 197 }
198 198
199 199
200 def main(argv): 200 def main():
201 option_parser = command_option_parser.CommandOptionParser( 201 option_parser = command_option_parser.CommandOptionParser(
202 commands_dict=VALID_COMMANDS) 202 commands_dict=VALID_COMMANDS)
203 command_option_parser.ParseAndExecute(option_parser) 203 command_option_parser.ParseAndExecute(option_parser)
204 204
205 205
206 if __name__ == '__main__': 206 if __name__ == '__main__':
207 sys.exit(main(sys.argv)) 207 sys.exit(main())
OLDNEW
« no previous file with comments | « build/android/gyp/dex.py ('k') | build/android/gyp/finalize_apk.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698