• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/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
12COMPATDX_JAR = os.path.join(utils.REPO_ROOT, 'build', 'libs', 'compatdx.jar')
13
14def run(args, build = True, debug = True, profile = False, track_memory_file=None):
15  if build:
16    gradle.RunGradle(['CompatDX'])
17  cmd = []
18  if track_memory_file:
19    cmd.extend(['tools/track_memory.sh', track_memory_file])
20  cmd.append('java')
21  if debug:
22    cmd.append('-ea')
23  if profile:
24    cmd.append('-agentlib:hprof=cpu=samples,interval=1,depth=8')
25  cmd.extend(['-jar', COMPATDX_JAR])
26  cmd.extend(args)
27  subprocess.check_call(cmd)
28
29def main():
30  build = True
31  args = []
32  for arg in sys.argv[1:]:
33    if arg in ("--build", "--no-build"):
34      build = arg == "--build"
35    else:
36      args.append(arg)
37  run(args, build)
38
39if __name__ == '__main__':
40  sys.exit(main())
41