Mercurial > hg > truffle
comparison mx/commands.py @ 7916:9bff64f43299
Better java version numbers support in mx
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Mon, 04 Mar 2013 09:48:14 +0100 |
parents | dbbe8ce3bfa5 |
children | c7d7d9936809 |
comparison
equal
deleted
inserted
replaced
7915:2fc832fbff8d | 7916:9bff64f43299 |
---|---|
75 * questions. | 75 * questions. |
76 */ | 76 */ |
77 | 77 |
78 """ | 78 """ |
79 | 79 |
80 _minVersion = mx.JavaVersion('1.7.0_04') | |
81 | |
80 def _chmodDir(chmodFlags, dirname, fnames): | 82 def _chmodDir(chmodFlags, dirname, fnames): |
81 os.chmod(dirname, chmodFlags) | 83 os.chmod(dirname, chmodFlags) |
82 for name in fnames: | 84 for name in fnames: |
83 os.chmod(os.path.join(dirname, name), chmodFlags) | 85 os.chmod(os.path.join(dirname, name), chmodFlags) |
84 | 86 |
89 """clean the GraalVM source tree""" | 91 """clean the GraalVM source tree""" |
90 opts = mx.clean(args, parser=ArgumentParser(prog='mx clean')) | 92 opts = mx.clean(args, parser=ArgumentParser(prog='mx clean')) |
91 if opts.native: | 93 if opts.native: |
92 os.environ.update(ARCH_DATA_MODEL='64', LANG='C', HOTSPOT_BUILD_JOBS='16') | 94 os.environ.update(ARCH_DATA_MODEL='64', LANG='C', HOTSPOT_BUILD_JOBS='16') |
93 mx.run([mx.gmake_cmd(), 'clean'], cwd=join(_graal_home, 'make')) | 95 mx.run([mx.gmake_cmd(), 'clean'], cwd=join(_graal_home, 'make')) |
94 jdks = join(_graal_home, 'jdk' + mx.java().version) | 96 jdks = join(_graal_home, 'jdk' + str(mx.java().version)) |
95 if exists(jdks): | 97 if exists(jdks): |
96 shutil.rmtree(jdks) | 98 shutil.rmtree(jdks) |
97 | 99 |
98 def export(args): | 100 def export(args): |
99 """create a GraalVM zip file for distribution""" | 101 """create a GraalVM zip file for distribution""" |
316 | 318 |
317 def _jdk(build='product', create=False): | 319 def _jdk(build='product', create=False): |
318 """ | 320 """ |
319 Get the JDK into which Graal is installed, creating it first if necessary. | 321 Get the JDK into which Graal is installed, creating it first if necessary. |
320 """ | 322 """ |
321 jdk = join(_graal_home, 'jdk' + mx.java().version, build) | 323 jdk = join(_graal_home, 'jdk' + str(mx.java().version), build) |
322 jdkContents = ['bin', 'include', 'jre', 'lib'] | 324 jdkContents = ['bin', 'include', 'jre', 'lib'] |
323 if (exists(join(jdk, 'db'))): | 325 if (exists(join(jdk, 'db'))): |
324 jdkContents.append('db') | 326 jdkContents.append('db') |
325 if mx.get_os() != 'windows': | 327 if mx.get_os() != 'windows': |
326 jdkContents.append('man') | 328 jdkContents.append('man') |
433 | 435 |
434 def jdkhome(args, vm=None): | 436 def jdkhome(args, vm=None): |
435 """print the JDK directory selected for the 'vm' command""" | 437 """print the JDK directory selected for the 'vm' command""" |
436 | 438 |
437 build = _vmbuild if _vmSourcesAvailable else 'product' | 439 build = _vmbuild if _vmSourcesAvailable else 'product' |
438 print join(_graal_home, 'jdk' + mx.java().version, build) | 440 print join(_graal_home, 'jdk' + str(mx.java().version), build) |
439 | 441 |
440 def build(args, vm=None): | 442 def build(args, vm=None): |
441 """build the VM binary | 443 """build the VM binary |
442 | 444 |
443 The global '--vm' option selects which VM to build. This command also | 445 The global '--vm' option selects which VM to build. This command also |
1166 'build': [build, '[-options] [product|debug|fastdebug]...'] | 1168 'build': [build, '[-options] [product|debug|fastdebug]...'] |
1167 }) | 1169 }) |
1168 | 1170 |
1169 mx.commands.update(commands) | 1171 mx.commands.update(commands) |
1170 | 1172 |
1171 def mx_post_parse_cmd_line(opts): | 1173 def mx_post_parse_cmd_line(opts):# |
1172 version = mx.java().version.split('-')[0] | 1174 # TODO _minVersion check could probably be part of a Suite in mx? |
1173 parts = version.split('.') | 1175 if (mx.java().version < _minVersion) : |
1174 assert len(parts) >= 2 | 1176 mx.abort('Requires Java version ' + str(_minVersion) + ' or greater, got version ' + str(mx.java().version)) |
1175 assert parts[0] == '1' | |
1176 major = int(parts[1]) | |
1177 minor = 0 | |
1178 update = 0 | |
1179 if len(parts) >= 3: | |
1180 minorParts = parts[2].split('_') | |
1181 if len(minorParts) >= 1: | |
1182 minor = int(minorParts[0]) | |
1183 if len(minorParts) >= 2: | |
1184 update = int(minorParts[1]) | |
1185 | |
1186 if (not major >= 7) or (major == 7 and minor == 0 and not update >= 4) : | |
1187 mx.abort('Requires Java version 1.7.0_04 or greater, got version ' + version) | |
1188 | 1177 |
1189 if (_vmSourcesAvailable): | 1178 if (_vmSourcesAvailable): |
1190 if hasattr(opts, 'vm') and opts.vm is not None: | 1179 if hasattr(opts, 'vm') and opts.vm is not None: |
1191 global _vm | 1180 global _vm |
1192 _vm = opts.vm | 1181 _vm = opts.vm |