diff mx/mx_graal.py @ 15896:db776f9bea7c

mx: prevent spurious "Could not find or load main class com.oracle.graal.hotspot.HotSpotOptionsLoader" error message
author Doug Simon <doug.simon@oracle.com>
date Mon, 26 May 2014 11:48:07 +0200
parents 6dcf8ab4ad86
children 7d1690e145ae 6aa352b260f4
line wrap: on
line diff
--- a/mx/mx_graal.py	Mon May 26 11:47:30 2014 +0200
+++ b/mx/mx_graal.py	Mon May 26 11:48:07 2014 +0200
@@ -488,19 +488,19 @@
     p = mx.project('com.oracle.graal.hotspot')
     mainClass = 'com.oracle.graal.hotspot.HotSpotOptionsLoader'
     assert exists(join(p.source_dirs()[0], mainClass.replace('.', os.sep) + '.java'))
-    hsSrcGenDir = join(p.source_gen_dir(), 'hotspot')
-    if not exists(hsSrcGenDir):
-        os.makedirs(hsSrcGenDir)
-    tmp = StringIO.StringIO()
-    retcode = mx.run_java(['-cp', graalJar, mainClass], out=tmp.write, nonZeroIsFatal=False)
-    if retcode != 0:
-        # Suppress the error if it's because the utility class isn't compiled yet
+
+    def mainClassExists():
         with zipfile.ZipFile(graalJar, 'r') as zf:
             mainClassFile = mainClass.replace('.', '/') + '.class'
-            if mainClassFile not in zf.namelist():
-                return
-        mx.abort(retcode)
-    mx.update_file(join(hsSrcGenDir, 'HotSpotOptions.inline.hpp'), tmp.getvalue())
+            return mainClassFile in zf.namelist()
+
+    if mainClassExists():
+        hsSrcGenDir = join(p.source_gen_dir(), 'hotspot')
+        if not exists(hsSrcGenDir):
+            os.makedirs(hsSrcGenDir)
+        tmp = StringIO.StringIO()
+        mx.run_java(['-cp', graalJar, mainClass], out=tmp.write)
+        mx.update_file(join(hsSrcGenDir, 'HotSpotOptions.inline.hpp'), tmp.getvalue())
 
 def _installGraalJarInJdks(graalDist):
     graalJar = graalDist.path