Mercurial > hg > truffle
comparison mxtool/mx.py @ 13952:b076b5c13c3f
mx: factor out JavaConfig.processArgs and use it in mx vm. remove default -J arguments.
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Fri, 14 Feb 2014 15:09:57 +0100 |
parents | 392b6ac8da36 |
children | 6c6d1eacc398 |
comparison
equal
deleted
inserted
replaced
13951:392b6ac8da36 | 13952:b076b5c13c3f |
---|---|
988 self.add_argument('-p', '--primary-suite-path', help='set the primary suite directory', metavar='<path>') | 988 self.add_argument('-p', '--primary-suite-path', help='set the primary suite directory', metavar='<path>') |
989 self.add_argument('--dbg', type=int, dest='java_dbg_port', help='make Java processes wait on <port> for a debugger', metavar='<port>') | 989 self.add_argument('--dbg', type=int, dest='java_dbg_port', help='make Java processes wait on <port> for a debugger', metavar='<port>') |
990 self.add_argument('-d', action='store_const', const=8000, dest='java_dbg_port', help='alias for "-dbg 8000"') | 990 self.add_argument('-d', action='store_const', const=8000, dest='java_dbg_port', help='alias for "-dbg 8000"') |
991 self.add_argument('--cp-pfx', dest='cp_prefix', help='class path prefix', metavar='<arg>') | 991 self.add_argument('--cp-pfx', dest='cp_prefix', help='class path prefix', metavar='<arg>') |
992 self.add_argument('--cp-sfx', dest='cp_suffix', help='class path suffix', metavar='<arg>') | 992 self.add_argument('--cp-sfx', dest='cp_suffix', help='class path suffix', metavar='<arg>') |
993 self.add_argument('--J', dest='java_args', help='Java VM arguments (e.g. --J @-dsa)', metavar='@<args>', default='-ea -Xss2m -Xmx1g') | 993 self.add_argument('--J', dest='java_args', help='Java VM arguments (e.g. --J @-dsa)', metavar='@<args>') |
994 self.add_argument('--Jp', action='append', dest='java_args_pfx', help='prefix Java VM arguments (e.g. --Jp @-dsa)', metavar='@<args>', default=[]) | 994 self.add_argument('--Jp', action='append', dest='java_args_pfx', help='prefix Java VM arguments (e.g. --Jp @-dsa)', metavar='@<args>', default=[]) |
995 self.add_argument('--Ja', action='append', dest='java_args_sfx', help='suffix Java VM arguments (e.g. --Ja @-dsa)', metavar='@<args>', default=[]) | 995 self.add_argument('--Ja', action='append', dest='java_args_sfx', help='suffix Java VM arguments (e.g. --Ja @-dsa)', metavar='@<args>', default=[]) |
996 self.add_argument('--user-home', help='users home directory', metavar='<path>', default=os.path.expanduser('~')) | 996 self.add_argument('--user-home', help='users home directory', metavar='<path>', default=os.path.expanduser('~')) |
997 self.add_argument('--java-home', help='bootstrap JDK installation directory (must be JDK 6 or later)', metavar='<path>') | 997 self.add_argument('--java-home', help='bootstrap JDK installation directory (must be JDK 6 or later)', metavar='<path>') |
998 self.add_argument('--ignore-project', action='append', dest='ignored_projects', help='name of project to ignore', metavar='<name>', default=[]) | 998 self.add_argument('--ignore-project', action='append', dest='ignored_projects', help='name of project to ignore', metavar='<name>', default=[]) |
1308 abort('Java launcher derived from JAVA_HOME does not exist: ' + self.java) | 1308 abort('Java launcher derived from JAVA_HOME does not exist: ' + self.java) |
1309 | 1309 |
1310 def delAtAndSplit(s): | 1310 def delAtAndSplit(s): |
1311 return shlex.split(s.lstrip('@')) | 1311 return shlex.split(s.lstrip('@')) |
1312 | 1312 |
1313 self.java_args = delAtAndSplit(_opts.java_args) | 1313 self.java_args = delAtAndSplit(_opts.java_args) if _opts.java_args else [] |
1314 self.java_args_pfx = sum(map(delAtAndSplit, _opts.java_args_pfx), []) | 1314 self.java_args_pfx = sum(map(delAtAndSplit, _opts.java_args_pfx), []) |
1315 self.java_args_sfx = sum(map(delAtAndSplit, _opts.java_args_sfx), []) | 1315 self.java_args_sfx = sum(map(delAtAndSplit, _opts.java_args_sfx), []) |
1316 | 1316 |
1317 # Prepend the -d64 VM option only if the java command supports it | 1317 # Prepend the -d64 VM option only if the java command supports it |
1318 try: | 1318 try: |
1333 if self.debug_port is not None: | 1333 if self.debug_port is not None: |
1334 self.java_args += ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=' + str(self.debug_port)] | 1334 self.java_args += ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=' + str(self.debug_port)] |
1335 | 1335 |
1336 def format_cmd(self, args, addDefaultArgs): | 1336 def format_cmd(self, args, addDefaultArgs): |
1337 if addDefaultArgs: | 1337 if addDefaultArgs: |
1338 return [self.java] + self.java_args_pfx + self.java_args + self.java_args_sfx + args | 1338 return [self.java] + self.processArgs(args) |
1339 else: | 1339 else: |
1340 return [self.java] + args | 1340 return [self.java] + args |
1341 | |
1342 def processArgs(self, args): | |
1343 return self.java_args_pfx + self.java_args + self.java_args_sfx + args | |
1341 | 1344 |
1342 def bootclasspath(self): | 1345 def bootclasspath(self): |
1343 if self._bootclasspath is None: | 1346 if self._bootclasspath is None: |
1344 tmpDir = tempfile.mkdtemp() | 1347 tmpDir = tempfile.mkdtemp() |
1345 try: | 1348 try: |