diff 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
line wrap: on
line diff
--- a/mx/commands.py	Fri Jun 21 12:20:04 2013 +0200
+++ b/mx/commands.py	Fri Jun 21 14:16:48 2013 +0200
@@ -54,6 +54,8 @@
 
 _jacoco = 'off'
 
+_workdir = None
+
 _native_dbg = None
 
 _make_eclipse_launch = False
@@ -645,6 +647,11 @@
     if vm is None:
         vm = _vm
 
+    if cwd is None:
+        cwd = _workdir
+    elif _workdir is not None:
+        mx.abort("conflicting working directories: do not set --workdir for this command")
+
     build = vmbuild if vmbuild is not None else _vmbuild if _vmSourcesAvailable else 'product'
     jdk = _jdk(build, vmToCheck=vm)
     mx.expand_project_in_args(args)
@@ -1298,6 +1305,7 @@
     }
 
     mx.add_argument('--jacoco', help='instruments com.oracle.* classes using JaCoCo', default='off', choices=['off', 'on', 'append'])
+    mx.add_argument('--workdir', help='runs the VM in the given directory', default=None)
 
     if (_vmSourcesAvailable):
         mx.add_argument('--vm', action='store', dest='vm', default='graal', choices=_vmChoices, help='the VM to build/run (default: ' + _vmChoices[0] + ')')
@@ -1330,6 +1338,8 @@
         _make_eclipse_launch = getattr(opts, 'make_eclipse_launch', False)
     global _jacoco
     _jacoco = opts.jacoco
+    global _workdir
+    _workdir = opts.workdir
     global _native_dbg
     _native_dbg = opts.native_dbg