comparison mx/mx_graal.py @ 21165:bdeaa5a7b83c

Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
author Gilles Duboscq <gilles.m.duboscq@oracle.com>
date Thu, 30 Apr 2015 18:49:00 +0200
parents 7f78f999512a
children f383ff4c9af8
comparison
equal deleted inserted replaced
21164:a394890fd474 21165:bdeaa5a7b83c
1712 global _jacoco 1712 global _jacoco
1713 _jacoco = 'off' 1713 _jacoco = 'off'
1714 1714
1715 with Task('CleanAndBuildIdealGraphVisualizer', tasks) as t: 1715 with Task('CleanAndBuildIdealGraphVisualizer', tasks) as t:
1716 if t and platform.processor() != 'sparc': 1716 if t and platform.processor() != 'sparc':
1717 env = _igvFallbackJDK(os.environ)
1718 buildxml = mx._cygpathU2W(join(_graal_home, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'build.xml')) 1717 buildxml = mx._cygpathU2W(join(_graal_home, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'build.xml'))
1719 mx.run(['ant', '-f', buildxml, '-q', 'clean', 'build'], env=env) 1718 mx.run(['ant', '-f', buildxml, '-q', 'clean', 'build'], env=_igvBuildEnv())
1720 1719
1721 # Prevent Graal modifications from breaking the standard builds 1720 # Prevent Graal modifications from breaking the standard builds
1722 if args.buildNonGraal: 1721 if args.buildNonGraal:
1723 with Task('BuildHotSpotVarieties', tasks) as t: 1722 with Task('BuildHotSpotVarieties', tasks) as t:
1724 if t: 1723 if t:
1755 args = parser.parse_args(args) 1754 args = parser.parse_args(args)
1756 1755
1757 global _jacoco 1756 global _jacoco
1758 if args.task_filter: 1757 if args.task_filter:
1759 Task.filters = args.task_filter.split(',') 1758 Task.filters = args.task_filter.split(',')
1759
1760 # Force
1761 if not mx._opts.strict_compliance:
1762 mx.log("[gate] foring strict compliance")
1763 mx._opts.strict_compliance = True
1760 1764
1761 tasks = [] 1765 tasks = []
1762 total = Task('Gate') 1766 total = Task('Gate')
1763 try: 1767 try:
1764 with Task('Pylint', tasks) as t: 1768 with Task('Pylint', tasks) as t:
1859 1863
1860 deoptalot(['15', '-Xmx48m']) 1864 deoptalot(['15', '-Xmx48m'])
1861 1865
1862 dacapo(['100', 'eclipse', '-esa']) 1866 dacapo(['100', 'eclipse', '-esa'])
1863 1867
1864 def _igvFallbackJDK(env): 1868 def _igvJdk():
1865 v8u20 = mx.VersionSpec("1.8.0_20") 1869 v8u20 = mx.VersionSpec("1.8.0_20")
1866 v8u40 = mx.VersionSpec("1.8.0_40") 1870 v8u40 = mx.VersionSpec("1.8.0_40")
1867 v8 = mx.VersionSpec("1.8") 1871 v8 = mx.VersionSpec("1.8")
1868 igvHomes = [h for h in mx._java_homes if h.version >= v8 and (h.version < v8u20 or h.version >= v8u40)] 1872 def _igvJdkVersionCheck(version):
1869 defaultJava = mx.java() 1873 return version >= v8 and (version < v8u20 or version >= v8u40)
1870 if defaultJava not in igvHomes: 1874 return mx.java_version(_igvJdkVersionCheck, versionDescription='>= 1.8 and < 1.8.0u20 or >= 1.8.0u40').jdk
1871 if not igvHomes: 1875
1872 mx.abort("No JDK available for building IGV. Must have JDK >= 1.8 and < 1.8.0u20 or >= 1.8.0u40 in JAVA_HOME or EXTRA_JAVA_HOMES") 1876 def _igvBuildEnv():
1873 env = dict(env) 1877 # When the http_proxy environment variable is set, convert it to the proxy settings that ant needs
1874 fallbackJDK = igvHomes[0] 1878 env = dict(os.environ)
1875 mx.logv("1.8.0_20 has a known javac bug (JDK-8043926), thus falling back to " + str(fallbackJDK.version)) 1879 proxy = os.environ.get('http_proxy')
1876 env['JAVA_HOME'] = str(fallbackJDK.jdk) 1880 if not (proxy is None) and len(proxy) > 0:
1881 if '://' in proxy:
1882 # Remove the http:// prefix (or any other protocol prefix)
1883 proxy = proxy.split('://', 1)[1]
1884 # Separate proxy server name and port number
1885 proxyName, proxyPort = proxy.split(':', 1)
1886 proxyEnv = '-DproxyHost="' + proxyName + '" -DproxyPort=' + proxyPort
1887 env['ANT_OPTS'] = proxyEnv
1888
1889 env['JAVA_HOME'] = _igvJdk()
1877 return env 1890 return env
1878 1891
1879 def igv(args): 1892 def igv(args):
1880 """run the Ideal Graph Visualizer""" 1893 """run the Ideal Graph Visualizer"""
1881 logFile = '.ideal_graph_visualizer.log' 1894 logFile = '.ideal_graph_visualizer.log'
1882 with open(join(_graal_home, logFile), 'w') as fp: 1895 with open(join(_graal_home, logFile), 'w') as fp:
1883 # When the http_proxy environment variable is set, convert it to the proxy settings that ant needs
1884 env = dict(os.environ)
1885 proxy = os.environ.get('http_proxy')
1886 if not (proxy is None) and len(proxy) > 0:
1887 if '://' in proxy:
1888 # Remove the http:// prefix (or any other protocol prefix)
1889 proxy = proxy.split('://', 1)[1]
1890 # Separate proxy server name and port number
1891 proxyName, proxyPort = proxy.split(':', 1)
1892 proxyEnv = '-DproxyHost="' + proxyName + '" -DproxyPort=' + proxyPort
1893 env['ANT_OPTS'] = proxyEnv
1894 env = _igvFallbackJDK(env)
1895
1896 mx.logv('[Ideal Graph Visualizer log is in ' + fp.name + ']') 1896 mx.logv('[Ideal Graph Visualizer log is in ' + fp.name + ']')
1897 nbplatform = join(_graal_home, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'nbplatform') 1897 nbplatform = join(_graal_home, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'nbplatform')
1898 1898
1899 # Remove NetBeans platform if it is earlier than the current supported version 1899 # Remove NetBeans platform if it is earlier than the current supported version
1900 if exists(nbplatform): 1900 if exists(nbplatform):
1912 elif supportedVersion < currentVersion: 1912 elif supportedVersion < currentVersion:
1913 mx.log('Supported NetBeans version in igv command should be updated to ' + str(currentVersion)) 1913 mx.log('Supported NetBeans version in igv command should be updated to ' + str(currentVersion))
1914 1914
1915 if not exists(nbplatform): 1915 if not exists(nbplatform):
1916 mx.logv('[This execution may take a while as the NetBeans platform needs to be downloaded]') 1916 mx.logv('[This execution may take a while as the NetBeans platform needs to be downloaded]')
1917
1918 env = _igvBuildEnv()
1917 # make the jar for Batik 1.7 available. 1919 # make the jar for Batik 1.7 available.
1918 env['IGV_BATIK_JAR'] = mx.library('BATIK').get_path(True) 1920 env['IGV_BATIK_JAR'] = mx.library('BATIK').get_path(True)
1919 if mx.run(['ant', '-f', mx._cygpathU2W(join(_graal_home, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'build.xml')), '-l', mx._cygpathU2W(fp.name), 'run'], env=env, nonZeroIsFatal=False): 1921 if mx.run(['ant', '-f', mx._cygpathU2W(join(_graal_home, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'build.xml')), '-l', mx._cygpathU2W(fp.name), 'run'], env=env, nonZeroIsFatal=False):
1920 mx.abort("IGV ant build & launch failed. Check '" + logFile + "'. You can also try to delete 'src/share/tools/IdealGraphVisualizer/nbplatform'.") 1922 mx.abort("IGV ant build & launch failed. Check '" + logFile + "'. You can also try to delete 'src/share/tools/IdealGraphVisualizer/nbplatform'.")
1921 1923