comparison mx.graal/mx_graal.py @ 22018:11ed27b2abe8

remove hard-coded use of 'mx' to refer to the mxDir for the graal suite
author Doug Simon <doug.simon@oracle.com>
date Wed, 17 Jun 2015 15:28:45 +0200
parents 66dd063eb6a0
children 07cfd3d7072b
comparison
equal deleted inserted replaced
22017:66dd063eb6a0 22018:11ed27b2abe8
36 import itertools 36 import itertools
37 import json, textwrap 37 import json, textwrap
38 import fnmatch 38 import fnmatch
39 import mx_graal_makefile 39 import mx_graal_makefile
40 40
41 # This works because when mx loads this file, it makes sure __file__ gets an absolute path 41 _suite = mx.suite('graal')
42 _graal_home = dirname(dirname(__file__)) 42 _graal_home = _suite.dir
43 43
44 """ Used to distinguish an exported GraalVM (see 'mx export'). """ 44 """ Used to distinguish an exported GraalVM (see 'mx export'). """
45 _vmSourcesAvailable = exists(join(_graal_home, 'make')) and exists(join(_graal_home, 'src')) 45 _vmSourcesAvailable = exists(join(_graal_home, 'make')) and exists(join(_graal_home, 'src'))
46 46
47 """ The VMs that can be built and run along with an optional description. Only VMs with a 47 """ The VMs that can be built and run along with an optional description. Only VMs with a
121 """ 121 """
122 global _vm 122 global _vm
123 if _vm: 123 if _vm:
124 return _vm 124 return _vm
125 vm = mx.get_env('DEFAULT_VM') 125 vm = mx.get_env('DEFAULT_VM')
126 envPath = join(_graal_home, 'mx', 'env') 126 envPath = join(_suite.mxDir, 'env')
127 if vm and 'graal' in vm: 127 if vm and 'graal' in vm:
128 if exists(envPath): 128 if exists(envPath):
129 with open(envPath) as fp: 129 with open(envPath) as fp:
130 if 'DEFAULT_VM=' + vm in fp.read(): 130 if 'DEFAULT_VM=' + vm in fp.read():
131 mx.log('Please update the DEFAULT_VM value in ' + envPath + ' to replace "graal" with "jvmci"') 131 mx.log('Please update the DEFAULT_VM value in ' + envPath + ' to replace "graal" with "jvmci"')
760 for n in sorted(buildVars.iterkeys()): 760 for n in sorted(buildVars.iterkeys()):
761 mx.log(n) 761 mx.log(n)
762 mx.log(textwrap.fill(buildVars[n], initial_indent=' ', subsequent_indent=' ', width=200)) 762 mx.log(textwrap.fill(buildVars[n], initial_indent=' ', subsequent_indent=' ', width=200))
763 763
764 mx.log('') 764 mx.log('')
765 mx.log('Note that these variables can be given persistent values in the file ' + join(_graal_home, 'mx', 'env') + ' (see \'mx about\').') 765 mx.log('Note that these variables can be given persistent values in the file ' + join(_suite.mxDir, 'env') + ' (see \'mx about\').')
766 766
767 cached_graal_version = None 767 cached_graal_version = None
768 768
769 def graal_version(dev_suffix='dev'): 769 def graal_version(dev_suffix='dev'):
770 global cached_graal_version 770 global cached_graal_version
1062 build = vmbuild if vmbuild else _vmbuild if _vmSourcesAvailable else 'product' 1062 build = vmbuild if vmbuild else _vmbuild if _vmSourcesAvailable else 'product'
1063 jdk = _jdk(build, vmToCheck=vm, installJars=False) 1063 jdk = _jdk(build, vmToCheck=vm, installJars=False)
1064 _updateInstalledJVMCIOptionsFile(jdk) 1064 _updateInstalledJVMCIOptionsFile(jdk)
1065 mx.expand_project_in_args(args) 1065 mx.expand_project_in_args(args)
1066 if _make_eclipse_launch: 1066 if _make_eclipse_launch:
1067 mx.make_eclipse_launch(args, 'graal-' + build, name=None, deps=mx.project('com.oracle.graal.hotspot').all_deps([], True)) 1067 mx.make_eclipse_launch(_suite, args, 'graal-' + build, name=None, deps=mx.project('com.oracle.graal.hotspot').all_deps([], True))
1068 if _jacoco == 'on' or _jacoco == 'append': 1068 if _jacoco == 'on' or _jacoco == 'append':
1069 jacocoagent = mx.library("JACOCOAGENT", True) 1069 jacocoagent = mx.library("JACOCOAGENT", True)
1070 # Exclude all compiler tests and snippets 1070 # Exclude all compiler tests and snippets
1071 1071
1072 includes = ['com.oracle.graal.*', 'com.oracle.jvmci.*'] 1072 includes = ['com.oracle.graal.*', 'com.oracle.jvmci.*']
2064 mx.log('JMH benchmarks: ' + jmhPath) 2064 mx.log('JMH benchmarks: ' + jmhPath)
2065 2065
2066 # Ensure the mx injected dependencies are up to date 2066 # Ensure the mx injected dependencies are up to date
2067 makejmhdeps(['-p'] + (['-s', args.settings] if args.settings else [])) 2067 makejmhdeps(['-p'] + (['-s', args.settings] if args.settings else []))
2068 2068
2069 timestamp = mx.TimeStampFile(join(_graal_home, 'mx', 'jmh', jmhPath.replace(os.sep, '_') + '.timestamp')) 2069 timestamp = mx.TimeStampFile(join(_suite.mxDir, 'jmh', jmhPath.replace(os.sep, '_') + '.timestamp'))
2070 mustBuild = args.clean 2070 mustBuild = args.clean
2071 if not mustBuild: 2071 if not mustBuild:
2072 try: 2072 try:
2073 hgfiles = [join(jmhPath, f) for f in subprocess.check_output(['hg', '-R', jmhPath, 'locate']).split('\n')] 2073 hgfiles = [join(jmhPath, f) for f in subprocess.check_output(['hg', '-R', jmhPath, 'locate']).split('\n')]
2074 mustBuild = timestamp.isOlderThan(hgfiles) 2074 mustBuild = timestamp.isOlderThan(hgfiles)
2114 if isJVMCIEnabled(_get_vm()) and '-XX:-UseJVMCIClassLoader' not in vmArgs: 2114 if isJVMCIEnabled(_get_vm()) and '-XX:-UseJVMCIClassLoader' not in vmArgs:
2115 vmArgs = ['-XX:-UseJVMCIClassLoader'] + vmArgs 2115 vmArgs = ['-XX:-UseJVMCIClassLoader'] + vmArgs
2116 2116
2117 benchmarks = [b for b in benchmarksAndJsons if not b.startswith('{')] 2117 benchmarks = [b for b in benchmarksAndJsons if not b.startswith('{')]
2118 jmhArgJsons = [b for b in benchmarksAndJsons if b.startswith('{')] 2118 jmhArgJsons = [b for b in benchmarksAndJsons if b.startswith('{')]
2119 jmhOutDir = join(_graal_home, 'mx', 'jmh') 2119 jmhOutDir = join(_suite.mxDir, 'jmh')
2120 if not exists(jmhOutDir): 2120 if not exists(jmhOutDir):
2121 os.makedirs(jmhOutDir) 2121 os.makedirs(jmhOutDir)
2122 jmhOut = join(jmhOutDir, 'jmh.out') 2122 jmhOut = join(jmhOutDir, 'jmh.out')
2123 jmhArgs = {'-rff' : jmhOut, '-v' : 'EXTRA' if mx._opts.verbose else 'NORMAL'} 2123 jmhArgs = {'-rff' : jmhOut, '-v' : 'EXTRA' if mx._opts.verbose else 'NORMAL'}
2124 2124