Mercurial > hg > truffle
comparison mx/mx_graal.py @ 16782:9f5e33cf8d52
Factored out the '_copyToJdk' function and allow copying files to jre/lib/ext.
author | Danilo Ansaloni <danilo.ansaloni@oracle.com> |
---|---|
date | Tue, 12 Aug 2014 14:04:01 +0200 |
parents | 3d148f5e90b8 |
children | a8af2abc2039 |
comparison
equal
deleted
inserted
replaced
16781:e2ebaf1e1b74 | 16782:9f5e33cf8d52 |
---|---|
83 | 83 |
84 _minVersion = mx.VersionSpec('1.8') | 84 _minVersion = mx.VersionSpec('1.8') |
85 | 85 |
86 JDK_UNIX_PERMISSIONS_DIR = 0755 | 86 JDK_UNIX_PERMISSIONS_DIR = 0755 |
87 JDK_UNIX_PERMISSIONS_FILE = 0644 | 87 JDK_UNIX_PERMISSIONS_FILE = 0644 |
88 JDK_UNIX_PERMISSIONS_EXEC = 0755 | |
88 | 89 |
89 def isVMSupported(vm): | 90 def isVMSupported(vm): |
90 if 'client' in vm and len(platform.mac_ver()[0]) != 0: | 91 if 'client' in vm and len(platform.mac_ver()[0]) != 0: |
91 # Client VM not supported: java launcher on Mac OS X translates '-client' to '-server' | 92 # Client VM not supported: java launcher on Mac OS X translates '-client' to '-server' |
92 return False | 93 return False |
543 zf.writestr(os.path.basename(javaClass), fp.read()) | 544 zf.writestr(os.path.basename(javaClass), fp.read()) |
544 zf.close() | 545 zf.close() |
545 os.unlink(javaSource) | 546 os.unlink(javaSource) |
546 os.unlink(javaClass) | 547 os.unlink(javaClass) |
547 | 548 |
548 def _installDistInJdks(dist): | 549 def _copyToJdk(src, dst): |
550 name = os.path.basename(src) | |
551 dstLib = join(dst, name) | |
552 if mx.get_env('SYMLINK_GRAAL_JAR', None) == 'true': | |
553 # Using symlinks is much faster than copying but may | |
554 # cause issues if the lib is being updated while | |
555 # the VM is running. | |
556 if not os.path.islink(dstLib) or not os.path.realpath(dstLib) == src: | |
557 if exists(dstLib): | |
558 os.remove(dstLib) | |
559 os.symlink(src, dstLib) | |
560 else: | |
561 # do a copy and then a move to get atomic updating (on Unix) | |
562 fd, tmp = tempfile.mkstemp(suffix='', prefix=name, dir=dst) | |
563 shutil.copyfile(src, tmp) | |
564 os.close(fd) | |
565 shutil.move(tmp, dstLib) | |
566 os.chmod(dstLib, JDK_UNIX_PERMISSIONS_FILE) | |
567 | |
568 def _installDistInJdksExt(dist): | |
569 _installDistInJdks(dist, True) | |
570 | |
571 def _installDistInJdks(dist, ext=False): | |
549 """ | 572 """ |
550 Installs the jar(s) for a given Distribution into all existing Graal JDKs | 573 Installs the jar(s) for a given Distribution into all existing Graal JDKs |
551 """ | 574 """ |
552 | 575 |
553 if dist.name == 'GRAAL_TRUFFLE': | 576 if dist.name == 'GRAAL_TRUFFLE': |
555 jdks = _jdksDir() | 578 jdks = _jdksDir() |
556 | 579 |
557 if exists(jdks): | 580 if exists(jdks): |
558 for e in os.listdir(jdks): | 581 for e in os.listdir(jdks): |
559 jreLibDir = join(jdks, e, 'jre', 'lib') | 582 jreLibDir = join(jdks, e, 'jre', 'lib') |
583 if ext: | |
584 jreLibDir = join(jreLibDir, 'ext') | |
560 if exists(jreLibDir): | 585 if exists(jreLibDir): |
561 def install(srcJar, dstDir): | 586 _copyToJdk(dist.path, jreLibDir) |
562 name = os.path.basename(srcJar) | |
563 dstJar = join(dstDir, name) | |
564 if mx.get_env('SYMLINK_GRAAL_JAR', None) == 'true': | |
565 # Using symlinks is much faster than copying but may | |
566 # cause issues if the jar is being updated while | |
567 # the VM is running. | |
568 if not os.path.islink(dstJar) or not os.path.realpath(dstJar) == srcJar: | |
569 if exists(dstJar): | |
570 os.remove(dstJar) | |
571 os.symlink(srcJar, dstJar) | |
572 else: | |
573 # do a copy and then a move to get atomic updating (on Unix) | |
574 fd, tmp = tempfile.mkstemp(suffix='', prefix=name, dir=dstDir) | |
575 shutil.copyfile(srcJar, tmp) | |
576 os.close(fd) | |
577 shutil.move(tmp, dstJar) | |
578 os.chmod(dstJar, JDK_UNIX_PERMISSIONS_FILE) | |
579 | |
580 install(dist.path, jreLibDir) | |
581 if dist.sourcesPath: | 587 if dist.sourcesPath: |
582 install(dist.sourcesPath, join(jdks, e)) | 588 _copyToJdk(dist.sourcesPath, join(jdks, e)) |
583 | 589 |
584 # run a command in the windows SDK Debug Shell | 590 # run a command in the windows SDK Debug Shell |
585 def _runInDebugShell(cmd, workingDir, logFile=None, findInOutput=None, respondTo=None): | 591 def _runInDebugShell(cmd, workingDir, logFile=None, findInOutput=None, respondTo=None): |
586 if respondTo is None: | 592 if respondTo is None: |
587 respondTo = {} | 593 respondTo = {} |
1877 availableBenchmarks.add(group) | 1883 availableBenchmarks.add(group) |
1878 | 1884 |
1879 _run_benchmark(args, sorted(availableBenchmarks), launcher) | 1885 _run_benchmark(args, sorted(availableBenchmarks), launcher) |
1880 | 1886 |
1881 def specjbb2013(args): | 1887 def specjbb2013(args): |
1882 """runs the composite SPECjbb2013 benchmark""" | 1888 """run the composite SPECjbb2013 benchmark""" |
1883 | 1889 |
1884 def launcher(bm, harnessArgs, extraVmOpts): | 1890 def launcher(bm, harnessArgs, extraVmOpts): |
1885 assert bm is None | 1891 assert bm is None |
1886 return sanitycheck.getSPECjbb2013(harnessArgs).bench(_get_vm(), extraVmOpts=extraVmOpts) | 1892 return sanitycheck.getSPECjbb2013(harnessArgs).bench(_get_vm(), extraVmOpts=extraVmOpts) |
1887 | 1893 |
1888 _run_benchmark(args, None, launcher) | 1894 _run_benchmark(args, None, launcher) |
1889 | 1895 |
1890 def specjbb2005(args): | 1896 def specjbb2005(args): |
1891 """runs the composite SPECjbb2005 benchmark""" | 1897 """run the composite SPECjbb2005 benchmark""" |
1892 | 1898 |
1893 def launcher(bm, harnessArgs, extraVmOpts): | 1899 def launcher(bm, harnessArgs, extraVmOpts): |
1894 assert bm is None | 1900 assert bm is None |
1895 return sanitycheck.getSPECjbb2005(harnessArgs).bench(_get_vm(), extraVmOpts=extraVmOpts) | 1901 return sanitycheck.getSPECjbb2005(harnessArgs).bench(_get_vm(), extraVmOpts=extraVmOpts) |
1896 | 1902 |