aboutsummaryrefslogtreecommitdiffstats
path: root/build/scripts/pack_jcoverage_resources.py
blob: f6e181067a2dd3ac3fe8b1d26ca1e7af67594568 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import sys
import tarfile
import os
import subprocess


def main(args):
    output_file = args[0]
    report_file = args[1]

    res = subprocess.call(args[args.index('-end') + 1:])

    if not os.path.exists(report_file):
        print>>sys.stderr, 'Can\'t find jacoco exec file'
        return res

    with tarfile.open(output_file, 'w') as outf:
        outf.add(report_file, arcname=os.path.basename(report_file))

    return res


if __name__ == '__main__':
    sys.exit(main(sys.argv[1:]))