# HG changeset patch # User Doug Simon # Date 1401097687 -7200 # Node ID db776f9bea7c4f812683e019558f2fd0b8fd3273 # Parent a5c5b4aa79ca64f4bc34c4b7a4c3ecaa12c36bc4 mx: prevent spurious "Could not find or load main class com.oracle.graal.hotspot.HotSpotOptionsLoader" error message diff -r a5c5b4aa79ca -r db776f9bea7c mx/mx_graal.py --- 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