Mercurial > hg > truffle
annotate mx/commands.py @ 4163:48f89a17f86a
Trivial change to test gate.
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Fri, 23 Dec 2011 11:26:04 +0100 |
parents | 784f7e262d60 |
children | c843578c269d |
rev | line source |
---|---|
3718 | 1 # |
2 # commands.py - the default commands available to gl.py | |
3 # | |
4 # ---------------------------------------------------------------------------------------------------- | |
5 # | |
6 # Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. | |
7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
8 # | |
9 # This code is free software; you can redistribute it and/or modify it | |
10 # under the terms of the GNU General Public License version 2 only, as | |
11 # published by the Free Software Foundation. | |
12 # | |
13 # This code is distributed in the hope that it will be useful, but WITHOUT | |
14 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 # version 2 for more details (a copy is included in the LICENSE file that | |
17 # accompanied this code). | |
18 # | |
19 # You should have received a copy of the GNU General Public License version | |
20 # 2 along with this work; if not, write to the Free Software Foundation, | |
21 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
22 # | |
23 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
24 # or visit www.oracle.com if you need additional information or have any | |
25 # questions. | |
26 # | |
27 # ---------------------------------------------------------------------------------------------------- | |
28 | |
4159
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
29 import os, sys, shutil, StringIO, zipfile, tempfile, re, time, datetime |
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 | 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' |
3718 | 37 |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
38 def clean(args): |
3718 | 39 """cleans the GraalVM source tree""" |
4147
55376d8953a6
Improved 'build' and 'clean' commands.
Doug Simon <doug.simon@oracle.com>
parents:
4146
diff
changeset
|
40 mx.clean(args) |
3718 | 41 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
|
42 mx.run([mx.gmake_cmd(), 'clean'], cwd=join(_graal_home, 'make')) |
3718 | 43 |
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
|
44 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
|
45 """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
|
46 |
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
|
47 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
|
48 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
|
49 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
|
50 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
|
51 |
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 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
|
53 |
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 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
|
55 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
|
56 # 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
|
57 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
|
58 |
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 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
|
60 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
|
61 |
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 # 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
|
63 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
|
64 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
|
65 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
|
66 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
|
67 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
|
68 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
|
69 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
|
70 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
|
71 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
|
72 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
|
73 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
|
74 |
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 # 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
|
76 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
|
77 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
|
78 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
|
79 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
|
80 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
|
81 |
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 # 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
|
83 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
|
84 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
|
85 |
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.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
|
87 |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
88 def example(args): |
3718 | 89 """run some or all Graal examples""" |
90 examples = { | |
91 'safeadd': ['com.oracle.max.graal.examples.safeadd', 'com.oracle.max.graal.examples.safeadd.Main'], | |
92 'vectorlib': ['com.oracle.max.graal.examples.vectorlib', 'com.oracle.max.graal.examples.vectorlib.Main'], | |
93 } | |
94 | |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
95 def run_example(verbose, project, mainClass): |
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
96 cp = mx.classpath(project) |
3718 | 97 sharedArgs = ['-Xcomp', '-XX:CompileOnly=Main', mainClass] |
98 | |
99 res = [] | |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
100 mx.log("=== Server VM ===") |
3718 | 101 printArg = '-XX:+PrintCompilation' if verbose else '-XX:-PrintCompilation' |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
102 res.append(vm(['-cp', cp, printArg] + sharedArgs, vm="-server")) |
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
103 mx.log("=== Graal VM ===") |
3718 | 104 printArg = '-G:+PrintCompilation' if verbose else '-G:-PrintCompilation' |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
105 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
|
106 mx.log("=== Graal VM with extensions ===") |
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
107 res.append(vm(['-cp', cp, printArg, '-G:+Extend', '-G:-Inline'] + sharedArgs)) |
3718 | 108 |
109 if len([x for x in res if x != 0]) != 0: | |
110 return 1 | |
111 return 0 | |
112 | |
113 verbose = False | |
114 if '-v' in args: | |
115 verbose = True | |
116 args = [a for a in args if a != '-v'] | |
117 | |
118 if len(args) == 0: | |
119 args = examples.keys() | |
120 for a in args: | |
121 config = examples.get(a) | |
122 if config is None: | |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
123 mx.log('unknown example: ' + a + ' {available examples = ' + str(examples.keys()) + '}') |
3718 | 124 else: |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
125 mx.log('--------- ' + a + ' ------------') |
3718 | 126 project, mainClass = config |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
127 run_example(verbose, project, mainClass) |
3718 | 128 |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
129 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
|
130 """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
|
131 |
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
132 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
|
133 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
|
134 DaCapo harness.""" |
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
135 |
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
136 benchmarks = [ |
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
137 'avrora', |
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
138 'batik', |
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
139 'eclipse', |
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
140 'fop', |
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
141 'h2', |
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
142 'jython', |
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
143 'luindex', |
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
144 'lusearch', |
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
145 'pmd', |
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
146 'sunflow', |
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
147 'tomcat', |
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
148 'tradebeans', |
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
149 'tradesoap', |
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
150 'xalan' |
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
151 ] |
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
152 |
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
153 dacapo = mx.check_get_env('DACAPO_CP') |
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
154 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
|
155 mx.abort('Specified DaCapo jar file does not exist or is not a jar file: ' + dacapo) |
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
156 |
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
157 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
|
158 |
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
159 selected = [] |
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
160 while len(args) != 0 and args[0][0] not in ['-', '@']: |
3718 | 161 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
|
162 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
|
163 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
|
164 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
|
165 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
|
166 |
4157
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
167 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
|
168 benchmarks = selected |
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
169 |
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
170 # 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
|
171 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
|
172 |
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
173 # 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
|
174 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
|
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 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
|
177 passed = [] |
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 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
|
180 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
|
181 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
|
182 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
|
183 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
|
184 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
|
185 |
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
186 failed = list(set(benchmarks).difference(set(passed))) |
3718 | 187 |
4157
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
188 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
|
189 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
|
190 |
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
|
191 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
|
192 """ |
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
|
193 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
|
194 """ |
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
|
195 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
|
196 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
|
197 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
|
198 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
|
199 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
|
200 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
|
201 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
|
202 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
|
203 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
|
204 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
|
205 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
|
206 |
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 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
|
208 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
|
209 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
|
210 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
|
211 |
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
|
212 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
|
213 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
|
214 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
|
215 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
|
216 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
|
217 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
|
218 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
|
219 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
|
220 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
|
221 |
3718 | 222 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
|
223 return jdk |
3718 | 224 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
|
225 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
|
226 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
|
227 if not create: |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
228 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
|
229 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
|
230 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
|
231 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
|
232 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
|
233 return res |
3718 | 234 else: |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
235 mx.abort('Unknown build type: ' + build) |
3718 | 236 |
4145
9aee7df31417
Removed 'tests' command.
Doug Simon <doug.simon@oracle.com>
parents:
4144
diff
changeset
|
237 def build(args): |
9aee7df31417
Removed 'tests' command.
Doug Simon <doug.simon@oracle.com>
parents:
4144
diff
changeset
|
238 """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
|
239 |
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
|
240 The optional argument specifies what type of VM to build.""" |
3718 | 241 |
4146 | 242 build = 'product' |
4147
55376d8953a6
Improved 'build' and 'clean' commands.
Doug Simon <doug.simon@oracle.com>
parents:
4146
diff
changeset
|
243 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
|
244 build = args.pop(0) |
4146 | 245 |
246 # 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
|
247 mx.build(args + ['--source', '1.7']) |
4145
9aee7df31417
Removed 'tests' command.
Doug Simon <doug.simon@oracle.com>
parents:
4144
diff
changeset
|
248 |
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
|
249 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
|
250 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
|
251 |
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
|
252 jdk = _jdk(build, True) |
3718 | 253 if build == 'debug': |
254 build = 'jvmg' | |
255 | |
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
|
256 graalVmDir = join(jdk, 'jre', 'lib', 'amd64', 'graal') |
3718 | 257 if not exists(graalVmDir): |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
258 mx.log('Creating Graal directory in JDK7: ' + graalVmDir) |
3718 | 259 os.makedirs(graalVmDir) |
260 | |
261 def filterXusage(line): | |
262 if not 'Xusage.txt' in line: | |
263 sys.stderr.write(line + os.linesep) | |
264 | |
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
|
265 os.environ.update(ARCH_DATA_MODEL='64', LANG='C', HOTSPOT_BUILD_JOBS='3', ALT_BOOTDIR=jdk, INSTALL='y') |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
266 mx.run([mx.gmake_cmd(), build + 'graal'], cwd=join(_graal_home, 'make'), err=filterXusage) |
3718 | 267 |
4159
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
268 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
|
269 """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
|
270 |
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
|
271 build = _vmbuild if _vmSourcesAvailable else 'product' |
4145
9aee7df31417
Removed 'tests' command.
Doug Simon <doug.simon@oracle.com>
parents:
4144
diff
changeset
|
272 if mx.java().debug: |
3718 | 273 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
|
274 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
|
275 return mx.run([exe, vm] + args, nonZeroIsFatal=nonZeroIsFatal, out=out, err=err, cwd=cwd, timeout=timeout) |
3718 | 276 |
4145
9aee7df31417
Removed 'tests' command.
Doug Simon <doug.simon@oracle.com>
parents:
4144
diff
changeset
|
277 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
|
278 """(re)generate Eclipse project configurations""" |
3732
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
279 |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
280 |
3732
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
281 def println(out, obj): |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
282 out.write(str(obj) + '\n') |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
283 |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
284 for p in mx.projects(): |
3732
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
285 if p.native: |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
286 continue |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
287 |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
288 if not exists(p.dir): |
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
289 os.makedirs(p.dir) |
3732
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
290 |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
291 out = StringIO.StringIO() |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
292 |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
293 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
|
294 println(out, '<classpath>') |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
295 for src in p.srcDirs: |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
296 srcDir = join(p.dir, src) |
3732
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
297 if not exists(srcDir): |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
298 os.mkdir(srcDir) |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
299 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
|
300 |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
301 # 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
|
302 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
|
303 |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
304 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
|
305 if dep == p: |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
306 continue; |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
307 |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
308 if dep.isLibrary(): |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
309 if hasattr(dep, 'eclipse.container'): |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
310 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
|
311 elif hasattr(dep, 'eclipse.project'): |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
312 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
|
313 else: |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
314 path = dep.path |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
315 if dep.mustExist: |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
316 if isabs(path): |
3732
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
317 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
|
318 else: |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
319 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
|
320 else: |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
321 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
|
322 |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
323 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
|
324 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
|
325 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
|
326 out.close() |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
327 |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
328 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
|
329 if exists(csConfig): |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
330 out = StringIO.StringIO() |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
331 |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
332 dotCheckstyle = join(p.dir, ".checkstyle") |
3732
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
333 checkstyleConfigPath = '/' + p.checkstyleProj + '/.checkstyle_checks.xml' |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
334 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
|
335 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
|
336 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
|
337 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
|
338 println(out, '\t</local-check-config>') |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
339 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
|
340 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
|
341 println(out, '\t</fileset>') |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
342 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
|
343 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
|
344 println(out, '\t</filter>') |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
345 |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
346 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
|
347 if exists(exclude): |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
348 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
|
349 with open(exclude) as f: |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
350 for line in f: |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
351 if not line.startswith('#'): |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
352 line = line.strip() |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
353 exclDir = join(p.dir, line) |
3732
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
354 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
|
355 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
|
356 println(out, '\t</filter>') |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
357 |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
358 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
|
359 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
|
360 out.close() |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
361 |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
362 |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
363 out = StringIO.StringIO() |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
364 |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
365 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
|
366 println(out, '<projectDescription>') |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
367 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
|
368 println(out, '\t<comment></comment>') |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
369 println(out, '\t<projects>') |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
370 println(out, '\t</projects>') |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
371 println(out, '\t<buildSpec>') |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
372 println(out, '\t\t<buildCommand>') |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
373 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
|
374 println(out, '\t\t\t<arguments>') |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
375 println(out, '\t\t\t</arguments>') |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
376 println(out, '\t\t</buildCommand>') |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
377 if exists(csConfig): |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
378 println(out, '\t\t<buildCommand>') |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
379 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
|
380 println(out, '\t\t\t<arguments>') |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
381 println(out, '\t\t\t</arguments>') |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
382 println(out, '\t\t</buildCommand>') |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
383 println(out, '\t</buildSpec>') |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
384 println(out, '\t<natures>') |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
385 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
|
386 if exists(csConfig): |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
387 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
|
388 println(out, '\t</natures>') |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
389 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
|
390 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
|
391 out.close() |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
392 |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
393 out = StringIO.StringIO() |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
394 settingsDir = join(p.dir, ".settings") |
3732
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
395 if not exists(settingsDir): |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
396 os.mkdir(settingsDir) |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
397 |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
398 myDir = dirname(__file__) |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
399 |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
400 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
|
401 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
|
402 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
|
403 |
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
404 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
|
405 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
|
406 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
|
407 |
4159
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
408 # Table of unit tests. |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
409 # 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
|
410 # 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
|
411 # 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
|
412 # unit tests. |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
413 _unittests = { |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
414 '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
|
415 } |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
416 |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
417 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
|
418 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
|
419 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
|
420 for name in files: |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
421 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
|
422 hasTest = False |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
423 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
|
424 pkg = None |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
425 for line in f: |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
426 if line.startswith("package "): |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
427 match = pkgDecl.match(line) |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
428 if match: |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
429 pkg = match.group(1) |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
430 else: |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
431 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
|
432 hasTest = True |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
433 break |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
434 if hasTest: |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
435 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
|
436 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
|
437 |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
438 def unittest(args): |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
439 """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
|
440 |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
441 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
|
442 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
|
443 those with a '-' prefix.""" |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
444 |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
445 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
|
446 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
|
447 |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
448 def containsAny(c, substrings): |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
449 for s in substrings: |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
450 if s in c: |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
451 return True |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
452 return False |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
453 |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
454 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
|
455 p = mx.project(proj) |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
456 classes = [] |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
457 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
|
458 _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
|
459 |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
460 if len(pos) != 0: |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
461 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
|
462 if len(neg) != 0: |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
463 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
|
464 |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
465 # (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
|
466 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
|
467 |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
468 def gate(args): |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
469 """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
|
470 |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
471 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
|
472 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
|
473 |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
474 start = time.time() |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
475 |
4160
338d46581e03
Added clean step to gate.
Doug Simon <doug.simon@oracle.com>
parents:
4159
diff
changeset
|
476 # 1. Clean |
4163
48f89a17f86a
Trivial change to test gate.
Doug Simon <doug.simon@oracle.com>
parents:
4162
diff
changeset
|
477 # clean([]) |
4160
338d46581e03
Added clean step to gate.
Doug Simon <doug.simon@oracle.com>
parents:
4159
diff
changeset
|
478 |
338d46581e03
Added clean step to gate.
Doug Simon <doug.simon@oracle.com>
parents:
4159
diff
changeset
|
479 # 2. Checkstyle |
4159
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
480 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
|
481 if mx.checkstyle([]) != 0: |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
482 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
|
483 |
4160
338d46581e03
Added clean step to gate.
Doug Simon <doug.simon@oracle.com>
parents:
4159
diff
changeset
|
484 # 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
|
485 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
|
486 if mx.canonicalizeprojects([]) != 0: |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
487 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
|
488 |
4160
338d46581e03
Added clean step to gate.
Doug Simon <doug.simon@oracle.com>
parents:
4159
diff
changeset
|
489 # 4. Build |
4159
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
490 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
|
491 build([]) |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
492 |
4160
338d46581e03
Added clean step to gate.
Doug Simon <doug.simon@oracle.com>
parents:
4159
diff
changeset
|
493 # 5. 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
|
494 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
|
495 vm(['-esa', '-version']) |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
496 |
4160
338d46581e03
Added clean step to gate.
Doug Simon <doug.simon@oracle.com>
parents:
4159
diff
changeset
|
497 # 6. Run unittests |
4159
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
498 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
|
499 unittest([]) |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
500 |
4160
338d46581e03
Added clean step to gate.
Doug Simon <doug.simon@oracle.com>
parents:
4159
diff
changeset
|
501 # 7. 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
|
502 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
|
503 dacapo(['eclipse']) |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
504 #dacapo(['tradesoap']) |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
505 dacapo(['batik']) |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
506 dacapo(['avrora']) |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
507 dacapo(['fop']) |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
508 |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
509 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
|
510 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
|
511 |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
512 def mx_init(): |
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
513 _vmbuild = 'product' |
3718 | 514 commands = { |
4159
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
515 '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
|
516 'clean': [clean, ''], |
4157
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
517 'dacapo': [dacapo, '[benchmark] [VM options|DaCapo options]'], |
3718 | 518 '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
|
519 'gate' : [gate, ''], |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
520 '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
|
521 '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
|
522 'ideinit': [ideinit, ''] |
3718 | 523 } |
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
|
524 |
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
|
525 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
|
526 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
|
527 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
|
528 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
|
529 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
|
530 |
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
|
531 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
|
532 '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
|
533 '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
|
534 }) |
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
|
535 |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
536 mx.commands.update(commands) |
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
537 |
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
538 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
|
539 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
|
540 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
|
541 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
|
542 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
|
543 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
|
544 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
|
545 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
|
546 |
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
|
547 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
|
548 global _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
|
549 if not opts.vmbuild is None: |
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
|
550 _vmbuild = opts.vmbuild |