Mercurial > hg > truffle
comparison mx/mx_graal.py @ 16605:c55478e640e1
generalized check that VM is up-to-date with all generated sources
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 28 Jul 2014 16:51:45 +0200 |
parents | 6e7311d571ff |
children | 8cdb9ef96c01 |
comparison
equal
deleted
inserted
replaced
16604:b519954b9daf | 16605:c55478e640e1 |
---|---|
482 else: | 482 else: |
483 toDelete = join(jreLibDir, 'graal.options') | 483 toDelete = join(jreLibDir, 'graal.options') |
484 if exists(toDelete): | 484 if exists(toDelete): |
485 os.unlink(toDelete) | 485 os.unlink(toDelete) |
486 | 486 |
487 def _graalRuntime_inline_hpp_path(): | 487 def _makeHotspotGeneratedSourcesDir(): |
488 hsSrcGenDir = join(mx.project('com.oracle.graal.hotspot').source_gen_dir(), 'hotspot') | 488 hsSrcGenDir = join(mx.project('com.oracle.graal.hotspot').source_gen_dir(), 'hotspot') |
489 if not exists(hsSrcGenDir): | 489 if not exists(hsSrcGenDir): |
490 os.makedirs(hsSrcGenDir) | 490 os.makedirs(hsSrcGenDir) |
491 return join(hsSrcGenDir, 'graalRuntime.inline.hpp') | 491 return hsSrcGenDir |
492 | |
493 | |
494 def _graalRuntime_inline_hpp_path(): | |
495 return join(_makeHotspotGeneratedSourcesDir(), 'graalRuntime.inline.hpp') | |
492 | 496 |
493 def _update_graalRuntime_inline_hpp(graalJar): | 497 def _update_graalRuntime_inline_hpp(graalJar): |
494 p = mx.project('com.oracle.graal.hotspot.sourcegen') | 498 p = mx.project('com.oracle.graal.hotspot.sourcegen') |
495 mainClass = 'com.oracle.graal.hotspot.sourcegen.GenGraalRuntimeInlineHpp' | 499 mainClass = 'com.oracle.graal.hotspot.sourcegen.GenGraalRuntimeInlineHpp' |
496 if exists(join(p.output_dir(), mainClass.replace('.', os.sep) + '.class')): | 500 if exists(join(p.output_dir(), mainClass.replace('.', os.sep) + '.class')): |
497 graalRuntime_inline_hpp = _graalRuntime_inline_hpp_path() | 501 graalRuntime_inline_hpp = _graalRuntime_inline_hpp_path() |
498 tmp = StringIO.StringIO() | 502 tmp = StringIO.StringIO() |
499 mx.run_java(['-cp', '{}{}{}'.format(graalJar, os.pathsep, p.output_dir()), mainClass], out=tmp.write) | 503 mx.run_java(['-cp', '{}{}{}'.format(graalJar, os.pathsep, p.output_dir()), mainClass], out=tmp.write) |
500 mx.update_file(graalRuntime_inline_hpp, tmp.getvalue()) | 504 mx.update_file(graalRuntime_inline_hpp, tmp.getvalue()) |
501 | 505 |
502 def _check_graalRuntime_inline_hpp_upToDate(jdk, vm, bld): | 506 def _checkVMIsNewerThanGeneratedSources(jdk, vm, bld): |
503 if isGraalEnabled(vm): | 507 if isGraalEnabled(vm): |
504 hpp = _graalRuntime_inline_hpp_path() | |
505 vmLib = mx.TimeStampFile(join(_vmLibDirInJdk(jdk), vm, mx.add_lib_prefix(mx.add_lib_suffix('jvm')))) | 508 vmLib = mx.TimeStampFile(join(_vmLibDirInJdk(jdk), vm, mx.add_lib_prefix(mx.add_lib_suffix('jvm')))) |
506 if vmLib.isOlderThan(hpp): | 509 for name in ['graalRuntime.inline.hpp', 'HotSpotVMConfig.inline.hpp']: |
507 mx.log('The VM ' + vmLib.path + ' is older than ' + hpp) | 510 genSrc = join(_makeHotspotGeneratedSourcesDir(), name) |
508 mx.abort('You need to run "mx --vm ' + vm + ' --vmbuild ' + bld + ' build"') | 511 if vmLib.isOlderThan(genSrc): |
512 mx.log('The VM ' + vmLib.path + ' is older than ' + genSrc) | |
513 mx.abort('You need to run "mx --vm ' + vm + ' --vmbuild ' + bld + ' build"') | |
509 | 514 |
510 def _installGraalJarInJdks(graalDist): | 515 def _installGraalJarInJdks(graalDist): |
511 graalJar = graalDist.path | 516 graalJar = graalDist.path |
512 if graalJar.endswith('graal.jar'): | 517 if graalJar.endswith('graal.jar'): |
513 _update_graalRuntime_inline_hpp(graalJar) | 518 _update_graalRuntime_inline_hpp(graalJar) |
894 mx.abort("conflicting working directories: do not set --vmcwd for this command") | 899 mx.abort("conflicting working directories: do not set --vmcwd for this command") |
895 | 900 |
896 build = vmbuild if vmbuild is not None else _vmbuild if _vmSourcesAvailable else 'product' | 901 build = vmbuild if vmbuild is not None else _vmbuild if _vmSourcesAvailable else 'product' |
897 jdk = _jdk(build, vmToCheck=vm, installGraalJar=False) | 902 jdk = _jdk(build, vmToCheck=vm, installGraalJar=False) |
898 _updateInstalledGraalOptionsFile(jdk) | 903 _updateInstalledGraalOptionsFile(jdk) |
899 _check_graalRuntime_inline_hpp_upToDate(jdk, vm, build) | 904 _checkVMIsNewerThanGeneratedSources(jdk, vm, build) |
900 mx.expand_project_in_args(args) | 905 mx.expand_project_in_args(args) |
901 if _make_eclipse_launch: | 906 if _make_eclipse_launch: |
902 mx.make_eclipse_launch(args, 'graal-' + build, name=None, deps=mx.project('com.oracle.graal.hotspot').all_deps([], True)) | 907 mx.make_eclipse_launch(args, 'graal-' + build, name=None, deps=mx.project('com.oracle.graal.hotspot').all_deps([], True)) |
903 if _jacoco == 'on' or _jacoco == 'append': | 908 if _jacoco == 'on' or _jacoco == 'append': |
904 jacocoagent = mx.library("JACOCOAGENT", True) | 909 jacocoagent = mx.library("JACOCOAGENT", True) |