| OLD | NEW |
| 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 options.sources_file) | 154 options.sources_file) |
| 155 temp_dir = tempfile.mkdtemp() | 155 temp_dir = tempfile.mkdtemp() |
| 156 try: | 156 try: |
| 157 cmd = ['java', '-cp', options.emma_jar, | 157 cmd = ['java', '-cp', options.emma_jar, |
| 158 'emma', 'instr', | 158 'emma', 'instr', |
| 159 '-ip', options.input_path, | 159 '-ip', options.input_path, |
| 160 '-ix', options.filter_string, | 160 '-ix', options.filter_string, |
| 161 '-d', temp_dir, | 161 '-d', temp_dir, |
| 162 '-out', coverage_file, | 162 '-out', coverage_file, |
| 163 '-m', 'fullcopy'] | 163 '-m', 'fullcopy'] |
| 164 build_utils.CheckCallDie(cmd, suppress_output=True) | 164 build_utils.CheckOutput(cmd) |
| 165 | 165 |
| 166 if command == 'instrument_jar': | 166 if command == 'instrument_jar': |
| 167 for jar in os.listdir(os.path.join(temp_dir, 'lib')): | 167 for jar in os.listdir(os.path.join(temp_dir, 'lib')): |
| 168 shutil.copy(os.path.join(temp_dir, 'lib', jar), | 168 shutil.copy(os.path.join(temp_dir, 'lib', jar), |
| 169 options.output_path) | 169 options.output_path) |
| 170 else: # 'instrument_classes' | 170 else: # 'instrument_classes' |
| 171 if os.path.isdir(options.output_path): | 171 if os.path.isdir(options.output_path): |
| 172 shutil.rmtree(options.output_path, ignore_errors=True) | 172 shutil.rmtree(options.output_path, ignore_errors=True) |
| 173 shutil.copytree(os.path.join(temp_dir, 'classes'), | 173 shutil.copytree(os.path.join(temp_dir, 'classes'), |
| 174 options.output_path) | 174 options.output_path) |
| (...skipping 21 matching lines...) Expand all Loading... |
| 196 | 196 |
| 197 | 197 |
| 198 def main(argv): | 198 def main(argv): |
| 199 option_parser = command_option_parser.CommandOptionParser( | 199 option_parser = command_option_parser.CommandOptionParser( |
| 200 commands_dict=VALID_COMMANDS) | 200 commands_dict=VALID_COMMANDS) |
| 201 command_option_parser.ParseAndExecute(option_parser) | 201 command_option_parser.ParseAndExecute(option_parser) |
| 202 | 202 |
| 203 | 203 |
| 204 if __name__ == '__main__': | 204 if __name__ == '__main__': |
| 205 sys.exit(main(sys.argv)) | 205 sys.exit(main(sys.argv)) |
| OLD | NEW |