blob: 75910b1cb2bb326caf5abe76fe0e8130a9953af2 [file] [log] [blame]
Tamas Kenez19a3b8a2017-05-29 23:08:48 +02001#!/usr/bin/env python
2# Copyright (c) 2017, the R8 project authors. Please see the AUTHORS file
3# for details. All rights reserved. Use of this source code is governed by a
4# BSD-style license that can be found in the LICENSE file.
5
6import gradle
7import os
8import subprocess
9import sys
10import utils
11
Tamas Kenez19a3b8a2017-05-29 23:08:48 +020012def run(args, build = True, debug = True, profile = False, track_memory_file=None):
13 if build:
14 gradle.RunGradle(['CompatDX'])
15 cmd = []
16 if track_memory_file:
17 cmd.extend(['tools/track_memory.sh', track_memory_file])
18 cmd.append('java')
19 if debug:
20 cmd.append('-ea')
21 if profile:
22 cmd.append('-agentlib:hprof=cpu=samples,interval=1,depth=8')
Tamas Kenez0cad51c2017-08-21 14:42:01 +020023 cmd.extend(['-jar', utils.COMPATDX_JAR])
Tamas Kenez19a3b8a2017-05-29 23:08:48 +020024 cmd.extend(args)
25 subprocess.check_call(cmd)
26
27def main():
28 build = True
29 args = []
30 for arg in sys.argv[1:]:
31 if arg in ("--build", "--no-build"):
32 build = arg == "--build"
33 else:
34 args.append(arg)
35 run(args, build)
36
37if __name__ == '__main__':
38 sys.exit(main())