aboutsummaryrefslogtreecommitdiffstats
path: root/build/scripts/pack_jcoverage_resources.py
blob: 6ed3b1320dfd76d2764ad30185b2bf9c5fc74b55 (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
25
from __future__ import print_function
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('Can\'t find jacoco exec file', file=sys.stderr)
        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:]))