Mercurial > hg > truffle
comparison 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 |
comparison
equal
deleted
inserted
replaced
15895:a5c5b4aa79ca | 15896:db776f9bea7c |
---|---|
486 | 486 |
487 def _update_HotSpotOptions_inline_hpp(graalJar): | 487 def _update_HotSpotOptions_inline_hpp(graalJar): |
488 p = mx.project('com.oracle.graal.hotspot') | 488 p = mx.project('com.oracle.graal.hotspot') |
489 mainClass = 'com.oracle.graal.hotspot.HotSpotOptionsLoader' | 489 mainClass = 'com.oracle.graal.hotspot.HotSpotOptionsLoader' |
490 assert exists(join(p.source_dirs()[0], mainClass.replace('.', os.sep) + '.java')) | 490 assert exists(join(p.source_dirs()[0], mainClass.replace('.', os.sep) + '.java')) |
491 hsSrcGenDir = join(p.source_gen_dir(), 'hotspot') | 491 |
492 if not exists(hsSrcGenDir): | 492 def mainClassExists(): |
493 os.makedirs(hsSrcGenDir) | |
494 tmp = StringIO.StringIO() | |
495 retcode = mx.run_java(['-cp', graalJar, mainClass], out=tmp.write, nonZeroIsFatal=False) | |
496 if retcode != 0: | |
497 # Suppress the error if it's because the utility class isn't compiled yet | |
498 with zipfile.ZipFile(graalJar, 'r') as zf: | 493 with zipfile.ZipFile(graalJar, 'r') as zf: |
499 mainClassFile = mainClass.replace('.', '/') + '.class' | 494 mainClassFile = mainClass.replace('.', '/') + '.class' |
500 if mainClassFile not in zf.namelist(): | 495 return mainClassFile in zf.namelist() |
501 return | 496 |
502 mx.abort(retcode) | 497 if mainClassExists(): |
503 mx.update_file(join(hsSrcGenDir, 'HotSpotOptions.inline.hpp'), tmp.getvalue()) | 498 hsSrcGenDir = join(p.source_gen_dir(), 'hotspot') |
499 if not exists(hsSrcGenDir): | |
500 os.makedirs(hsSrcGenDir) | |
501 tmp = StringIO.StringIO() | |
502 mx.run_java(['-cp', graalJar, mainClass], out=tmp.write) | |
503 mx.update_file(join(hsSrcGenDir, 'HotSpotOptions.inline.hpp'), tmp.getvalue()) | |
504 | 504 |
505 def _installGraalJarInJdks(graalDist): | 505 def _installGraalJarInJdks(graalDist): |
506 graalJar = graalDist.path | 506 graalJar = graalDist.path |
507 _update_HotSpotOptions_inline_hpp(graalJar) | 507 _update_HotSpotOptions_inline_hpp(graalJar) |
508 jdks = _jdksDir() | 508 jdks = _jdksDir() |