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 """Aggregates EMMA coverage files to produce html output.""" | 7 """Aggregates EMMA coverage files to produce html output.""" |
8 | 8 |
9 import fnmatch | 9 import fnmatch |
10 import json | 10 import json |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 fixed_source_paths.add(fixed_path) | 83 fixed_source_paths.add(fixed_path) |
84 break | 84 break |
85 | 85 |
86 sources = list(fixed_source_paths) | 86 sources = list(fixed_source_paths) |
87 | 87 |
88 input_args = [] | 88 input_args = [] |
89 for f in coverage_files + metadata_files: | 89 for f in coverage_files + metadata_files: |
90 input_args.append('-in') | 90 input_args.append('-in') |
91 input_args.append(f) | 91 input_args.append(f) |
92 | 92 |
93 output_args = ['-Dreport.html.out.file', options.output] | 93 output_args = ['-Dreport.html.out.file', options.output, |
| 94 '-Dreport.html.out.encoding', 'UTF-8'] |
94 source_args = ['-sp', ','.join(sources)] | 95 source_args = ['-sp', ','.join(sources)] |
95 | 96 |
96 exit_code = cmd_helper.RunCmd( | 97 exit_code = cmd_helper.RunCmd( |
97 ['java', '-cp', | 98 ['java', '-cp', |
98 os.path.join(constants.ANDROID_SDK_ROOT, 'tools', 'lib', 'emma.jar'), | 99 os.path.join(constants.ANDROID_SDK_ROOT, 'tools', 'lib', 'emma.jar'), |
99 'emma', 'report', '-r', 'html'] | 100 'emma', 'report', '-r', 'html'] |
100 + input_args + output_args + source_args) | 101 + input_args + output_args + source_args) |
101 | 102 |
102 if options.cleanup: | 103 if options.cleanup: |
103 for f in coverage_files: | 104 for f in coverage_files: |
104 os.remove(f) | 105 os.remove(f) |
105 | 106 |
106 # Command tends to exit with status 0 when it actually failed. | 107 # Command tends to exit with status 0 when it actually failed. |
107 if not exit_code and not os.path.exists(options.output): | 108 if not exit_code and not os.path.exists(options.output): |
108 exit_code = 1 | 109 exit_code = 1 |
109 | 110 |
110 return exit_code | 111 return exit_code |
111 | 112 |
112 | 113 |
113 if __name__ == '__main__': | 114 if __name__ == '__main__': |
114 sys.exit(main()) | 115 sys.exit(main()) |
OLD | NEW |