Index: build/android/generate_emma_html.py |
diff --git a/build/android/generate_emma_html.py b/build/android/generate_emma_html.py |
index 1b00a329cbe156a38f0d496a33d0efccac0d1111..463a83687c269fd46fdc2e8a9fa31e5f2c2bdcba 100755 |
--- a/build/android/generate_emma_html.py |
+++ b/build/android/generate_emma_html.py |
@@ -46,7 +46,8 @@ def main(argv): |
help=('Root of the directory in which to search for ' |
'coverage metadata (.em) files.')) |
option_parser.add_option('--cleanup', action='store_true', |
- help='If set, removes coverage/metadata files.') |
+ help=('If set, removes coverage files generated at ' |
+ 'runtime.')) |
options, args = option_parser.parse_args() |
if not (options.coverage_dir and options.metadata_dir and options.output): |
@@ -56,33 +57,22 @@ def main(argv): |
metadata_files = _GetFilesWithExt(options.metadata_dir, 'em') |
print 'Found coverage files: %s' % str(coverage_files) |
print 'Found metadata files: %s' % str(metadata_files) |
- sources_files = [] |
- final_metadata_files = [] |
- err = None |
+ |
+ sources = [] |
for f in metadata_files: |
sources_file = os.path.splitext(f)[0] + '_sources.txt' |
- # TODO(gkanwar): Remove this once old coverage.em files have been cleaned |
- # from all bots. |
- # Warn if we have old metadata files lying around that don't correspond |
- # to a *_sources.txt (these should be manually cleaned). |
- try: |
- with open(sources_file, 'r') as sf: |
- sources_files.extend(json.load(sf)) |
- except IOError as e: |
- traceback.print_exc() |
- err = e |
- else: |
- final_metadata_files.append(f) |
- sources_files = [os.path.join(constants.DIR_SOURCE_ROOT, s) |
- for s in sources_files] |
+ with open(sources_file, 'r') as sf: |
+ sources.extend(json.load(sf)) |
+ sources = [os.path.join(constants.DIR_SOURCE_ROOT, s) for s in sources] |
+ print 'Sources: %s' % sources |
input_args = [] |
- for f in coverage_files + final_metadata_files: |
+ for f in coverage_files + metadata_files: |
input_args.append('-in') |
input_args.append(f) |
output_args = ['-Dreport.html.out.file', options.output] |
- source_args = ['-sp', ','.join(sources_files)] |
+ source_args = ['-sp', ','.join(sources)] |
exit_code = cmd_helper.RunCmd( |
['java', '-cp', |
@@ -91,15 +81,10 @@ def main(argv): |
+ input_args + output_args + source_args) |
if options.cleanup: |
- for f in coverage_files + metadata_files: |
+ for f in coverage_files: |
os.remove(f) |
- if exit_code > 0: |
- return exit_code |
- elif err: |
- return constants.WARNING_EXIT_CODE |
- else: |
- return 0 |
+ return exit_code |
if __name__ == '__main__': |