diff 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
line wrap: on
line diff
--- a/mx/commands.py	Wed Sep 11 16:41:15 2013 +0200
+++ b/mx/commands.py	Wed Sep 11 21:04:24 2013 +0200
@@ -474,11 +474,14 @@
             mx.log('Running pylint on ' + pyfile + '...')
             mx.run(['pylint', '--reports=n', '--rcfile=' + rcfile, pyfile], env=env)
 
-def jdkhome(args, vm=None):
-    """print the JDK directory selected for the 'vm' command"""
+def jdkhome(vm=None):
+    """return the JDK directory selected for the 'vm' command"""
+    build = _vmbuild if _vmSourcesAvailable else 'product'
+    return _jdk(build, installGraalJar=False)
 
-    build = _vmbuild if _vmSourcesAvailable else 'product'
-    print _jdk(build, installGraalJar=False)
+def print_jdkhome(args, vm=None):
+    """print the JDK directory selected for the 'vm' command"""
+    print jdkhome(vm)
 
 def buildvars(args):
     """describe the variables that can be set by the -D option to the 'mx build' commmand"""
@@ -1358,7 +1361,7 @@
                     '--title', 'Graal OpenJDK Project Documentation',
                     '--dot-output-base', 'projects'] + args)
 
-def mx_init():
+def mx_init(suite):
     commands = {
         'build': [build, ''],
         'buildvars': [buildvars, ''],
@@ -1367,7 +1370,7 @@
         'hsdis': [hsdis, '[att]'],
         'hcfdis': [hcfdis, ''],
         'igv' : [igv, ''],
-        'jdkhome': [jdkhome, ''],
+        'jdkhome': [print_jdkhome, ''],
         'pylint': [pylint, ''],
         'dacapo': [dacapo, '[VM options] benchmarks...|"all" [DaCapo options]'],
         'scaladacapo': [scaladacapo, '[VM options] benchmarks...|"all" [Scala DaCapo options]'],
@@ -1406,7 +1409,7 @@
             'export': [export, '[-options] [zipfile]'],
         })
 
-    mx._commands.update(commands)
+    mx.update_commands(suite, commands)
 
 def mx_post_parse_cmd_line(opts):  #
     # TODO _minVersion check could probably be part of a Suite in mx?