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

Side by Side Diff: build/android/gyp/emma_instr.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/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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
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