comparison mx/commands.py @ 11605:3676540f71cf

Allow mxtool suites to be in separate repositories (CR-1367)
author Mick Jordan <mick.jordan@oracle.com>
date Wed, 11 Sep 2013 21:04:24 +0200
parents 2d759e68c8ca
children 78e6109ee411
comparison
equal deleted inserted replaced
11604:943f1863e1c1 11605:3676540f71cf
472 if f.endswith('.py'): 472 if f.endswith('.py'):
473 pyfile = f 473 pyfile = f
474 mx.log('Running pylint on ' + pyfile + '...') 474 mx.log('Running pylint on ' + pyfile + '...')
475 mx.run(['pylint', '--reports=n', '--rcfile=' + rcfile, pyfile], env=env) 475 mx.run(['pylint', '--reports=n', '--rcfile=' + rcfile, pyfile], env=env)
476 476
477 def jdkhome(args, vm=None): 477 def jdkhome(vm=None):
478 """return the JDK directory selected for the 'vm' command"""
479 build = _vmbuild if _vmSourcesAvailable else 'product'
480 return _jdk(build, installGraalJar=False)
481
482 def print_jdkhome(args, vm=None):
478 """print the JDK directory selected for the 'vm' command""" 483 """print the JDK directory selected for the 'vm' command"""
479 484 print jdkhome(vm)
480 build = _vmbuild if _vmSourcesAvailable else 'product'
481 print _jdk(build, installGraalJar=False)
482 485
483 def buildvars(args): 486 def buildvars(args):
484 """describe the variables that can be set by the -D option to the 'mx build' commmand""" 487 """describe the variables that can be set by the -D option to the 'mx build' commmand"""
485 488
486 buildVars = { 489 buildVars = {
1356 '--jd', '@-tag', '--jd', '@vmoption:X', 1359 '--jd', '@-tag', '--jd', '@vmoption:X',
1357 '--overview', join(_graal_home, 'graal', 'overview.html'), 1360 '--overview', join(_graal_home, 'graal', 'overview.html'),
1358 '--title', 'Graal OpenJDK Project Documentation', 1361 '--title', 'Graal OpenJDK Project Documentation',
1359 '--dot-output-base', 'projects'] + args) 1362 '--dot-output-base', 'projects'] + args)
1360 1363
1361 def mx_init(): 1364 def mx_init(suite):
1362 commands = { 1365 commands = {
1363 'build': [build, ''], 1366 'build': [build, ''],
1364 'buildvars': [buildvars, ''], 1367 'buildvars': [buildvars, ''],
1365 'buildvms': [buildvms, '[-options]'], 1368 'buildvms': [buildvms, '[-options]'],
1366 'clean': [clean, ''], 1369 'clean': [clean, ''],
1367 'hsdis': [hsdis, '[att]'], 1370 'hsdis': [hsdis, '[att]'],
1368 'hcfdis': [hcfdis, ''], 1371 'hcfdis': [hcfdis, ''],
1369 'igv' : [igv, ''], 1372 'igv' : [igv, ''],
1370 'jdkhome': [jdkhome, ''], 1373 'jdkhome': [print_jdkhome, ''],
1371 'pylint': [pylint, ''], 1374 'pylint': [pylint, ''],
1372 'dacapo': [dacapo, '[VM options] benchmarks...|"all" [DaCapo options]'], 1375 'dacapo': [dacapo, '[VM options] benchmarks...|"all" [DaCapo options]'],
1373 'scaladacapo': [scaladacapo, '[VM options] benchmarks...|"all" [Scala DaCapo options]'], 1376 'scaladacapo': [scaladacapo, '[VM options] benchmarks...|"all" [Scala DaCapo options]'],
1374 'specjvm2008': [specjvm2008, '[VM options] benchmarks...|"all" [SPECjvm2008 options]'], 1377 'specjvm2008': [specjvm2008, '[VM options] benchmarks...|"all" [SPECjvm2008 options]'],
1375 'specjbb2013': [specjbb2013, '[VM options] [-- [SPECjbb2013 options]]'], 1378 'specjbb2013': [specjbb2013, '[VM options] [-- [SPECjbb2013 options]]'],
1404 1407
1405 commands.update({ 1408 commands.update({
1406 'export': [export, '[-options] [zipfile]'], 1409 'export': [export, '[-options] [zipfile]'],
1407 }) 1410 })
1408 1411
1409 mx._commands.update(commands) 1412 mx.update_commands(suite, commands)
1410 1413
1411 def mx_post_parse_cmd_line(opts): # 1414 def mx_post_parse_cmd_line(opts): #
1412 # TODO _minVersion check could probably be part of a Suite in mx? 1415 # TODO _minVersion check could probably be part of a Suite in mx?
1413 if (mx.java().version < _minVersion) : 1416 if (mx.java().version < _minVersion) :
1414 mx.abort('Requires Java version ' + str(_minVersion) + ' or greater, got version ' + str(mx.java().version)) 1417 mx.abort('Requires Java version ' + str(_minVersion) + ' or greater, got version ' + str(mx.java().version))