changeset 22147:b50bd2ed6779

adapted to JDKDeployedDist.postJdkInstall changing to onPostJdkInstall() method
author Doug Simon <doug.simon@oracle.com>
date Wed, 08 Jul 2015 15:13:18 +0200
parents 658d16b6d47e
children 315fe47a4cf9
files mx.graal/mx_graal.py
diffstat 1 files changed, 31 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/mx.graal/mx_graal.py	Wed Jul 08 15:12:27 2015 +0200
+++ b/mx.graal/mx_graal.py	Wed Jul 08 15:13:18 2015 +0200
@@ -36,12 +36,39 @@
 
 _suite = mx.suite('graal')
 
-_graalDeployedDist = JDKDeployedDist('GRAAL', usesJVMCIClassLoader=True)
-_graalTruffleDeployedDist = JDKDeployedDist('GRAAL_TRUFFLE', usesJVMCIClassLoader=True)
+class GraalJDKDeployedDist(JDKDeployedDist):
+    def __init__(self):
+        JDKDeployedDist.__init__(self, 'GRAAL', usesJVMCIClassLoader=True)
+
+    def onPostJdkInstall(self, jdkDir, targetDir):
+        self._updateGraalPropertiesFile(join(jdkDir, 'jre', 'lib'))
 
-_graalDeployedDist.postJdkInstall = lambda jdkDir, targetDir: _updateGraalPropertiesFile(join(jdkDir, 'jre', 'lib'))
+    def _updateGraalPropertiesFile(self, jreLibDir):
+        """
+        Updates (or creates) 'jreLibDir'/jvmci/graal.properties to set/modify the
+        graal.version property.
+        """
+        version = _suite.release_version()
+        graalProperties = join(jreLibDir, 'jvmci', 'graal.properties')
+        if not exists(graalProperties):
+            with open(graalProperties, 'w') as fp:
+                print >> fp, 'graal.version=' + version
+        else:
+            content = []
+            with open(graalProperties) as fp:
+                for line in fp:
+                    if line.startswith('graal.version='):
+                        content.append('graal.version=' + version)
+                    else:
+                        content.append(line.rstrip(os.linesep))
+            with open(graalProperties, 'w') as fp:
+                fp.write(os.linesep.join(content))
 
-mx_jvmci.jdkDeployedDists += [_graalDeployedDist, _graalTruffleDeployedDist]
+mx_jvmci.jdkDeployedDists += [
+    GraalJDKDeployedDist(),
+    JDKDeployedDist('GRAAL_TRUFFLE', usesJVMCIClassLoader=True)
+]
+
 mx_jvmci.jacocoIncludes += ['com.oracle.graal.*']
 mx_jvmci.jacocoExcludedAnnotations += ['@Snippet', '@ClassSubstitution']
 
@@ -89,27 +116,6 @@
 
     _run_benchmark(args, sanitycheck.dacapoScalaSanityWarmup.keys(), launcher)
 
-def _updateGraalPropertiesFile(jreLibDir):
-    """
-    Updates (or creates) 'jreLibDir'/jvmci/graal.properties to set/modify the
-    graal.version property.
-    """
-    version = _suite.release_version()
-    graalProperties = join(jreLibDir, 'jvmci', 'graal.properties')
-    if not exists(graalProperties):
-        with open(graalProperties, 'w') as fp:
-            print >> fp, 'graal.version=' + version
-    else:
-        content = []
-        with open(graalProperties) as fp:
-            for line in fp:
-                if line.startswith('graal.version='):
-                    content.append('graal.version=' + version)
-                else:
-                    content.append(line.rstrip(os.linesep))
-        with open(graalProperties, 'w') as fp:
-            fp.write(os.linesep.join(content))
-
 def microbench(args):
     """run JMH microbenchmark projects"""
     vmArgs, jmhArgs = mx.extract_VM_args(args, useDoubleDash=True)