comparison mx/mx_graal.py @ 14116:be7ebdf41bea

mx: new command to start c1visualizer; support for IGV download when using a proxy server
author Christian Wimmer <christian.wimmer@oracle.com>
date Fri, 07 Mar 2014 11:44:26 -0800
parents d2c84a0bf37a
children dc41eab09fe8
comparison
equal deleted inserted replaced
14115:ed7893cae86f 14116:be7ebdf41bea
1161 dacapo(['100', 'eclipse', '-esa']) 1161 dacapo(['100', 'eclipse', '-esa'])
1162 1162
1163 def igv(args): 1163 def igv(args):
1164 """run the Ideal Graph Visualizer""" 1164 """run the Ideal Graph Visualizer"""
1165 with open(join(_graal_home, '.ideal_graph_visualizer.log'), 'w') as fp: 1165 with open(join(_graal_home, '.ideal_graph_visualizer.log'), 'w') as fp:
1166 # When the http_proxy environment variable is set, convert it to the proxy settings that ant needs
1167 env = os.environ
1168 proxy = os.environ.get('http_proxy')
1169 if not (proxy is None) and len(proxy) > 0:
1170 if proxy.contains('://'):
1171 # Remove the http:// prefix (or any other protocol prefix)
1172 proxy = proxy.split('://', 1)[1]
1173 # Separate proxy server name and port number
1174 proxyName, proxyPort = proxy.split(':', 1)
1175 proxyEnv = '-DproxyHost="' + proxyName + '" -DproxyPort=' + proxyPort
1176 env['ANT_OPTS'] = proxyEnv
1177
1166 mx.logv('[Ideal Graph Visualizer log is in ' + fp.name + ']') 1178 mx.logv('[Ideal Graph Visualizer log is in ' + fp.name + ']')
1167 nbplatform = join(_graal_home, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'nbplatform') 1179 nbplatform = join(_graal_home, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'nbplatform')
1168 1180
1169 # Remove NetBeans platform if it is earlier than the current supported version 1181 # Remove NetBeans platform if it is earlier than the current supported version
1170 if exists(nbplatform): 1182 if exists(nbplatform):
1177 elif supportedVersion < currentVersion: 1189 elif supportedVersion < currentVersion:
1178 mx.log('Supported NetBeans version in igv command should be updated to ' + str(currentVersion)) 1190 mx.log('Supported NetBeans version in igv command should be updated to ' + str(currentVersion))
1179 1191
1180 if not exists(nbplatform): 1192 if not exists(nbplatform):
1181 mx.logv('[This execution may take a while as the NetBeans platform needs to be downloaded]') 1193 mx.logv('[This execution may take a while as the NetBeans platform needs to be downloaded]')
1182 mx.run(['ant', '-f', join(_graal_home, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'build.xml'), '-l', fp.name, 'run']) 1194 mx.run(['ant', '-f', join(_graal_home, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'build.xml'), '-l', fp.name, 'run'], env=env)
1195
1196 def c1visualizer(args):
1197 """run the Cl Compiler Visualizer"""
1198 libpath = join(_graal_home, 'lib')
1199 if mx.get_os() == 'windows':
1200 executable = join(libpath, 'c1visualizer', 'bin', 'c1visualizer.exe')
1201 else:
1202 executable = join(libpath, 'c1visualizer', 'bin', 'c1visualizer')
1203
1204 archive = join(libpath, 'c1visualizer.zip')
1205 if not exists(executable):
1206 if not exists(archive):
1207 mx.download(archive, ['https://java.net/downloads/c1visualizer/c1visualizer.zip'])
1208 zf = zipfile.ZipFile(archive, 'r')
1209 zf.extractall(libpath)
1210
1211 if not exists(executable):
1212 mx.abort('C1Visualizer binary does not exist: ' + executable)
1213
1214 if mx.get_os() != 'windows':
1215 # Make sure that execution is allowed. The zip file does not always specfiy that correctly
1216 os.chmod(executable, 0777)
1217
1218 mx.run([executable])
1183 1219
1184 def bench(args): 1220 def bench(args):
1185 """run benchmarks and parse their output for results 1221 """run benchmarks and parse their output for results
1186 1222
1187 Results are JSON formated : {group : {benchmark : score}}.""" 1223 Results are JSON formated : {group : {benchmark : score}}."""
1598 def mx_init(suite): 1634 def mx_init(suite):
1599 commands = { 1635 commands = {
1600 'build': [build, ''], 1636 'build': [build, ''],
1601 'buildvars': [buildvars, ''], 1637 'buildvars': [buildvars, ''],
1602 'buildvms': [buildvms, '[-options]'], 1638 'buildvms': [buildvms, '[-options]'],
1639 'c1visualizer' : [c1visualizer, ''],
1603 'clean': [clean, ''], 1640 'clean': [clean, ''],
1604 'generateZshCompletion' : [generateZshCompletion, ''], 1641 'generateZshCompletion' : [generateZshCompletion, ''],
1605 'hsdis': [hsdis, '[att]'], 1642 'hsdis': [hsdis, '[att]'],
1606 'hcfdis': [hcfdis, ''], 1643 'hcfdis': [hcfdis, ''],
1607 'igv' : [igv, ''], 1644 'igv' : [igv, ''],