comparison mx/mx_graal.py @ 14826:17a735726670

Merge.
author Josef Eisl <josef.eisl@jku.at>
date Thu, 20 Mar 2014 13:50:21 +0100
parents f50dece27798
children af7b9b9a9a28
comparison
equal deleted inserted replaced
14825:5ddfdc13027a 14826:17a735726670
80 _make_eclipse_launch = False 80 _make_eclipse_launch = False
81 81
82 _minVersion = mx.VersionSpec('1.7.0_04') 82 _minVersion = mx.VersionSpec('1.7.0_04')
83 83
84 JDK_UNIX_PERMISSIONS = 0755 84 JDK_UNIX_PERMISSIONS = 0755
85
86 def isVMSupported(vm):
87 if 'client' in vm and len(platform.mac_ver()[0]) != 0:
88 # Client VM not supported: java launcher on Mac OS X translates '-client' to '-server'
89 return False
90 return True
85 91
86 def _get_vm(): 92 def _get_vm():
87 """ 93 """
88 Gets the configured VM, presenting a dialogue if there is no currently configured VM. 94 Gets the configured VM, presenting a dialogue if there is no currently configured VM.
89 """ 95 """
565 jdk = _jdk(build, create=True) 571 jdk = _jdk(build, create=True)
566 572
567 if vm == 'original': 573 if vm == 'original':
568 if build != 'product': 574 if build != 'product':
569 mx.log('only product build of original VM exists') 575 mx.log('only product build of original VM exists')
576 continue
577
578 if not isVMSupported(vm):
579 mx.log('The ' + vm + ' VM is not supported on this platform - skipping')
570 continue 580 continue
571 581
572 vmDir = join(_vmLibDirInJdk(jdk), vm) 582 vmDir = join(_vmLibDirInJdk(jdk), vm)
573 if not exists(vmDir): 583 if not exists(vmDir):
574 if mx.get_os() != 'windows': 584 if mx.get_os() != 'windows':
716 """run the VM selected by the '--vm' option""" 726 """run the VM selected by the '--vm' option"""
717 727
718 if vm is None: 728 if vm is None:
719 vm = _get_vm() 729 vm = _get_vm()
720 730
721 if 'client' in vm and len(platform.mac_ver()[0]) != 0: 731 if not isVMSupported(vm):
722 mx.abort("Client VM not supported: java launcher on Mac OS X translates '-client' to '-server'") 732 mx.abort('The ' + vm + ' is not supported on this platform')
723 733
724 if cwd is None: 734 if cwd is None:
725 cwd = _vm_cwd 735 cwd = _vm_cwd
726 elif _vm_cwd is not None and _vm_cwd != cwd: 736 elif _vm_cwd is not None and _vm_cwd != cwd:
727 mx.abort("conflicting working directories: do not set --vmcwd for this command") 737 mx.abort("conflicting working directories: do not set --vmcwd for this command")
925 vms = args.vms.split(',') 935 vms = args.vms.split(',')
926 builds = args.builds.split(',') 936 builds = args.builds.split(',')
927 937
928 allStart = time.time() 938 allStart = time.time()
929 for v in vms: 939 for v in vms:
940 if not isVMSupported(v):
941 mx.log('The ' + v + ' VM is not supported on this platform - skipping')
942 continue
943
930 for vmbuild in builds: 944 for vmbuild in builds:
931 if v == 'original' and vmbuild != 'product': 945 if v == 'original' and vmbuild != 'product':
932 continue 946 continue
933 if not args.console: 947 if not args.console:
934 logFile = join(v + '-' + vmbuild + '.log') 948 logFile = join(v + '-' + vmbuild + '.log')
1041 buildvms(['--vms', 'server-nograal', '--builds', 'optimized']) 1055 buildvms(['--vms', 'server-nograal', '--builds', 'optimized'])
1042 tasks.append(t.stop()) 1056 tasks.append(t.stop())
1043 1057
1044 for vmbuild in ['product', 'fastdebug']: 1058 for vmbuild in ['product', 'fastdebug']:
1045 for theVm in ['client', 'server']: 1059 for theVm in ['client', 'server']:
1060 if not isVMSupported(theVm):
1061 mx.log('The' + theVm + ' VM is not supported on this platform')
1062 continue
1046 with VM(theVm, vmbuild): 1063 with VM(theVm, vmbuild):
1047 t = Task('DaCapo_pmd:' + theVm + ':' + vmbuild) 1064 t = Task('DaCapo_pmd:' + theVm + ':' + vmbuild)
1048 dacapo(['pmd']) 1065 dacapo(['pmd'])
1049 tasks.append(t.stop()) 1066 tasks.append(t.stop())
1050 1067
1173 with open(join(_graal_home, '.ideal_graph_visualizer.log'), 'w') as fp: 1190 with open(join(_graal_home, '.ideal_graph_visualizer.log'), 'w') as fp:
1174 # When the http_proxy environment variable is set, convert it to the proxy settings that ant needs 1191 # When the http_proxy environment variable is set, convert it to the proxy settings that ant needs
1175 env = os.environ 1192 env = os.environ
1176 proxy = os.environ.get('http_proxy') 1193 proxy = os.environ.get('http_proxy')
1177 if not (proxy is None) and len(proxy) > 0: 1194 if not (proxy is None) and len(proxy) > 0:
1178 if proxy.contains('://'): 1195 if '://' in proxy:
1179 # Remove the http:// prefix (or any other protocol prefix) 1196 # Remove the http:// prefix (or any other protocol prefix)
1180 proxy = proxy.split('://', 1)[1] 1197 proxy = proxy.split('://', 1)[1]
1181 # Separate proxy server name and port number 1198 # Separate proxy server name and port number
1182 proxyName, proxyPort = proxy.split(':', 1) 1199 proxyName, proxyPort = proxy.split(':', 1)
1183 proxyEnv = '-DproxyHost="' + proxyName + '" -DproxyPort=' + proxyPort 1200 proxyEnv = '-DproxyHost="' + proxyName + '" -DproxyPort=' + proxyPort
1636 err=subprocess.STDOUT) 1653 err=subprocess.STDOUT)
1637 1654
1638 valueMap = parser.parse(output.getvalue()) 1655 valueMap = parser.parse(output.getvalue())
1639 return valueMap 1656 return valueMap
1640 1657
1658 def findbugs(args):
1659 '''run FindBugs against non-test Java projects'''
1660 findBugsHome = mx.get_env('FINDBUGS_HOME', None)
1661 if findBugsHome:
1662 findbugsJar = join(findBugsHome, 'lib', 'findbugs.jar')
1663 else:
1664 findbugsLib = join(_graal_home, 'lib', 'findbugs-3.0.0')
1665 if not exists(findbugsLib):
1666 tmp = tempfile.mkdtemp(prefix='findbugs-download-tmp', dir=_graal_home)
1667 try:
1668 findbugsDist = join(tmp, 'findbugs.zip')
1669 mx.download(findbugsDist, ['http://sourceforge.net/projects/findbugs/files/findbugs/3.0.0/findbugs-3.0.0-dev-20131204-e3cbbd5.zip'])
1670 with zipfile.ZipFile(findbugsDist) as zf:
1671 candidates = [e for e in zf.namelist() if e.endswith('/lib/findbugs.jar')]
1672 assert len(candidates) == 1, candidates
1673 libDirInZip = os.path.dirname(candidates[0])
1674 zf.extractall(tmp)
1675 shutil.copytree(join(tmp, libDirInZip), findbugsLib)
1676 finally:
1677 shutil.rmtree(tmp)
1678 findbugsJar = join(findbugsLib, 'findbugs.jar')
1679 assert exists(findbugsJar)
1680 nonTestProjects = [p for p in mx.projects() if not p.name.endswith('.test') and not p.name.endswith('.jtt')]
1681 outputDirs = [p.output_dir() for p in nonTestProjects]
1682 findbugsResults = join(_graal_home, 'findbugs.results')
1683 exitcode = mx.run_java(['-jar', findbugsJar, '-textui', '-low', '-maxRank', '15', '-exclude', join(_graal_home, 'graal', 'findbugsExcludeFilter.xml'),
1684 '-auxclasspath', mx.classpath([p.name for p in nonTestProjects]), '-output', findbugsResults, '-progress', '-exitcode'] + args + outputDirs, nonZeroIsFatal=False)
1685 if exitcode != 0:
1686 with open(findbugsResults) as fp:
1687 mx.log(fp.read())
1688 os.unlink(findbugsResults)
1689 return exitcode
1641 1690
1642 def mx_init(suite): 1691 def mx_init(suite):
1643 commands = { 1692 commands = {
1644 'build': [build, ''], 1693 'build': [build, ''],
1645 'buildvars': [buildvars, ''], 1694 'buildvars': [buildvars, ''],
1646 'buildvms': [buildvms, '[-options]'], 1695 'buildvms': [buildvms, '[-options]'],
1647 'c1visualizer' : [c1visualizer, ''], 1696 'c1visualizer' : [c1visualizer, ''],
1648 'clean': [clean, ''], 1697 'clean': [clean, ''],
1698 'findbugs': [findbugs, ''],
1649 'generateZshCompletion' : [generateZshCompletion, ''], 1699 'generateZshCompletion' : [generateZshCompletion, ''],
1650 'hsdis': [hsdis, '[att]'], 1700 'hsdis': [hsdis, '[att]'],
1651 'hcfdis': [hcfdis, ''], 1701 'hcfdis': [hcfdis, ''],
1652 'igv' : [igv, ''], 1702 'igv' : [igv, ''],
1653 'jdkhome': [print_jdkhome, ''], 1703 'jdkhome': [print_jdkhome, ''],