comparison mx/mx_graal.py @ 13472:72e2ec923b7b

added support to replace NetBeans platform used by IGV if it is out of date (GRAAL-420)
author Doug Simon <doug.simon@oracle.com>
date Sat, 21 Dec 2013 13:47:36 +0100
parents 020099961eb4
children 441b54753cda
comparison
equal deleted inserted replaced
13471:020099961eb4 13472:72e2ec923b7b
28 28
29 import os, sys, shutil, zipfile, tempfile, re, time, datetime, platform, subprocess, multiprocessing 29 import os, sys, shutil, zipfile, tempfile, re, time, datetime, platform, subprocess, multiprocessing
30 from os.path import join, exists, dirname, basename, getmtime 30 from os.path import join, exists, dirname, basename, getmtime
31 from argparse import ArgumentParser, REMAINDER 31 from argparse import ArgumentParser, REMAINDER
32 import mx 32 import mx
33 import xml.dom.minidom
33 import sanitycheck 34 import sanitycheck
34 import itertools 35 import itertools
35 import json, textwrap 36 import json, textwrap
36 37
37 # This works because when mx loads this file, it makes sure __file__ gets an absolute path 38 # This works because when mx loads this file, it makes sure __file__ gets an absolute path
1134 mx.logv('[This initial execution may take a while as the NetBeans platform needs to be downloaded]') 1135 mx.logv('[This initial execution may take a while as the NetBeans platform needs to be downloaded]')
1135 mx.run(['ant', '-f', join(_graal_home, 'visualizer', 'build.xml'), '-l', fp.name, 'run']) 1136 mx.run(['ant', '-f', join(_graal_home, 'visualizer', 'build.xml'), '-l', fp.name, 'run'])
1136 1137
1137 def igv(args): 1138 def igv(args):
1138 """run the Ideal Graph Visualizer""" 1139 """run the Ideal Graph Visualizer"""
1139 env = os.environ.copy()
1140 if mx.java().version >= mx.VersionSpec('1.8'):
1141 jdk7 = mx.get_env('JAVA7_HOME', None)
1142 if jdk7:
1143 env['JAVA_HOME'] = jdk7
1144 else:
1145 mx.abort('IGV does not yet work with JDK 8. Use --java-home to specify a JDK 7 when launching the IGV')
1146 with open(join(_graal_home, '.ideal_graph_visualizer.log'), 'w') as fp: 1140 with open(join(_graal_home, '.ideal_graph_visualizer.log'), 'w') as fp:
1147 mx.logv('[Ideal Graph Visualizer log is in ' + fp.name + ']') 1141 mx.logv('[Ideal Graph Visualizer log is in ' + fp.name + ']')
1148 if not exists(join(_graal_home, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'nbplatform')): 1142 nbplatform = join(_graal_home, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'nbplatform')
1149 mx.logv('[This initial execution may take a while as the NetBeans platform needs to be downloaded]') 1143
1150 mx.run(['ant', '-f', join(_graal_home, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'build.xml'), '-l', fp.name, 'run'], env=env) 1144 # Remove NetBeans platform if it is earlier than the current supported version
1145 if exists(nbplatform):
1146 dom = xml.dom.minidom.parse(join(nbplatform, 'platform', 'update_tracking', 'org-netbeans-core.xml'))
1147 currentVersion = mx.VersionSpec(dom.getElementsByTagName('module_version')[0].getAttribute('specification_version'))
1148 supportedVersion = mx.VersionSpec('3.43.1')
1149 if currentVersion < supportedVersion:
1150 mx.log('Replacing NetBeans platform version ' + str(currentVersion) + ' with version ' + str(supportedVersion))
1151 shutil.rmtree(nbplatform)
1152 elif supportedVersion < currentVersion:
1153 mx.log('Supported NetBeans version in igv command should be updated to ' + str(currentVersion))
1154
1155 if not exists(nbplatform):
1156 mx.logv('[This execution may take a while as the NetBeans platform needs to be downloaded]')
1157 mx.run(['ant', '-f', join(_graal_home, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'build.xml'), '-l', fp.name, 'run'])
1151 1158
1152 def bench(args): 1159 def bench(args):
1153 """run benchmarks and parse their output for results 1160 """run benchmarks and parse their output for results
1154 1161
1155 Results are JSON formated : {group : {benchmark : score}}.""" 1162 Results are JSON formated : {group : {benchmark : score}}."""