annotate mx/commands.py @ 4185:4af146831ed6

Added message showing the number of changesets being checked.
author Doug Simon <doug.simon@oracle.com>
date Tue, 03 Jan 2012 12:56:55 +0100
parents fa6b78681c54
children ac5c2bdfcca2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
1 #
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
2 # commands.py - the default commands available to gl.py
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
3 #
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
4 # ----------------------------------------------------------------------------------------------------
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
5 #
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
6 # Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
8 #
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
9 # This code is free software; you can redistribute it and/or modify it
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
10 # under the terms of the GNU General Public License version 2 only, as
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
11 # published by the Free Software Foundation.
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
12 #
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
13 # This code is distributed in the hope that it will be useful, but WITHOUT
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
14 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
15 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
16 # version 2 for more details (a copy is included in the LICENSE file that
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
17 # accompanied this code).
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
18 #
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
19 # You should have received a copy of the GNU General Public License version
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
20 # 2 along with this work; if not, write to the Free Software Foundation,
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
21 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
22 #
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
23 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
24 # or visit www.oracle.com if you need additional information or have any
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
25 # questions.
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
26 #
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
27 # ----------------------------------------------------------------------------------------------------
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
28
4177
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
29 import os, sys, shutil, StringIO, zipfile, tempfile, re, time, datetime, platform, subprocess
4157
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
30 from os.path import join, exists, dirname, isdir, isfile, isabs, basename
4156
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
31 from argparse import ArgumentParser, REMAINDER
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
32 import mx
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
33
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
34 _graal_home = dirname(dirname(__file__))
4156
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
35 _vmSourcesAvailable = exists(join(_graal_home, 'make')) and exists(join(_graal_home, 'src'))
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
36 _vmbuild = 'product'
4177
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
37 _winSDK = 'C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\'
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
38 _mksHome = 'C:\\cygwin\\bin'
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
39
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
40 def clean(args):
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
41 """cleans the GraalVM source tree"""
4147
55376d8953a6 Improved 'build' and 'clean' commands.
Doug Simon <doug.simon@oracle.com>
parents: 4146
diff changeset
42 mx.clean(args)
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
43 os.environ.update(ARCH_DATA_MODEL='64', LANG='C', HOTSPOT_BUILD_JOBS='16')
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
44 mx.run([mx.gmake_cmd(), 'clean'], cwd=join(_graal_home, 'make'))
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
45
4184
fa6b78681c54 Added copyright check to the gate.
Doug Simon <doug.simon@oracle.com>
parents: 4178
diff changeset
46 def copyrightcheck(args):
fa6b78681c54 Added copyright check to the gate.
Doug Simon <doug.simon@oracle.com>
parents: 4178
diff changeset
47 """run copyright check on the Mercurial controlled source files"""
fa6b78681c54 Added copyright check to the gate.
Doug Simon <doug.simon@oracle.com>
parents: 4178
diff changeset
48 mx.run_java(['-cp', mx.classpath('com.oracle.max.base', resolve=False), 'com.sun.max.tools.CheckCopyright', '-cfp=' + join(mx.project('com.oracle.max.base').dir, '.copyright.regex')] + args)
fa6b78681c54 Added copyright check to the gate.
Doug Simon <doug.simon@oracle.com>
parents: 4178
diff changeset
49
4156
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
50 def export(args):
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
51 """create a GraalVM zip file for distribution"""
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
52
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
53 parser = ArgumentParser(prog='mx export');
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
54 parser.add_argument('--omit-vm-build', action='store_false', dest='vmbuild', help='omit VM build step')
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
55 parser.add_argument('--omit-dist-init', action='store_false', dest='distInit', help='omit class files and IDE configurations from distribution')
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
56 parser.add_argument('zipfile', nargs=REMAINDER, metavar='zipfile')
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
57
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
58 args = parser.parse_args(args)
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
59
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
60 tmp = tempfile.mkdtemp(prefix='tmp', dir=_graal_home)
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
61 if args.vmbuild:
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
62 # Make sure the product VM binary is up to date
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
63 build(['product'])
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
64
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
65 mx.log('Copying Java sources and mx files...')
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
66 mx.run(('hg archive -I graal -I mx -I mxtool -I mx.sh ' + tmp).split())
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
67
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
68 # Copy the GraalVM JDK
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
69 mx.log('Copying GraalVM JDK...')
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
70 src = _jdk()
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
71 dst = join(tmp, basename(src))
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
72 shutil.copytree(src, dst)
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
73 zfName = join(_graal_home, 'graalvm-' + mx.get_os() + '.zip')
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
74 zf = zipfile.ZipFile(zfName, 'w')
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
75 for root, _, files in os.walk(tmp):
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
76 for f in files:
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
77 name = join(root, f)
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
78 arcname = name[len(tmp) + 1:]
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
79 zf.write(join(tmp, name), arcname)
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
80
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
81 # create class files and IDE configurations
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
82 if args.distInit:
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
83 mx.log('Creating class files...')
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
84 mx.run('mx build'.split(), cwd=tmp)
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
85 mx.log('Creating IDE configurations...')
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
86 mx.run('mx ideinit'.split(), cwd=tmp)
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
87
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
88 # clean up temp directory
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
89 mx.log('Cleaning up...')
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
90 shutil.rmtree(tmp)
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
91
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
92 mx.log('Created distribution in ' + zfName)
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
93
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
94 def example(args):
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
95 """run some or all Graal examples"""
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
96 examples = {
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
97 'safeadd': ['com.oracle.max.graal.examples.safeadd', 'com.oracle.max.graal.examples.safeadd.Main'],
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
98 'vectorlib': ['com.oracle.max.graal.examples.vectorlib', 'com.oracle.max.graal.examples.vectorlib.Main'],
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
99 }
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
100
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
101 def run_example(verbose, project, mainClass):
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
102 cp = mx.classpath(project)
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
103 sharedArgs = ['-Xcomp', '-XX:CompileOnly=Main', mainClass]
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
104
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
105 res = []
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
106 mx.log("=== Server VM ===")
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
107 printArg = '-XX:+PrintCompilation' if verbose else '-XX:-PrintCompilation'
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
108 res.append(vm(['-cp', cp, printArg] + sharedArgs, vm="-server"))
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
109 mx.log("=== Graal VM ===")
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
110 printArg = '-G:+PrintCompilation' if verbose else '-G:-PrintCompilation'
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
111 res.append(vm(['-cp', cp, printArg, '-G:-Extend', '-G:-Inline'] + sharedArgs))
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
112 mx.log("=== Graal VM with extensions ===")
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
113 res.append(vm(['-cp', cp, printArg, '-G:+Extend', '-G:-Inline'] + sharedArgs))
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
114
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
115 if len([x for x in res if x != 0]) != 0:
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
116 return 1
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
117 return 0
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
118
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
119 verbose = False
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
120 if '-v' in args:
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
121 verbose = True
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
122 args = [a for a in args if a != '-v']
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
123
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
124 if len(args) == 0:
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
125 args = examples.keys()
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
126 for a in args:
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
127 config = examples.get(a)
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
128 if config is None:
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
129 mx.log('unknown example: ' + a + ' {available examples = ' + str(examples.keys()) + '}')
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
130 else:
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
131 mx.log('--------- ' + a + ' ------------')
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
132 project, mainClass = config
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
133 run_example(verbose, project, mainClass)
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
134
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
135 def dacapo(args):
4157
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
136 """run one or all DaCapo benchmarks
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
137
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
138 DaCapo options are distinguised from VM options by a '@' prefix.
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
139 For example, '@--iterations @5' will pass '--iterations 5' to the
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
140 DaCapo harness."""
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
141
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
142 benchmarks = [
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
143 'avrora',
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
144 'batik',
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
145 'eclipse',
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
146 'fop',
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
147 'h2',
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
148 'jython',
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
149 'luindex',
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
150 'lusearch',
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
151 'pmd',
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
152 'sunflow',
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
153 'tomcat',
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
154 'tradebeans',
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
155 'tradesoap',
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
156 'xalan'
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
157 ]
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
158
4178
d1b26c17910a Add the Dacapo benchmarks to the "lib" folder instead of using the environment variable. Fixed an issue in the downloader.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4177
diff changeset
159 dacapo = mx.get_env('DACAPO_CP')
d1b26c17910a Add the Dacapo benchmarks to the "lib" folder instead of using the environment variable. Fixed an issue in the downloader.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4177
diff changeset
160 if dacapo is None:
d1b26c17910a Add the Dacapo benchmarks to the "lib" folder instead of using the environment variable. Fixed an issue in the downloader.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4177
diff changeset
161 dacapo = _graal_home + r'/lib/dacapo-9.12-bach.jar'
d1b26c17910a Add the Dacapo benchmarks to the "lib" folder instead of using the environment variable. Fixed an issue in the downloader.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4177
diff changeset
162
4157
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
163 if not isfile(dacapo) or not dacapo.endswith('.jar'):
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
164 mx.abort('Specified DaCapo jar file does not exist or is not a jar file: ' + dacapo)
4178
d1b26c17910a Add the Dacapo benchmarks to the "lib" folder instead of using the environment variable. Fixed an issue in the downloader.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4177
diff changeset
165
4157
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
166 vmOpts = ['-Xms1g', '-Xmx2g', '-cp', dacapo]
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
167
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
168 selected = []
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
169 while len(args) != 0 and args[0][0] not in ['-', '@']:
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
170 bm = args[0]
3722
7c5524a4e86e Unified the way a specific build of the VM is chosen for any mx command that runs the GraalVM.
Doug Simon <doug.simon@oracle.com>
parents: 3721
diff changeset
171 del args[0]
4157
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
172 if bm not in benchmarks:
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
173 mx.abort('unknown benchmark: ' + bm + '\nselect one of: ' + str(benchmarks))
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
174 selected.append(bm)
3722
7c5524a4e86e Unified the way a specific build of the VM is chosen for any mx command that runs the GraalVM.
Doug Simon <doug.simon@oracle.com>
parents: 3721
diff changeset
175
4157
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
176 if len(selected) != 0:
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
177 benchmarks = selected
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
178
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
179 # Extract DaCapo options
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
180 dacapoArgs = [(arg[1:]) for arg in args if arg.startswith('@')]
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
181
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
182 # The remainder are VM options
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
183 vmOpts += [arg for arg in args if not arg.startswith('@')]
4150
c78bace5086a start work on integrating old hooks into mx, work on sanity checks
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4148
diff changeset
184
4157
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
185 dacapoSuccess = re.compile(r"^===== DaCapo 9\.12 ([a-zA-Z0-9_]+) PASSED in ([0-9]+) msec =====$")
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
186 passed = []
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
187
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
188 for bm in benchmarks:
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
189 def errFilter(line):
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
190 if dacapoSuccess.match(line):
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
191 passed.append(bm)
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
192 sys.stderr.write(line)
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
193 vm(vmOpts + ['Harness'] + dacapoArgs + [bm], err=errFilter)
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
194
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
195 failed = list(set(benchmarks).difference(set(passed)))
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
196
4157
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
197 if len(failed) != 0:
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
198 mx.abort('Benchmark failures: ' + str(failed))
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
199
4155
394404b2d9bd Removed strict requirement for GRAAL environment variable. It only needs to be set now if the graal directory is not in the directory hierarchy of GraalVM JDK.
Doug Simon <doug.simon@oracle.com>
parents: 4153
diff changeset
200 def _jdk(build='product', create=False):
394404b2d9bd Removed strict requirement for GRAAL environment variable. It only needs to be set now if the graal directory is not in the directory hierarchy of GraalVM JDK.
Doug Simon <doug.simon@oracle.com>
parents: 4153
diff changeset
201 """
394404b2d9bd Removed strict requirement for GRAAL environment variable. It only needs to be set now if the graal directory is not in the directory hierarchy of GraalVM JDK.
Doug Simon <doug.simon@oracle.com>
parents: 4153
diff changeset
202 Get the JDK into which Graal is installed, creating it first if necessary.
394404b2d9bd Removed strict requirement for GRAAL environment variable. It only needs to be set now if the graal directory is not in the directory hierarchy of GraalVM JDK.
Doug Simon <doug.simon@oracle.com>
parents: 4153
diff changeset
203 """
394404b2d9bd Removed strict requirement for GRAAL environment variable. It only needs to be set now if the graal directory is not in the directory hierarchy of GraalVM JDK.
Doug Simon <doug.simon@oracle.com>
parents: 4153
diff changeset
204 jdk = join(_graal_home, 'jdk' + mx.java().version)
394404b2d9bd Removed strict requirement for GRAAL environment variable. It only needs to be set now if the graal directory is not in the directory hierarchy of GraalVM JDK.
Doug Simon <doug.simon@oracle.com>
parents: 4153
diff changeset
205 if not exists(jdk):
4148
bf5efc22fb3f Replace downloading of JDK 7 with copying of host JDK 7.
Doug Simon <doug.simon@oracle.com>
parents: 4147
diff changeset
206 srcJdk = mx.java().jdk
4155
394404b2d9bd Removed strict requirement for GRAAL environment variable. It only needs to be set now if the graal directory is not in the directory hierarchy of GraalVM JDK.
Doug Simon <doug.simon@oracle.com>
parents: 4153
diff changeset
207 mx.log('Creating ' + jdk + ' from ' + srcJdk)
394404b2d9bd Removed strict requirement for GRAAL environment variable. It only needs to be set now if the graal directory is not in the directory hierarchy of GraalVM JDK.
Doug Simon <doug.simon@oracle.com>
parents: 4153
diff changeset
208 os.mkdir(jdk)
4148
bf5efc22fb3f Replace downloading of JDK 7 with copying of host JDK 7.
Doug Simon <doug.simon@oracle.com>
parents: 4147
diff changeset
209 for d in ['bin', 'db', 'include', 'jre', 'lib', 'man']:
bf5efc22fb3f Replace downloading of JDK 7 with copying of host JDK 7.
Doug Simon <doug.simon@oracle.com>
parents: 4147
diff changeset
210 src = join(srcJdk, d)
4155
394404b2d9bd Removed strict requirement for GRAAL environment variable. It only needs to be set now if the graal directory is not in the directory hierarchy of GraalVM JDK.
Doug Simon <doug.simon@oracle.com>
parents: 4153
diff changeset
211 dst = join(jdk, d)
4148
bf5efc22fb3f Replace downloading of JDK 7 with copying of host JDK 7.
Doug Simon <doug.simon@oracle.com>
parents: 4147
diff changeset
212 if not exists(src):
4155
394404b2d9bd Removed strict requirement for GRAAL environment variable. It only needs to be set now if the graal directory is not in the directory hierarchy of GraalVM JDK.
Doug Simon <doug.simon@oracle.com>
parents: 4153
diff changeset
213 mx.abort('Host JDK directory is missing: ' + src)
4148
bf5efc22fb3f Replace downloading of JDK 7 with copying of host JDK 7.
Doug Simon <doug.simon@oracle.com>
parents: 4147
diff changeset
214 shutil.copytree(src, dst)
3721
71b1204a74b4 Automated creation of debug, fastdebug and optimized subdirectories of the JDK.
Doug Simon <doug.simon@oracle.com>
parents: 3718
diff changeset
215
4155
394404b2d9bd Removed strict requirement for GRAAL environment variable. It only needs to be set now if the graal directory is not in the directory hierarchy of GraalVM JDK.
Doug Simon <doug.simon@oracle.com>
parents: 4153
diff changeset
216 jvmCfg = join(jdk, 'jre', 'lib', 'amd64', 'jvm.cfg')
394404b2d9bd Removed strict requirement for GRAAL environment variable. It only needs to be set now if the graal directory is not in the directory hierarchy of GraalVM JDK.
Doug Simon <doug.simon@oracle.com>
parents: 4153
diff changeset
217 found = False
394404b2d9bd Removed strict requirement for GRAAL environment variable. It only needs to be set now if the graal directory is not in the directory hierarchy of GraalVM JDK.
Doug Simon <doug.simon@oracle.com>
parents: 4153
diff changeset
218 if not exists(jvmCfg):
394404b2d9bd Removed strict requirement for GRAAL environment variable. It only needs to be set now if the graal directory is not in the directory hierarchy of GraalVM JDK.
Doug Simon <doug.simon@oracle.com>
parents: 4153
diff changeset
219 mx.abort(jvmCfg + ' does not exist')
394404b2d9bd Removed strict requirement for GRAAL environment variable. It only needs to be set now if the graal directory is not in the directory hierarchy of GraalVM JDK.
Doug Simon <doug.simon@oracle.com>
parents: 4153
diff changeset
220
394404b2d9bd Removed strict requirement for GRAAL environment variable. It only needs to be set now if the graal directory is not in the directory hierarchy of GraalVM JDK.
Doug Simon <doug.simon@oracle.com>
parents: 4153
diff changeset
221 with open(jvmCfg) as f:
394404b2d9bd Removed strict requirement for GRAAL environment variable. It only needs to be set now if the graal directory is not in the directory hierarchy of GraalVM JDK.
Doug Simon <doug.simon@oracle.com>
parents: 4153
diff changeset
222 for line in f:
394404b2d9bd Removed strict requirement for GRAAL environment variable. It only needs to be set now if the graal directory is not in the directory hierarchy of GraalVM JDK.
Doug Simon <doug.simon@oracle.com>
parents: 4153
diff changeset
223 if '-graal KNOWN' in line:
394404b2d9bd Removed strict requirement for GRAAL environment variable. It only needs to be set now if the graal directory is not in the directory hierarchy of GraalVM JDK.
Doug Simon <doug.simon@oracle.com>
parents: 4153
diff changeset
224 found = True
394404b2d9bd Removed strict requirement for GRAAL environment variable. It only needs to be set now if the graal directory is not in the directory hierarchy of GraalVM JDK.
Doug Simon <doug.simon@oracle.com>
parents: 4153
diff changeset
225 break
394404b2d9bd Removed strict requirement for GRAAL environment variable. It only needs to be set now if the graal directory is not in the directory hierarchy of GraalVM JDK.
Doug Simon <doug.simon@oracle.com>
parents: 4153
diff changeset
226 if not found:
394404b2d9bd Removed strict requirement for GRAAL environment variable. It only needs to be set now if the graal directory is not in the directory hierarchy of GraalVM JDK.
Doug Simon <doug.simon@oracle.com>
parents: 4153
diff changeset
227 mx.log('Appending "-graal KNOWN" to ' + jvmCfg)
394404b2d9bd Removed strict requirement for GRAAL environment variable. It only needs to be set now if the graal directory is not in the directory hierarchy of GraalVM JDK.
Doug Simon <doug.simon@oracle.com>
parents: 4153
diff changeset
228 with open(jvmCfg, 'a') as f:
394404b2d9bd Removed strict requirement for GRAAL environment variable. It only needs to be set now if the graal directory is not in the directory hierarchy of GraalVM JDK.
Doug Simon <doug.simon@oracle.com>
parents: 4153
diff changeset
229 f.write('-graal KNOWN\n')
394404b2d9bd Removed strict requirement for GRAAL environment variable. It only needs to be set now if the graal directory is not in the directory hierarchy of GraalVM JDK.
Doug Simon <doug.simon@oracle.com>
parents: 4153
diff changeset
230
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
231 if build == 'product':
4155
394404b2d9bd Removed strict requirement for GRAAL environment variable. It only needs to be set now if the graal directory is not in the directory hierarchy of GraalVM JDK.
Doug Simon <doug.simon@oracle.com>
parents: 4153
diff changeset
232 return jdk
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
233 elif build in ['debug', 'fastdebug', 'optimized']:
4155
394404b2d9bd Removed strict requirement for GRAAL environment variable. It only needs to be set now if the graal directory is not in the directory hierarchy of GraalVM JDK.
Doug Simon <doug.simon@oracle.com>
parents: 4153
diff changeset
234 res = join(jdk, build)
3721
71b1204a74b4 Automated creation of debug, fastdebug and optimized subdirectories of the JDK.
Doug Simon <doug.simon@oracle.com>
parents: 3718
diff changeset
235 if not exists(res):
71b1204a74b4 Automated creation of debug, fastdebug and optimized subdirectories of the JDK.
Doug Simon <doug.simon@oracle.com>
parents: 3718
diff changeset
236 if not create:
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
237 mx.abort('The ' + build + ' VM has not been created - run \'mx clean; mx make ' + build + '\'')
4148
bf5efc22fb3f Replace downloading of JDK 7 with copying of host JDK 7.
Doug Simon <doug.simon@oracle.com>
parents: 4147
diff changeset
238 mx.log('Creating ' + res)
3721
71b1204a74b4 Automated creation of debug, fastdebug and optimized subdirectories of the JDK.
Doug Simon <doug.simon@oracle.com>
parents: 3718
diff changeset
239 os.mkdir(res)
4148
bf5efc22fb3f Replace downloading of JDK 7 with copying of host JDK 7.
Doug Simon <doug.simon@oracle.com>
parents: 4147
diff changeset
240 for d in ['bin', 'db', 'include', 'jre', 'lib', 'man']:
4155
394404b2d9bd Removed strict requirement for GRAAL environment variable. It only needs to be set now if the graal directory is not in the directory hierarchy of GraalVM JDK.
Doug Simon <doug.simon@oracle.com>
parents: 4153
diff changeset
241 shutil.copytree(join(jdk, d), join(res, d))
3721
71b1204a74b4 Automated creation of debug, fastdebug and optimized subdirectories of the JDK.
Doug Simon <doug.simon@oracle.com>
parents: 3718
diff changeset
242 return res
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
243 else:
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
244 mx.abort('Unknown build type: ' + build)
4177
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
245
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
246 # run a command in the windows SDK Debug Shell
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
247 def runInDebugShell(cmd, workingDir, logFile=None, findInOutput=None, respondTo={}):
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
248 newLine = os.linesep
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
249 STARTTOKEN = 'RUNINDEBUGSHELL_STARTSEQUENCE'
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
250 ENDTOKEN = 'RUNINDEBUGSHELL_ENDSEQUENCE'
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
251 p = subprocess.Popen('cmd.exe /E:ON /V:ON /K ""' + _winSDK + '/Bin/SetEnv.cmd" & echo ' + STARTTOKEN + '"', \
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
252 shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
253 output = p.stdout
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
254 input = p.stdin
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
255 if logFile:
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
256 log = open(logFile, 'w')
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
257 ret = False
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
258 while True:
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
259 line = output.readline().decode()
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
260 if logFile:
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
261 log.write(line)
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
262 line = line.strip()
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
263 mx.log(line)
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
264 if line == STARTTOKEN:
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
265 input.write('cd /D ' + workingDir + ' & ' + cmd + ' & echo ' + ENDTOKEN + newLine)
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
266 for regex in respondTo.keys():
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
267 match = regex.search(line)
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
268 if match:
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
269 input.write(respondTo[regex] + newLine)
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
270 if findInOutput:
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
271 match = findInOutput.search(line)
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
272 if match:
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
273 ret = True
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
274 if line == ENDTOKEN:
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
275 break
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
276 input.write('exit' + newLine)
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
277 if logFile:
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
278 log.close()
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
279 return ret
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
280
4145
9aee7df31417 Removed 'tests' command.
Doug Simon <doug.simon@oracle.com>
parents: 4144
diff changeset
281 def build(args):
9aee7df31417 Removed 'tests' command.
Doug Simon <doug.simon@oracle.com>
parents: 4144
diff changeset
282 """builds the GraalVM binary and compiles the Graal classes
3721
71b1204a74b4 Automated creation of debug, fastdebug and optimized subdirectories of the JDK.
Doug Simon <doug.simon@oracle.com>
parents: 3718
diff changeset
283
3722
7c5524a4e86e Unified the way a specific build of the VM is chosen for any mx command that runs the GraalVM.
Doug Simon <doug.simon@oracle.com>
parents: 3721
diff changeset
284 The optional argument specifies what type of VM to build."""
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
285
4146
4eb5b2469b6f Fixed 'build' command.
Doug Simon <doug.simon@oracle.com>
parents: 4145
diff changeset
286 build = 'product'
4147
55376d8953a6 Improved 'build' and 'clean' commands.
Doug Simon <doug.simon@oracle.com>
parents: 4146
diff changeset
287 if len(args) != 0 and not args[0].startswith('-'):
55376d8953a6 Improved 'build' and 'clean' commands.
Doug Simon <doug.simon@oracle.com>
parents: 4146
diff changeset
288 build = args.pop(0)
4146
4eb5b2469b6f Fixed 'build' command.
Doug Simon <doug.simon@oracle.com>
parents: 4145
diff changeset
289
4eb5b2469b6f Fixed 'build' command.
Doug Simon <doug.simon@oracle.com>
parents: 4145
diff changeset
290 # Call mx.build to compile the Java sources
4147
55376d8953a6 Improved 'build' and 'clean' commands.
Doug Simon <doug.simon@oracle.com>
parents: 4146
diff changeset
291 mx.build(args + ['--source', '1.7'])
4145
9aee7df31417 Removed 'tests' command.
Doug Simon <doug.simon@oracle.com>
parents: 4144
diff changeset
292
4156
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
293 if not _vmSourcesAvailable:
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
294 return
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
295
4155
394404b2d9bd Removed strict requirement for GRAAL environment variable. It only needs to be set now if the graal directory is not in the directory hierarchy of GraalVM JDK.
Doug Simon <doug.simon@oracle.com>
parents: 4153
diff changeset
296 jdk = _jdk(build, True)
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
297 if build == 'debug':
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
298 build = 'jvmg'
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
299
4155
394404b2d9bd Removed strict requirement for GRAAL environment variable. It only needs to be set now if the graal directory is not in the directory hierarchy of GraalVM JDK.
Doug Simon <doug.simon@oracle.com>
parents: 4153
diff changeset
300 graalVmDir = join(jdk, 'jre', 'lib', 'amd64', 'graal')
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
301 if not exists(graalVmDir):
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
302 mx.log('Creating Graal directory in JDK7: ' + graalVmDir)
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
303 os.makedirs(graalVmDir)
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
304
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
305 def filterXusage(line):
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
306 if not 'Xusage.txt' in line:
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
307 sys.stderr.write(line + os.linesep)
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
308
4177
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
309 if platform.system() == 'Windows':
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
310 compilelogfile = _graal_home + '/graalCompile.log'
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
311 runInDebugShell('msbuild ' + _graal_home + r'\build\vs-amd64\jvm.vcproj /p:Configuration=compiler1_product /target:clean', _graal_home)
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
312 winCompileCmd = r'set HotSpotMksHome=' + _mksHome + r'& set OUT_DIR=' + jdk + r'& set JAVA_HOME=' + jdk + r'& set path=%JAVA_HOME%\bin;%path%;%HotSpotMksHome%& cd /D "' +_graal_home + r'\make\windows"& call create.bat ' + _graal_home + ''
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
313 print(winCompileCmd)
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
314 winCompileSuccess = re.compile(r"^Writing \.vcxproj file:")
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
315 if not runInDebugShell(winCompileCmd, _graal_home, compilelogfile, winCompileSuccess):
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
316 mx.log('Error executing create command')
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
317 return
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
318 winBuildCmd = 'msbuild ' + _graal_home + r'\build\vs-amd64\jvm.vcxproj /p:Configuration=compiler1_product /p:Platform=x64'
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
319 winBuildSuccess = re.compile('Build succeeded.')
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
320 if not runInDebugShell(winBuildCmd, _graal_home, compilelogfile, winBuildSuccess):
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
321 mx.log('Error building project')
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
322 return
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
323 else:
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
324 os.environ.update(ARCH_DATA_MODEL='64', LANG='C', HOTSPOT_BUILD_JOBS='3', ALT_BOOTDIR=jdk, INSTALL='y')
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
325 mx.run([mx.gmake_cmd(), build + 'graal'], cwd=join(_graal_home, 'make'), err=filterXusage)
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
326
4159
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
327 def vm(args, vm='-graal', nonZeroIsFatal=True, out=None, err=None, cwd=None, timeout=None):
3722
7c5524a4e86e Unified the way a specific build of the VM is chosen for any mx command that runs the GraalVM.
Doug Simon <doug.simon@oracle.com>
parents: 3721
diff changeset
328 """run the GraalVM"""
7c5524a4e86e Unified the way a specific build of the VM is chosen for any mx command that runs the GraalVM.
Doug Simon <doug.simon@oracle.com>
parents: 3721
diff changeset
329
4156
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
330 build = _vmbuild if _vmSourcesAvailable else 'product'
4145
9aee7df31417 Removed 'tests' command.
Doug Simon <doug.simon@oracle.com>
parents: 4144
diff changeset
331 if mx.java().debug:
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
332 args = ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000'] + args
4155
394404b2d9bd Removed strict requirement for GRAAL environment variable. It only needs to be set now if the graal directory is not in the directory hierarchy of GraalVM JDK.
Doug Simon <doug.simon@oracle.com>
parents: 4153
diff changeset
333 exe = join(_jdk(build), 'bin', mx.exe_suffix('java'))
4159
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
334 return mx.run([exe, vm] + args, nonZeroIsFatal=nonZeroIsFatal, out=out, err=err, cwd=cwd, timeout=timeout)
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
335
4145
9aee7df31417 Removed 'tests' command.
Doug Simon <doug.simon@oracle.com>
parents: 4144
diff changeset
336 def ideinit(args):
4156
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
337 """(re)generate Eclipse project configurations"""
3732
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
338
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
339
3732
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
340 def println(out, obj):
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
341 out.write(str(obj) + '\n')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
342
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
343 for p in mx.projects():
3732
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
344 if p.native:
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
345 continue
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
346
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
347 if not exists(p.dir):
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
348 os.makedirs(p.dir)
3732
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
349
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
350 out = StringIO.StringIO()
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
351
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
352 println(out, '<?xml version="1.0" encoding="UTF-8"?>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
353 println(out, '<classpath>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
354 for src in p.srcDirs:
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
355 srcDir = join(p.dir, src)
3732
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
356 if not exists(srcDir):
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
357 os.mkdir(srcDir)
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
358 println(out, '\t<classpathentry kind="src" path="' + src + '"/>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
359
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
360 # Every Java program depends on the JRE
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
361 println(out, '\t<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
362
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
363 for dep in p.all_deps([], True):
3732
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
364 if dep == p:
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
365 continue;
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
366
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
367 if dep.isLibrary():
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
368 if hasattr(dep, 'eclipse.container'):
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
369 println(out, '\t<classpathentry exported="true" kind="con" path="' + getattr(dep, 'eclipse.container') + '"/>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
370 elif hasattr(dep, 'eclipse.project'):
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
371 println(out, '\t<classpathentry combineaccessrules="false" exported="true" kind="src" path="/' + getattr(dep, 'eclipse.project') + '"/>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
372 else:
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
373 path = dep.path
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
374 if dep.mustExist:
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
375 if isabs(path):
3732
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
376 println(out, '\t<classpathentry exported="true" kind="lib" path="' + path + '"/>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
377 else:
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
378 println(out, '\t<classpathentry exported="true" kind="lib" path="/' + path + '"/>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
379 else:
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
380 println(out, '\t<classpathentry combineaccessrules="false" exported="true" kind="src" path="/' + dep.name + '"/>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
381
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
382 println(out, '\t<classpathentry kind="output" path="' + getattr(p, 'eclipse.output', 'bin') + '"/>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
383 println(out, '</classpath>')
4156
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
384 mx.update_file(join(p.dir, '.classpath'), out.getvalue())
3732
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
385 out.close()
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
386
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
387 csConfig = join(mx.project(p.checkstyleProj).dir, '.checkstyle_checks.xml')
3732
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
388 if exists(csConfig):
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
389 out = StringIO.StringIO()
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
390
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
391 dotCheckstyle = join(p.dir, ".checkstyle")
3732
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
392 checkstyleConfigPath = '/' + p.checkstyleProj + '/.checkstyle_checks.xml'
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
393 println(out, '<?xml version="1.0" encoding="UTF-8"?>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
394 println(out, '<fileset-config file-format-version="1.2.0" simple-config="true">')
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
395 println(out, '\t<local-check-config name="Graal Checks" location="' + checkstyleConfigPath + '" type="project" description="">')
3732
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
396 println(out, '\t\t<additional-data name="protect-config-file" value="false"/>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
397 println(out, '\t</local-check-config>')
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
398 println(out, '\t<fileset name="all" enabled="true" check-config-name="Graal Checks" local="true">')
3732
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
399 println(out, '\t\t<file-match-pattern match-pattern="." include-pattern="true"/>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
400 println(out, '\t</fileset>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
401 println(out, '\t<filter name="FileTypesFilter" enabled="true">')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
402 println(out, '\t\t<filter-data value="java"/>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
403 println(out, '\t</filter>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
404
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
405 exclude = join(p.dir, '.checkstyle.exclude')
3732
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
406 if exists(exclude):
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
407 println(out, '\t<filter name="FilesFromPackage" enabled="true">')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
408 with open(exclude) as f:
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
409 for line in f:
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
410 if not line.startswith('#'):
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
411 line = line.strip()
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
412 exclDir = join(p.dir, line)
3732
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
413 assert isdir(exclDir), 'excluded source directory listed in ' + exclude + ' does not exist or is not a directory: ' + exclDir
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
414 println(out, '\t\t<filter-data value="' + line + '"/>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
415 println(out, '\t</filter>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
416
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
417 println(out, '</fileset-config>')
4156
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
418 mx.update_file(dotCheckstyle, out.getvalue())
3732
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
419 out.close()
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
420
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
421
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
422 out = StringIO.StringIO()
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
423
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
424 println(out, '<?xml version="1.0" encoding="UTF-8"?>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
425 println(out, '<projectDescription>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
426 println(out, '\t<name>' + p.name + '</name>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
427 println(out, '\t<comment></comment>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
428 println(out, '\t<projects>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
429 println(out, '\t</projects>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
430 println(out, '\t<buildSpec>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
431 println(out, '\t\t<buildCommand>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
432 println(out, '\t\t\t<name>org.eclipse.jdt.core.javabuilder</name>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
433 println(out, '\t\t\t<arguments>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
434 println(out, '\t\t\t</arguments>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
435 println(out, '\t\t</buildCommand>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
436 if exists(csConfig):
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
437 println(out, '\t\t<buildCommand>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
438 println(out, '\t\t\t<name>net.sf.eclipsecs.core.CheckstyleBuilder</name>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
439 println(out, '\t\t\t<arguments>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
440 println(out, '\t\t\t</arguments>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
441 println(out, '\t\t</buildCommand>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
442 println(out, '\t</buildSpec>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
443 println(out, '\t<natures>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
444 println(out, '\t\t<nature>org.eclipse.jdt.core.javanature</nature>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
445 if exists(csConfig):
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
446 println(out, '\t\t<nature>net.sf.eclipsecs.core.CheckstyleNature</nature>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
447 println(out, '\t</natures>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
448 println(out, '</projectDescription>')
4156
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
449 mx.update_file(join(p.dir, '.project'), out.getvalue())
3732
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
450 out.close()
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
451
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
452 out = StringIO.StringIO()
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
453 settingsDir = join(p.dir, ".settings")
3732
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
454 if not exists(settingsDir):
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
455 os.mkdir(settingsDir)
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
456
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
457 myDir = dirname(__file__)
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
458
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
459 with open(join(myDir, 'org.eclipse.jdt.core.prefs')) as f:
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
460 content = f.read()
4156
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
461 mx.update_file(join(settingsDir, 'org.eclipse.jdt.core.prefs'), content)
3732
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
462
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
463 with open(join(myDir, 'org.eclipse.jdt.ui.prefs')) as f:
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
464 content = f.read()
4156
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
465 mx.update_file(join(settingsDir, 'org.eclipse.jdt.ui.prefs'), content)
3732
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
466
4159
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
467 # Table of unit tests.
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
468 # Keys are project names, values are package name lists.
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
469 # All source files in the given (project,package) pairs are scanned for lines
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
470 # containing '@Test'. These are then detemrined to be the classes defining
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
471 # unit tests.
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
472 _unittests = {
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
473 'com.oracle.max.graal.tests': ['com.oracle.max.graal.compiler.tests'],
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
474 }
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
475
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
476 def _add_test_classes(testClassList, searchDir, pkgRoot):
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
477 pkgDecl = re.compile(r"^package\s+([a-zA-Z_][\w\.]*)\s*;$")
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
478 for root, _, files in os.walk(searchDir):
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
479 for name in files:
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
480 if name.endswith('.java') and name != 'package-info.java':
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
481 hasTest = False
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
482 with open(join(root, name)) as f:
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
483 pkg = None
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
484 for line in f:
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
485 if line.startswith("package "):
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
486 match = pkgDecl.match(line)
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
487 if match:
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
488 pkg = match.group(1)
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
489 else:
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
490 if line.strip().startswith('@Test'):
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
491 hasTest = True
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
492 break
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
493 if hasTest:
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
494 assert pkg is not None
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
495 testClassList.append(pkg + '.' + name[:-len('.java')])
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
496
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
497 def unittest(args):
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
498 """run the Graal Compiler Unit Tests in the GraalVM
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
499
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
500 If filters are supplied, only tests whose fully qualified name
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
501 include a filter as a substring are run. Negative filters are
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
502 those with a '-' prefix."""
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
503
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
504 pos = [a for a in args if a[0] != '-']
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
505 neg = [a[1:] for a in args if a[0] == '-']
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
506
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
507 def containsAny(c, substrings):
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
508 for s in substrings:
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
509 if s in c:
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
510 return True
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
511 return False
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
512
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
513 for proj in _unittests.iterkeys():
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
514 p = mx.project(proj)
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
515 classes = []
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
516 for pkg in _unittests[proj]:
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
517 _add_test_classes(classes, join(p.dir, 'src'), pkg)
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
518
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
519 if len(pos) != 0:
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
520 classes = [c for c in classes if containsAny(c, pos)]
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
521 if len(neg) != 0:
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
522 classes = [c for c in classes if not containsAny(c, neg)]
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
523
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
524 # (ds) The boot class path must be used for some reason I don't quite understand
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
525 vm(['-XX:-BootstrapGraal', '-esa', '-Xbootclasspath/a:' + mx.classpath(proj), 'org.junit.runner.JUnitCore'] + classes)
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
526
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
527 def gate(args):
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
528 """run the tests used to validate a push
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
529
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
530 If this commands exits with a 0 exit code, then the source code is in
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
531 a state that would be accepted for integration into the main repository."""
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
532
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
533 start = time.time()
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
534
4160
338d46581e03 Added clean step to gate.
Doug Simon <doug.simon@oracle.com>
parents: 4159
diff changeset
535 # 1. Clean
4163
48f89a17f86a Trivial change to test gate.
Doug Simon <doug.simon@oracle.com>
parents: 4162
diff changeset
536 # clean([])
4160
338d46581e03 Added clean step to gate.
Doug Simon <doug.simon@oracle.com>
parents: 4159
diff changeset
537
338d46581e03 Added clean step to gate.
Doug Simon <doug.simon@oracle.com>
parents: 4159
diff changeset
538 # 2. Checkstyle
4159
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
539 mx.log(time.strftime('%d %b %Y %H:%M:%S - Running Checkstyle...'))
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
540 if mx.checkstyle([]) != 0:
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
541 mx.abort('Checkstyle warnings were found')
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
542
4160
338d46581e03 Added clean step to gate.
Doug Simon <doug.simon@oracle.com>
parents: 4159
diff changeset
543 # 3. Canonical mx/projects
4159
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
544 mx.log(time.strftime('%d %b %Y %H:%M:%S - Ensuring mx/projects files are canonicalized...'))
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
545 if mx.canonicalizeprojects([]) != 0:
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
546 mx.abort('Rerun "mx canonicalizeprojects" and check-in the modified mx/projects files.')
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
547
4160
338d46581e03 Added clean step to gate.
Doug Simon <doug.simon@oracle.com>
parents: 4159
diff changeset
548 # 4. Build
4159
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
549 mx.log(time.strftime('%d %b %Y %H:%M:%S - Build...'))
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
550 build([])
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
551
4184
fa6b78681c54 Added copyright check to the gate.
Doug Simon <doug.simon@oracle.com>
parents: 4178
diff changeset
552 # 5 Copyright check
fa6b78681c54 Added copyright check to the gate.
Doug Simon <doug.simon@oracle.com>
parents: 4178
diff changeset
553 mx.log(time.strftime('%d %b %Y %H:%M:%S - Running copyright check...'))
fa6b78681c54 Added copyright check to the gate.
Doug Simon <doug.simon@oracle.com>
parents: 4178
diff changeset
554 hgNode = mx.get_env('hg_node')
fa6b78681c54 Added copyright check to the gate.
Doug Simon <doug.simon@oracle.com>
parents: 4178
diff changeset
555 if hgNode is None:
fa6b78681c54 Added copyright check to the gate.
Doug Simon <doug.simon@oracle.com>
parents: 4178
diff changeset
556 copyrightcheck(['-modified', '-reporterrors=true', '-continueonerror'])
fa6b78681c54 Added copyright check to the gate.
Doug Simon <doug.simon@oracle.com>
parents: 4178
diff changeset
557 else:
fa6b78681c54 Added copyright check to the gate.
Doug Simon <doug.simon@oracle.com>
parents: 4178
diff changeset
558 revTip = int(subprocess.check_output(['hg', 'tip', '--template', "'{rev}'"]).strip("'"))
fa6b78681c54 Added copyright check to the gate.
Doug Simon <doug.simon@oracle.com>
parents: 4178
diff changeset
559 revLast = int(subprocess.check_output(['hg', 'log', '-r', hgNode, '--template', "'{rev}'"]).strip("'"))
fa6b78681c54 Added copyright check to the gate.
Doug Simon <doug.simon@oracle.com>
parents: 4178
diff changeset
560 changesetCount = revTip - revLast + 1
4185
4af146831ed6 Added message showing the number of changesets being checked.
Doug Simon <doug.simon@oracle.com>
parents: 4184
diff changeset
561 mx.log(time.strftime('Checking ' + str(changesetCount) + ' changesets...'))
4184
fa6b78681c54 Added copyright check to the gate.
Doug Simon <doug.simon@oracle.com>
parents: 4178
diff changeset
562 copyrightcheck(['-last=' + str(changesetCount), '-reporterrors=true', '-continueonerror'])
4185
4af146831ed6 Added message showing the number of changesets being checked.
Doug Simon <doug.simon@oracle.com>
parents: 4184
diff changeset
563 raise SystemExit('forced exit')
4184
fa6b78681c54 Added copyright check to the gate.
Doug Simon <doug.simon@oracle.com>
parents: 4178
diff changeset
564
fa6b78681c54 Added copyright check to the gate.
Doug Simon <doug.simon@oracle.com>
parents: 4178
diff changeset
565 # 6. Bootstrap with system assertions enabled
4159
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
566 mx.log(time.strftime('%d %b %Y %H:%M:%S - Bootstrap with -esa...'))
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
567 vm(['-esa', '-version'])
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
568
4184
fa6b78681c54 Added copyright check to the gate.
Doug Simon <doug.simon@oracle.com>
parents: 4178
diff changeset
569 # 7. Run unittests
4159
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
570 mx.log(time.strftime('%d %b %Y %H:%M:%S - Running unit tests...'))
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
571 unittest([])
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
572
4184
fa6b78681c54 Added copyright check to the gate.
Doug Simon <doug.simon@oracle.com>
parents: 4178
diff changeset
573 # 8. Run selected DaCapo benchmarks
4159
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
574 mx.log(time.strftime('%d %b %Y %H:%M:%S - Running DaCapo benchmarks...'))
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
575 dacapo(['eclipse'])
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
576 #dacapo(['tradesoap'])
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
577 dacapo(['batik'])
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
578 dacapo(['avrora'])
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
579 dacapo(['fop'])
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
580
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
581 duration = datetime.timedelta(seconds=time.time() - start)
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
582 mx.log(time.strftime('%d %b %Y %H:%M:%S - Gate done (duration - ' + str(duration) + ')'))
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
583
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
584 def mx_init():
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
585 _vmbuild = 'product'
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
586 commands = {
4159
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
587 'build': [build, ''],
4156
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
588 'clean': [clean, ''],
4184
fa6b78681c54 Added copyright check to the gate.
Doug Simon <doug.simon@oracle.com>
parents: 4178
diff changeset
589 'copyrightcheck': [copyrightcheck, ''],
4157
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
590 'dacapo': [dacapo, '[benchmark] [VM options|DaCapo options]'],
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
591 'example': [example, '[-v] example names...'],
4159
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
592 'gate' : [gate, ''],
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
593 'unittest' : [unittest, '[filters...]'],
3722
7c5524a4e86e Unified the way a specific build of the VM is chosen for any mx command that runs the GraalVM.
Doug Simon <doug.simon@oracle.com>
parents: 3721
diff changeset
594 'vm': [vm, '[-options] class [args...]'],
4156
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
595 'ideinit': [ideinit, '']
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
596 }
4156
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
597
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
598 if (_vmSourcesAvailable):
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
599 mx.add_argument('--product', action='store_const', dest='vmbuild', const='product', help='select the product VM')
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
600 mx.add_argument('--debug', action='store_const', dest='vmbuild', const='debug', help='select the debug VM')
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
601 mx.add_argument('--fastdebug', action='store_const', dest='vmbuild', const='fastdebug', help='select the fast debug VM')
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
602 mx.add_argument('--optimized', action='store_const', dest='vmbuild', const='optimized', help='select the optimized VM')
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
603
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
604 commands.update({
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
605 'export': [export, '[-options] [zipfile]'],
4157
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
606 'build': [build, '[product|debug|fastdebug|optimized]']
4156
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
607 })
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
608
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
609 mx.commands.update(commands)
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
610
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
611 def mx_post_parse_cmd_line(opts):
4148
bf5efc22fb3f Replace downloading of JDK 7 with copying of host JDK 7.
Doug Simon <doug.simon@oracle.com>
parents: 4147
diff changeset
612 version = mx.java().version
bf5efc22fb3f Replace downloading of JDK 7 with copying of host JDK 7.
Doug Simon <doug.simon@oracle.com>
parents: 4147
diff changeset
613 parts = version.split('.')
bf5efc22fb3f Replace downloading of JDK 7 with copying of host JDK 7.
Doug Simon <doug.simon@oracle.com>
parents: 4147
diff changeset
614 assert len(parts) >= 2
bf5efc22fb3f Replace downloading of JDK 7 with copying of host JDK 7.
Doug Simon <doug.simon@oracle.com>
parents: 4147
diff changeset
615 assert parts[0] == '1'
bf5efc22fb3f Replace downloading of JDK 7 with copying of host JDK 7.
Doug Simon <doug.simon@oracle.com>
parents: 4147
diff changeset
616 major = int(parts[1])
bf5efc22fb3f Replace downloading of JDK 7 with copying of host JDK 7.
Doug Simon <doug.simon@oracle.com>
parents: 4147
diff changeset
617 if not major >= 7:
bf5efc22fb3f Replace downloading of JDK 7 with copying of host JDK 7.
Doug Simon <doug.simon@oracle.com>
parents: 4147
diff changeset
618 mx.abort('Requires Java version 1.7 or greater, got version ' + version)
bf5efc22fb3f Replace downloading of JDK 7 with copying of host JDK 7.
Doug Simon <doug.simon@oracle.com>
parents: 4147
diff changeset
619
4156
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
620 if (_vmSourcesAvailable):
4178
d1b26c17910a Add the Dacapo benchmarks to the "lib" folder instead of using the environment variable. Fixed an issue in the downloader.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4177
diff changeset
621 if hasattr(opts, 'vmbuild'):
d1b26c17910a Add the Dacapo benchmarks to the "lib" folder instead of using the environment variable. Fixed an issue in the downloader.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4177
diff changeset
622 global _vmbuild
4156
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
623 _vmbuild = opts.vmbuild