comparison mx/commands.py @ 10454:590b0c26877f

mx: add --workdir argument
author Bernhard Urban <bernhard.urban@jku.at>
date Fri, 21 Jun 2013 14:16:48 +0200
parents acc1c61ba408
children 467d9ae9912e
comparison
equal deleted inserted replaced
10453:f748b42a1389 10454:590b0c26877f
51 """ The VM build that will be run by the 'vm' command. 51 """ The VM build that will be run by the 'vm' command.
52 This can be set via the global '--product', '--fastdebug' and '--debug' options. """ 52 This can be set via the global '--product', '--fastdebug' and '--debug' options. """
53 _vmbuild = _vmbuildChoices[0] 53 _vmbuild = _vmbuildChoices[0]
54 54
55 _jacoco = 'off' 55 _jacoco = 'off'
56
57 _workdir = None
56 58
57 _native_dbg = None 59 _native_dbg = None
58 60
59 _make_eclipse_launch = False 61 _make_eclipse_launch = False
60 62
643 """run the VM selected by the '--vm' option""" 645 """run the VM selected by the '--vm' option"""
644 646
645 if vm is None: 647 if vm is None:
646 vm = _vm 648 vm = _vm
647 649
650 if cwd is None:
651 cwd = _workdir
652 elif _workdir is not None:
653 mx.abort("conflicting working directories: do not set --workdir for this command")
654
648 build = vmbuild if vmbuild is not None else _vmbuild if _vmSourcesAvailable else 'product' 655 build = vmbuild if vmbuild is not None else _vmbuild if _vmSourcesAvailable else 'product'
649 jdk = _jdk(build, vmToCheck=vm) 656 jdk = _jdk(build, vmToCheck=vm)
650 mx.expand_project_in_args(args) 657 mx.expand_project_in_args(args)
651 if _make_eclipse_launch: 658 if _make_eclipse_launch:
652 mx.make_eclipse_launch(args, 'graal-' + build, name=None, deps=mx.project('com.oracle.graal.hotspot').all_deps([], True)) 659 mx.make_eclipse_launch(args, 'graal-' + build, name=None, deps=mx.project('com.oracle.graal.hotspot').all_deps([], True))
1296 'deoptalot' : [deoptalot, '[n]'], 1303 'deoptalot' : [deoptalot, '[n]'],
1297 'longtests' : [longtests, ''] 1304 'longtests' : [longtests, '']
1298 } 1305 }
1299 1306
1300 mx.add_argument('--jacoco', help='instruments com.oracle.* classes using JaCoCo', default='off', choices=['off', 'on', 'append']) 1307 mx.add_argument('--jacoco', help='instruments com.oracle.* classes using JaCoCo', default='off', choices=['off', 'on', 'append'])
1308 mx.add_argument('--workdir', help='runs the VM in the given directory', default=None)
1301 1309
1302 if (_vmSourcesAvailable): 1310 if (_vmSourcesAvailable):
1303 mx.add_argument('--vm', action='store', dest='vm', default='graal', choices=_vmChoices, help='the VM to build/run (default: ' + _vmChoices[0] + ')') 1311 mx.add_argument('--vm', action='store', dest='vm', default='graal', choices=_vmChoices, help='the VM to build/run (default: ' + _vmChoices[0] + ')')
1304 for c in _vmbuildChoices: 1312 for c in _vmbuildChoices:
1305 mx.add_argument('--' + c, action='store_const', dest='vmbuild', const=c, help='select the ' + c + ' build of the VM') 1313 mx.add_argument('--' + c, action='store_const', dest='vmbuild', const=c, help='select the ' + c + ' build of the VM')
1328 _vmbuild = opts.vmbuild 1336 _vmbuild = opts.vmbuild
1329 global _make_eclipse_launch 1337 global _make_eclipse_launch
1330 _make_eclipse_launch = getattr(opts, 'make_eclipse_launch', False) 1338 _make_eclipse_launch = getattr(opts, 'make_eclipse_launch', False)
1331 global _jacoco 1339 global _jacoco
1332 _jacoco = opts.jacoco 1340 _jacoco = opts.jacoco
1341 global _workdir
1342 _workdir = opts.workdir
1333 global _native_dbg 1343 global _native_dbg
1334 _native_dbg = opts.native_dbg 1344 _native_dbg = opts.native_dbg
1335 1345
1336 mx.distribution('GRAAL').add_update_listener(_installGraalJarInJdks) 1346 mx.distribution('GRAAL').add_update_listener(_installGraalJarInJdks)