changeset 11936:4cdf7623fbe6

ensure graal.options in the JDK is deployed/updated/deleted each time the VM is run
author Doug Simon <doug.simon@oracle.com>
date Tue, 08 Oct 2013 15:06:43 +0200
parents 12e9d529fd1d
children dfaac94659aa
files mx/commands.py
diffstat 1 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mx/commands.py	Tue Oct 08 13:30:10 2013 +0200
+++ b/mx/commands.py	Tue Oct 08 15:06:43 2013 +0200
@@ -365,9 +365,18 @@
 
     return jdk
 
+def _updateInstalledGraalOptionsFile(jdk):
+    graalOptions = join(_graal_home, 'graal.options')
+    jreLibDir = join(jdk, 'jre', 'lib')
+    if exists(graalOptions):
+        shutil.copy(graalOptions, join(jreLibDir, 'graal.options'))
+    else:
+        toDelete = join(jreLibDir, 'graal.options')
+        if exists(toDelete):
+            os.unlink(toDelete)
+
 def _installGraalJarInJdks(graalDist):
     graalJar = graalDist.path
-    graalOptions = join(_graal_home, 'graal.options')
     jdks = _jdksDir()
     if exists(jdks):
         for e in os.listdir(jdks):
@@ -379,9 +388,6 @@
                 os.close(fd)
                 shutil.move(tmp, join(jreLibDir, 'graal.jar'))
 
-                if exists(graalOptions):
-                    shutil.copy(graalOptions, join(jreLibDir, 'graal.options'))
-
 # run a command in the windows SDK Debug Shell
 def _runInDebugShell(cmd, workingDir, logFile=None, findInOutput=None, respondTo=None):
     if respondTo is None:
@@ -692,6 +698,7 @@
 
     build = vmbuild if vmbuild is not None else _vmbuild if _vmSourcesAvailable else 'product'
     jdk = _jdk(build, vmToCheck=vm, installGraalJar=False)
+    _updateInstalledGraalOptionsFile(jdk)
     mx.expand_project_in_args(args)
     if _make_eclipse_launch:
         mx.make_eclipse_launch(args, 'graal-' + build, name=None, deps=mx.project('com.oracle.graal.hotspot').all_deps([], True))