Mercurial > hg > graal-jvmci-8
diff mx/commands.py @ 4559:723df37192d6
Make it possible again to build a real client libjvm, drop the UseGraal flag.
Use the --vm option instead of a special -vm option in the bench command
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Fri, 10 Feb 2012 17:04:03 +0100 |
parents | f1d3800b59e1 |
children | 76841bdd5f3e |
line wrap: on
line diff
--- a/mx/commands.py Fri Feb 10 02:22:23 2012 +0100 +++ b/mx/commands.py Fri Feb 10 17:04:03 2012 +0100 @@ -289,21 +289,6 @@ mx.abort('Host JDK directory is missing: ' + src) shutil.copytree(src, dst) - jvmCfg = join(jdk, 'jre', 'lib', 'amd64', 'jvm.cfg') - found = False - if not exists(jvmCfg): - mx.abort(jvmCfg + ' does not exist') - - with open(jvmCfg) as f: - for line in f: - if '-graal KNOWN' in line: - found = True - break - if not found: - mx.log('Appending "-graal KNOWN" to ' + jvmCfg) - with open(jvmCfg, 'a') as f: - f.write('-graal KNOWN\n') - if build == 'product': return jdk elif build in ['debug', 'fastdebug']: @@ -361,28 +346,24 @@ """builds the GraalVM binary and compiles the Graal classes The optional last argument specifies what type of VM to build.""" - - - parser = ArgumentParser(prog='mx build'); - parser.add_argument('--vm', action='store', dest='vm', default='graal', choices=['graal', 'server', 'client'], help='the VM to be built') # Call mx.build to compile the Java sources - opts = mx.build(['--source', '1.7'] + args, parser=parser) + opts2 = mx.build(['--source', '1.7'] + args, parser=ArgumentParser(prog='mx build')) - if not _vmSourcesAvailable or not opts.native: + if not _vmSourcesAvailable or not opts2.native: return - builds = opts.remainder + builds = opts2.remainder if len(builds) == 0: builds = ['product'] - vm = opts.vm + vm = _vm if vm == 'server': buildSuffix = '' elif vm == 'client': buildSuffix = '1' else: - assert vm is 'graal' + assert vm == 'graal', vm buildSuffix = 'graal' for build in builds: @@ -424,6 +405,28 @@ env['ALT_BOOTDIR'] = jdk env.setdefault('INSTALL', 'y') mx.run([mx.gmake_cmd(), build + buildSuffix], cwd=join(_graal_home, 'make'), err=filterXusage) + + jvmCfg = join(jdk, 'jre', 'lib', 'amd64', 'jvm.cfg') + found = False + if not exists(jvmCfg): + mx.abort(jvmCfg + ' does not exist') + + prefix = '-' + vm + vmKnown = prefix + ' KNOWN\n' + lines = [] + with open(jvmCfg) as f: + for line in f: + if vmKnown in line: + found = True + break + if not line.startswith(prefix): + lines.append(line) + if not found: + mx.log('Appending "' + prefix + ' KNOWN" to ' + jvmCfg) + lines.append(vmKnown) + with open(jvmCfg, 'w') as f: + for line in lines: + f.write(line) def vm(args, vm=None, nonZeroIsFatal=True, out=None, err=None, cwd=None, timeout=None, vmbuild=None): """run the GraalVM""" @@ -605,15 +608,7 @@ del args[index] else: mx.abort('-resultfile must be followed by a file name') - vm = 'graal' - if '-vm' in args: - index = args.index('-vm') - if index + 1 < len(args): - vm = args[index + 1] - del args[index] - del args[index] - else: - mx.abort('-vm must be followed by a vm name (graal, server, client..)') + vm = _vm if len(args) is 0: args += ['all'] @@ -715,7 +710,7 @@ 'example': [example, '[-v] example names...'], 'gate' : [gate, ''], 'gv' : [gv, ''], - 'bench' : [bench, '[-vm vm] [-resultfile file] [all(default)|dacapo|specjvm2008|bootstrap]'], + 'bench' : [bench, '[-resultfile file] [all(default)|dacapo|specjvm2008|bootstrap]'], 'unittest' : [unittest, '[filters...]'], 'vm': [vm, '[-options] class [args...]'] } @@ -743,8 +738,9 @@ mx.abort('Requires Java version 1.7 or greater, got version ' + version) if (_vmSourcesAvailable): - global _vm - _vm = opts.vm + if hasattr(opts, 'vm') and opts.vm is not None: + global _vm + _vm = opts.vm if hasattr(opts, 'vmbuild') and opts.vmbuild is not None: global _vmbuild _vmbuild = opts.vmbuild