diff mx/mx_graal.py @ 15000:cc844a4512f1

added graal.version system property that is (only) defined by Graal enabled VMs
author Doug Simon <doug.simon@oracle.com>
date Mon, 07 Apr 2014 16:24:49 +0200
parents c64cd1dd4bd1
children a588d99d4be1
line wrap: on
line diff
--- a/mx/mx_graal.py	Mon Apr 07 11:46:20 2014 +0200
+++ b/mx/mx_graal.py	Mon Apr 07 16:24:49 2014 +0200
@@ -654,18 +654,6 @@
             env.setdefault('HOTSPOT_BUILD_JOBS', str(cpus))
             env.setdefault('ALT_BOOTDIR', mx.java().jdk)
 
-            # extract latest release tag for graal
-            try:
-                tags = [x.split(' ')[0] for x in subprocess.check_output(['hg', 'tags']).split('\n') if x.startswith("graal-")]
-            except:
-                # not a mercurial repository or hg commands are not available.
-                tags = None
-
-            if tags:
-                # extract the most recent tag
-                tag = sorted(tags, key=lambda e: [int(x) for x in e[len("graal-"):].split('.')], reverse=True)[0]
-                env.setdefault('USER_RELEASE_SUFFIX', tag)
-
             if not mx._opts.verbose:
                 runCmd.append('MAKE_VERBOSE=')
             env['JAVA_HOME'] = jdk
@@ -673,6 +661,22 @@
                 env['INCLUDE_GRAAL'] = 'false'
                 env.setdefault('ALT_OUTPUTDIR', join(_graal_home, 'build-nograal', mx.get_os()))
             else:
+                # extract latest release tag for graal
+                try:
+                    tags = [x.split(' ')[0] for x in subprocess.check_output(['hg', '-R', _graal_home, 'tags']).split('\n') if x.startswith("graal-")]
+                except:
+                    # not a mercurial repository or hg commands are not available.
+                    tags = None
+
+                if tags:
+                    # extract the most recent tag
+                    tag = sorted(tags, key=lambda e: [int(x) for x in e[len("graal-"):].split('.')], reverse=True)[0]
+                    env.setdefault('USER_RELEASE_SUFFIX', tag)
+                    env.setdefault('GRAAL_VERSION', tag[len("graal-"):])
+                else:
+                    version = 'unknown-{}-{}'.format(platform.node(), time.strftime('%Y-%m-%d_%H-%M-%S_%Z'))
+                    env.setdefault('USER_RELEASE_SUFFIX', 'graal-' + version)
+                    env.setdefault('GRAAL_VERSION', version)
                 env['INCLUDE_GRAAL'] = 'true'
             env.setdefault('INSTALL', 'y')
             if mx.get_os() == 'solaris':