changeset 8134:6e3ebc6fd5a4

graal.jar is installed in all JDKs every time it is updated (GRAAL-136)
author Doug Simon <doug.simon@oracle.com>
date Wed, 06 Mar 2013 20:25:57 +0100
parents 396a059fdeed
children 8d10fc6b4f6c
files mx/commands.py mxtool/mx.py
diffstat 2 files changed, 26 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mx/commands.py	Wed Mar 06 18:04:54 2013 +0100
+++ b/mx/commands.py	Wed Mar 06 20:25:57 2013 +0100
@@ -373,8 +373,20 @@
     else:
         if not exists(jdk):
             mx.abort('The ' + build + ' VM has not been created - run \'mx clean; mx build ' + build + '\'')
+            
+    _installGraalJarInJdks(mx.distribution('GRAAL'))
+    
     return jdk
 
+def _installGraalJarInJdks(graalDist):
+    graalJar = graalDist.path
+    jdks = join(_graal_home, 'jdk' + str(mx.java().version))
+    if exists(jdks):
+        for e in os.listdir(jdks):
+            jreLibDir = join(jdks, e, 'jre', 'lib')
+            if exists(jreLibDir):
+                shutil.copyfile(graalJar, join(jreLibDir, 'graal.jar'))
+
 # run a command in the windows SDK Debug Shell
 def _runInDebugShell(cmd, workingDir, logFile=None, findInOutput=None, respondTo={}):
     newLine = os.linesep
@@ -1177,3 +1189,5 @@
     _jacoco = opts.jacoco
     global _native_dbg
     _native_dbg = opts.native_dbg
+
+    mx.distribution('GRAAL').add_update_listener(_installGraalJarInJdks)
--- a/mxtool/mx.py	Wed Mar 06 18:04:54 2013 +0100
+++ b/mxtool/mx.py	Wed Mar 06 20:25:57 2013 +0100
@@ -160,10 +160,18 @@
         if not isabs(self.path):
             self.path = join(suite.dir, self.path)
         self.deps = deps
+        self.update_listeners = set()
         
     def __str__(self):
         return self.name
     
+    def add_update_listener(self, listener):
+        self.update_listeners.add(listener)
+        
+    def notify_updated(self):
+        for l in self.update_listeners:
+            l(self)
+    
 """
 A dependency is a library or project specified in a suite.
 """
@@ -563,8 +571,6 @@
     def _post_init(self, opts):
         mxDir = join(self.dir, 'mx')
         self._load_projects(mxDir)
-        if hasattr(self, 'mx_post_parse_cmd_line'):
-            self.mx_post_parse_cmd_line(opts)
         for p in self.projects:
             existing = _projects.get(p.name)
             if existing is not None:
@@ -581,6 +587,8 @@
             if existing is not None:
                 abort('cannot redefine distribution  ' + d.name)
             _dists[d.name] = d
+        if hasattr(self, 'mx_post_parse_cmd_line'):
+            self.mx_post_parse_cmd_line(opts)
 
 class XMLElement(xml.dom.minidom.Element):
     def writexml(self, writer, indent="", addindent="", newl=""):
@@ -1652,6 +1660,8 @@
                         arcname = join(relpath, f).replace(os.sep, '/')
                         zf.write(join(root, f), arcname)
             zf.close()
+            d.notify_updated()
+
         else:
             p = project(name)
             outputDir = p.output_dir()