annotate mx/commands.py @ 5871:576460f7e740

Merge
author Gilles Duboscq <duboscq@ssw.jku.at>
date Fri, 20 Jul 2012 14:40:37 +0200
parents d84a26dc32f5 44eb34b54526
children 000fb0550afe
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
1 #
4225
339cf8d4904d Made mx.run work properly when stderr is redirected to stdout.
Doug Simon <doug.simon@oracle.com>
parents: 4219
diff changeset
2 # commands.py - the GraalVM specific commands
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
3 #
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
4 # ----------------------------------------------------------------------------------------------------
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
5 #
4187
ac5c2bdfcca2 Disabled copyright check in the gate until the CheckCopyright tools supports the HotSpot copyright notice format.
Doug Simon <doug.simon@oracle.com>
parents: 4185
diff changeset
6 # Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
8 #
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
9 # This code is free software; you can redistribute it and/or modify it
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
10 # under the terms of the GNU General Public License version 2 only, as
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
11 # published by the Free Software Foundation.
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
12 #
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
13 # This code is distributed in the hope that it will be useful, but WITHOUT
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
14 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
15 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
16 # version 2 for more details (a copy is included in the LICENSE file that
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
17 # accompanied this code).
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
18 #
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
19 # You should have received a copy of the GNU General Public License version
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
20 # 2 along with this work; if not, write to the Free Software Foundation,
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
21 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
22 #
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
23 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
24 # or visit www.oracle.com if you need additional information or have any
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
25 # questions.
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
26 #
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
27 # ----------------------------------------------------------------------------------------------------
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
28
4582
b24386206122 Made all vm builds go into subdirectories, even product builds to simplify building the various types of VMs (server, client and graal).
Doug Simon <doug.simon@oracle.com>
parents: 4577
diff changeset
29 import os, sys, shutil, zipfile, tempfile, re, time, datetime, platform, subprocess, multiprocessing
4269
ffd5ce8fc736 Moved IDE project configuration into mx.py.
Doug Simon <doug.simon@oracle.com>
parents: 4257
diff changeset
30 from os.path import join, exists, dirname, 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
5047
6bc165b0fdcd Added 'intro' command to mx that runs a simple 'hello world' program and visualizes its compilation in the Graal Visualizer.
Doug Simon <doug.simon@oracle.com>
parents: 5034
diff changeset
32 from threading import Thread
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
33 import mx
4215
a2caa019ba3a Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4187
diff changeset
34 import sanitycheck
4282
063ea022532c mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4276
diff changeset
35 import json
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
36
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
37 _graal_home = dirname(dirname(__file__))
4417
648a7873cea2 Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents: 4407
diff changeset
38
648a7873cea2 Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents: 4407
diff changeset
39 """ Used to distinguish an exported GraalVM (see 'mx export'). """
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
40 _vmSourcesAvailable = exists(join(_graal_home, 'make')) and exists(join(_graal_home, 'src'))
4417
648a7873cea2 Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents: 4407
diff changeset
41
648a7873cea2 Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents: 4407
diff changeset
42 """ The VM that will be run by the 'vm' command: graal(default), client or server.
648a7873cea2 Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents: 4407
diff changeset
43 This can be set via the global '--vm' option. """
648a7873cea2 Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents: 4407
diff changeset
44 _vm = 'graal'
648a7873cea2 Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents: 4407
diff changeset
45
648a7873cea2 Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents: 4407
diff changeset
46 """ The VM build that will be run by the 'vm' command: product(default), fastdebug or debug.
648a7873cea2 Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents: 4407
diff changeset
47 This can be set via the global '--fastdebug' and '--debug' options. """
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
48 _vmbuild = 'product'
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
49
5024
7ccdae96e98a Allow JaCoCon to append to the execution file
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5016
diff changeset
50 _jacoco = 'off'
4684
e136f2d0d002 Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4660
diff changeset
51
5194
a6eceb5efb0e added --ecl option to mx for saving VM execution(s) as Eclipse launch configurations
Doug Simon <doug.simon@oracle.com>
parents: 5189
diff changeset
52 _make_eclipse_launch = False
a6eceb5efb0e added --ecl option to mx for saving VM execution(s) as Eclipse launch configurations
Doug Simon <doug.simon@oracle.com>
parents: 5189
diff changeset
53
4276
f8f262212aa4 Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents: 4269
diff changeset
54 _copyrightTemplate = """/*
f8f262212aa4 Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents: 4269
diff changeset
55 * Copyright (c) {0}, Oracle and/or its affiliates. All rights reserved.
f8f262212aa4 Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents: 4269
diff changeset
56 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
f8f262212aa4 Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents: 4269
diff changeset
57 *
f8f262212aa4 Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents: 4269
diff changeset
58 * This code is free software; you can redistribute it and/or modify it
f8f262212aa4 Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents: 4269
diff changeset
59 * under the terms of the GNU General Public License version 2 only, as
f8f262212aa4 Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents: 4269
diff changeset
60 * published by the Free Software Foundation.
f8f262212aa4 Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents: 4269
diff changeset
61 *
f8f262212aa4 Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents: 4269
diff changeset
62 * This code is distributed in the hope that it will be useful, but WITHOUT
f8f262212aa4 Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents: 4269
diff changeset
63 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
f8f262212aa4 Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents: 4269
diff changeset
64 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
f8f262212aa4 Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents: 4269
diff changeset
65 * version 2 for more details (a copy is included in the LICENSE file that
f8f262212aa4 Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents: 4269
diff changeset
66 * accompanied this code).
f8f262212aa4 Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents: 4269
diff changeset
67 *
f8f262212aa4 Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents: 4269
diff changeset
68 * You should have received a copy of the GNU General Public License version
f8f262212aa4 Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents: 4269
diff changeset
69 * 2 along with this work; if not, write to the Free Software Foundation,
f8f262212aa4 Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents: 4269
diff changeset
70 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
f8f262212aa4 Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents: 4269
diff changeset
71 *
f8f262212aa4 Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents: 4269
diff changeset
72 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f8f262212aa4 Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents: 4269
diff changeset
73 * or visit www.oracle.com if you need additional information or have any
f8f262212aa4 Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents: 4269
diff changeset
74 * questions.
f8f262212aa4 Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents: 4269
diff changeset
75 */
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
76
4276
f8f262212aa4 Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents: 4269
diff changeset
77 """
f8f262212aa4 Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents: 4269
diff changeset
78
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
79 def clean(args):
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
80 """cleans the GraalVM source tree"""
4247
3f6c6e61614e Changed 'mx build' such that all Java sources for a project are compiled together instead of by source directory.
Doug Simon <doug.simon@oracle.com>
parents: 4244
diff changeset
81 opts = mx.clean(args, parser=ArgumentParser(prog='mx clean'))
4226
e03ff10d4bfc Made the gate clean the Java projects only.
Doug Simon <doug.simon@oracle.com>
parents: 4225
diff changeset
82 if opts.native:
e03ff10d4bfc Made the gate clean the Java projects only.
Doug Simon <doug.simon@oracle.com>
parents: 4225
diff changeset
83 os.environ.update(ARCH_DATA_MODEL='64', LANG='C', HOTSPOT_BUILD_JOBS='16')
e03ff10d4bfc Made the gate clean the Java projects only.
Doug Simon <doug.simon@oracle.com>
parents: 4225
diff changeset
84 mx.run([mx.gmake_cmd(), 'clean'], cwd=join(_graal_home, 'make'))
5239
b9db4fee6eb2 skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents: 5234
diff changeset
85 jdks = join(_graal_home, 'jdk' + mx.java().version)
b9db4fee6eb2 skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents: 5234
diff changeset
86 if exists(jdks):
b9db4fee6eb2 skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents: 5234
diff changeset
87 shutil.rmtree(jdks)
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
88
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
89 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
90 """create a GraalVM zip file for distribution"""
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
91
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
92 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
93 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
94 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
95 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
96
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
97 args = parser.parse_args(args)
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
98
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
99 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
100 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
101 # 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
102 build(['product'])
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
103
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
104 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
105 mx.run(('hg archive -I graal -I mx -I mxtool -I mx.sh ' + tmp).split())
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
106
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
107 # 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
108 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
109 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
110 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
111 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
112 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
113 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
114 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
115 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
116 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
117 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
118 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
119
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
120 # 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
121 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
122 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
123 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
124 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
125 mx.run('mx ideinit'.split(), cwd=tmp)
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
126
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
127 # 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
128 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
129 shutil.rmtree(tmp)
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
130
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
131 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
132
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
133 def example(args):
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
134 """run some or all Graal examples"""
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
135 examples = {
5064
8a88c903e381 Updated mx commands.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5047
diff changeset
136 'safeadd': ['com.oracle.graal.examples.safeadd', 'com.oracle.graal.examples.safeadd.Main'],
8a88c903e381 Updated mx commands.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5047
diff changeset
137 'vectorlib': ['com.oracle.graal.examples.vectorlib', 'com.oracle.graal.examples.vectorlib.Main'],
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
138 }
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
139
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
140 def run_example(verbose, project, mainClass):
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
141 cp = mx.classpath(project)
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
142 sharedArgs = ['-Xcomp', '-XX:CompileOnly=Main', mainClass]
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
143
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
144 res = []
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
145 mx.log("=== Server VM ===")
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
146 printArg = '-XX:+PrintCompilation' if verbose else '-XX:-PrintCompilation'
4417
648a7873cea2 Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents: 4407
diff changeset
147 res.append(vm(['-cp', cp, printArg] + sharedArgs, vm='server'))
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
148 mx.log("=== Graal VM ===")
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
149 printArg = '-G:+PrintCompilation' if verbose else '-G:-PrintCompilation'
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
150 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
151 mx.log("=== Graal VM with extensions ===")
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
152 res.append(vm(['-cp', cp, printArg, '-G:+Extend', '-G:-Inline'] + sharedArgs))
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
153
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
154 if len([x for x in res if x != 0]) != 0:
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
155 return 1
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
156 return 0
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
157
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
158 verbose = False
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
159 if '-v' in args:
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
160 verbose = True
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
161 args = [a for a in args if a != '-v']
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
162
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
163 if len(args) == 0:
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
164 args = examples.keys()
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
165 for a in args:
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
166 config = examples.get(a)
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
167 if config is None:
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
168 mx.log('unknown example: ' + a + ' {available examples = ' + str(examples.keys()) + '}')
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
169 else:
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
170 mx.log('--------- ' + a + ' ------------')
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
171 project, mainClass = config
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
172 run_example(verbose, project, mainClass)
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
173
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
174 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
175 """run one or all DaCapo benchmarks
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
176
4244
a69889e5a8a5 Made the DaCapo library be downloaded only on demand.
Doug Simon <doug.simon@oracle.com>
parents: 4240
diff changeset
177 DaCapo options are distinguished from VM options by a '@' prefix.
5649
14505f3e6b4c modified harness for running JUnit and JTT tests such that only projects declaring a 'testHarness' attribute in mx/projects are scanned for tests
Doug Simon <doug.simon@oracle.com>
parents: 5596
diff changeset
178 For example, '@-n @5' will pass '-n 5' to the
4157
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
179 DaCapo harness."""
4215
a2caa019ba3a Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4187
diff changeset
180
a2caa019ba3a Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4187
diff changeset
181 numTests = {}
a2caa019ba3a Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4187
diff changeset
182 if len(args) > 0:
a2caa019ba3a Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4187
diff changeset
183 level = getattr(sanitycheck.SanityCheckLevel, args[0], None)
a2caa019ba3a Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4187
diff changeset
184 if level is not None:
a2caa019ba3a Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4187
diff changeset
185 del args[0]
a2caa019ba3a Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4187
diff changeset
186 for (bench, ns) in sanitycheck.dacapoSanityWarmup.items():
a2caa019ba3a Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4187
diff changeset
187 if ns[level] > 0:
a2caa019ba3a Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4187
diff changeset
188 numTests[bench] = ns[level]
a2caa019ba3a Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4187
diff changeset
189 else:
a2caa019ba3a Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4187
diff changeset
190 while len(args) != 0 and args[0][0] not in ['-', '@']:
a2caa019ba3a Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4187
diff changeset
191 n = 1
a2caa019ba3a Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4187
diff changeset
192 if args[0].isdigit():
a2caa019ba3a Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4187
diff changeset
193 n = int(args[0])
a2caa019ba3a Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4187
diff changeset
194 assert len(args) > 1 and args[1][0] not in ['-', '@'] and not args[1].isdigit()
a2caa019ba3a Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4187
diff changeset
195 bm = args[1]
a2caa019ba3a Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4187
diff changeset
196 del args[0]
a2caa019ba3a Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4187
diff changeset
197 else:
a2caa019ba3a Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4187
diff changeset
198 bm = args[0]
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
199
4215
a2caa019ba3a Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4187
diff changeset
200 del args[0]
a2caa019ba3a Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4187
diff changeset
201 if bm not in sanitycheck.dacapoSanityWarmup.keys():
a2caa019ba3a Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4187
diff changeset
202 mx.abort('unknown benchmark: ' + bm + '\nselect one of: ' + str(sanitycheck.dacapoSanityWarmup.keys()))
a2caa019ba3a Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4187
diff changeset
203 numTests[bm] = n
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
204
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
205 if len(numTests) is 0:
4215
a2caa019ba3a Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4187
diff changeset
206 for bench in sanitycheck.dacapoSanityWarmup.keys():
a2caa019ba3a Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4187
diff changeset
207 numTests[bench] = 1
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
208
4157
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
209 # 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
210 dacapoArgs = [(arg[1:]) for arg in args if arg.startswith('@')]
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
211
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
212 # The remainder are VM options
4215
a2caa019ba3a Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4187
diff changeset
213 vmOpts = [arg for arg in args if not arg.startswith('@')]
5229
ce6cb3a1eb44 mx dacapo, mx scaladacapo and mx specjvm2008 should use the specified vm
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5197
diff changeset
214 vm = _vm
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
215
4215
a2caa019ba3a Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4187
diff changeset
216 failed = []
a2caa019ba3a Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4187
diff changeset
217 for (test, n) in numTests.items():
5229
ce6cb3a1eb44 mx dacapo, mx scaladacapo and mx specjvm2008 should use the specified vm
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5197
diff changeset
218 if not sanitycheck.getDacapo(test, n, dacapoArgs).test(vm, opts=vmOpts):
4215
a2caa019ba3a Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4187
diff changeset
219 failed.append(test)
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
220
4157
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
221 if len(failed) != 0:
4215
a2caa019ba3a Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4187
diff changeset
222 mx.abort('DaCapo failures: ' + str(failed))
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
223
4480
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
224 def scaladacapo(args):
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
225 """run one or all Scala DaCapo benchmarks
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
226
4480
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
227 Scala DaCapo options are distinguished from VM options by a '@' prefix.
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
228 For example, '@--iterations @5' will pass '--iterations 5' to the
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
229 DaCapo harness."""
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
230
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
231 numTests = {}
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
232
4480
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
233 if len(args) > 0:
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
234 level = getattr(sanitycheck.SanityCheckLevel, args[0], None)
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
235 if level is not None:
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
236 del args[0]
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
237 for (bench, ns) in sanitycheck.dacapoScalaSanityWarmup.items():
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
238 if ns[level] > 0:
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
239 numTests[bench] = ns[level]
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
240 else:
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
241 while len(args) != 0 and args[0][0] not in ['-', '@']:
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
242 n = 1
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
243 if args[0].isdigit():
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
244 n = int(args[0])
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
245 assert len(args) > 1 and args[1][0] not in ['-', '@'] and not args[1].isdigit()
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
246 bm = args[1]
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
247 del args[0]
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
248 else:
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
249 bm = args[0]
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
250
4480
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
251 del args[0]
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
252 if bm not in sanitycheck.dacapoScalaSanityWarmup.keys():
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
253 mx.abort('unknown benchmark: ' + bm + '\nselect one of: ' + str(sanitycheck.dacapoScalaSanityWarmup.keys()))
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
254 numTests[bm] = n
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
255
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
256 if len(numTests) is 0:
4480
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
257 for bench in sanitycheck.dacapoScalaSanityWarmup.keys():
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
258 numTests[bench] = 1
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
259
4480
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
260 # Extract DaCapo options
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
261 dacapoArgs = [(arg[1:]) for arg in args if arg.startswith('@')]
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
262
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
263 # The remainder are VM options
4480
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
264 vmOpts = [arg for arg in args if not arg.startswith('@')]
5229
ce6cb3a1eb44 mx dacapo, mx scaladacapo and mx specjvm2008 should use the specified vm
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5197
diff changeset
265 vm = _vm;
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
266
4480
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
267 failed = []
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
268 for (test, n) in numTests.items():
5229
ce6cb3a1eb44 mx dacapo, mx scaladacapo and mx specjvm2008 should use the specified vm
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5197
diff changeset
269 if not sanitycheck.getScalaDacapo(test, n, dacapoArgs).test(vm, opts=vmOpts):
4480
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
270 failed.append(test)
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
271
4480
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
272 if len(failed) != 0:
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
273 mx.abort('Scala DaCapo failures: ' + str(failed))
4584
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
274
4607
ee87cfe2f8f9 Made GraalVM build work on Mac OS X.
Doug Simon <doug.simon@oracle.com>
parents: 4602
diff changeset
275 def _vmLibDirInJdk(jdk):
ee87cfe2f8f9 Made GraalVM build work on Mac OS X.
Doug Simon <doug.simon@oracle.com>
parents: 4602
diff changeset
276 """
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
277 Get the directory within a JDK where the server and client
5680
87fc13b59258 Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5649
diff changeset
278 subdirectories are located.
4607
ee87cfe2f8f9 Made GraalVM build work on Mac OS X.
Doug Simon <doug.simon@oracle.com>
parents: 4602
diff changeset
279 """
ee87cfe2f8f9 Made GraalVM build work on Mac OS X.
Doug Simon <doug.simon@oracle.com>
parents: 4602
diff changeset
280 if platform.system() == 'Darwin':
ee87cfe2f8f9 Made GraalVM build work on Mac OS X.
Doug Simon <doug.simon@oracle.com>
parents: 4602
diff changeset
281 return join(jdk, 'jre', 'lib')
5680
87fc13b59258 Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5649
diff changeset
282 if platform.system() == 'Windows':
87fc13b59258 Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5649
diff changeset
283 return join(jdk, 'jre', 'bin')
4607
ee87cfe2f8f9 Made GraalVM build work on Mac OS X.
Doug Simon <doug.simon@oracle.com>
parents: 4602
diff changeset
284 return join(jdk, 'jre', 'lib', 'amd64')
ee87cfe2f8f9 Made GraalVM build work on Mac OS X.
Doug Simon <doug.simon@oracle.com>
parents: 4602
diff changeset
285
5680
87fc13b59258 Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5649
diff changeset
286 def _vmCfgInJdk(jdk):
87fc13b59258 Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5649
diff changeset
287 """
87fc13b59258 Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5649
diff changeset
288 Get the jvm.cfg file.
87fc13b59258 Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5649
diff changeset
289 """
87fc13b59258 Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5649
diff changeset
290 if platform.system() == 'Windows':
87fc13b59258 Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5649
diff changeset
291 return join(jdk, 'jre', 'lib', 'amd64', 'jvm.cfg')
87fc13b59258 Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5649
diff changeset
292 return join(_vmLibDirInJdk(jdk), 'jvm.cfg')
87fc13b59258 Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5649
diff changeset
293
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
294 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
295 """
394404b2d9bd Removed strict requirement for GRAAL environment variable. It only needs to be set now if the graal directory is not in the directory hierarchy of GraalVM JDK.
Doug Simon <doug.simon@oracle.com>
parents: 4153
diff changeset
296 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
297 """
4582
b24386206122 Made all vm builds go into subdirectories, even product builds to simplify building the various types of VMs (server, client and graal).
Doug Simon <doug.simon@oracle.com>
parents: 4577
diff changeset
298 jdk = join(_graal_home, 'jdk' + mx.java().version, build)
5870
d84a26dc32f5 Make 'db' directory from JDK optional since it does not exists in all OpenJDK-based JDKs (cf. Icedtea)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5868
diff changeset
299 jdkContents = ['bin', 'include', 'jre', 'lib']
d84a26dc32f5 Make 'db' directory from JDK optional since it does not exists in all OpenJDK-based JDKs (cf. Icedtea)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5868
diff changeset
300 if (exists(join(jdk, 'db'))):
d84a26dc32f5 Make 'db' directory from JDK optional since it does not exists in all OpenJDK-based JDKs (cf. Icedtea)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5868
diff changeset
301 jdkContents.append('db')
4252
67e88b7624d5 Removed need for GRAAL environment variable on Windows.
Doug Simon <doug.simon@oracle.com>
parents: 4247
diff changeset
302 if mx.get_os() != 'windows':
67e88b7624d5 Removed need for GRAAL environment variable on Windows.
Doug Simon <doug.simon@oracle.com>
parents: 4247
diff changeset
303 jdkContents.append('man')
4582
b24386206122 Made all vm builds go into subdirectories, even product builds to simplify building the various types of VMs (server, client and graal).
Doug Simon <doug.simon@oracle.com>
parents: 4577
diff changeset
304 if create:
b24386206122 Made all vm builds go into subdirectories, even product builds to simplify building the various types of VMs (server, client and graal).
Doug Simon <doug.simon@oracle.com>
parents: 4577
diff changeset
305 if not exists(jdk):
b24386206122 Made all vm builds go into subdirectories, even product builds to simplify building the various types of VMs (server, client and graal).
Doug Simon <doug.simon@oracle.com>
parents: 4577
diff changeset
306 srcJdk = mx.java().jdk
b24386206122 Made all vm builds go into subdirectories, even product builds to simplify building the various types of VMs (server, client and graal).
Doug Simon <doug.simon@oracle.com>
parents: 4577
diff changeset
307 mx.log('Creating ' + jdk + ' from ' + srcJdk)
b24386206122 Made all vm builds go into subdirectories, even product builds to simplify building the various types of VMs (server, client and graal).
Doug Simon <doug.simon@oracle.com>
parents: 4577
diff changeset
308 os.makedirs(jdk)
4252
67e88b7624d5 Removed need for GRAAL environment variable on Windows.
Doug Simon <doug.simon@oracle.com>
parents: 4247
diff changeset
309 for d in jdkContents:
4582
b24386206122 Made all vm builds go into subdirectories, even product builds to simplify building the various types of VMs (server, client and graal).
Doug Simon <doug.simon@oracle.com>
parents: 4577
diff changeset
310 src = join(srcJdk, d)
b24386206122 Made all vm builds go into subdirectories, even product builds to simplify building the various types of VMs (server, client and graal).
Doug Simon <doug.simon@oracle.com>
parents: 4577
diff changeset
311 dst = join(jdk, d)
b24386206122 Made all vm builds go into subdirectories, even product builds to simplify building the various types of VMs (server, client and graal).
Doug Simon <doug.simon@oracle.com>
parents: 4577
diff changeset
312 if not exists(src):
b24386206122 Made all vm builds go into subdirectories, even product builds to simplify building the various types of VMs (server, client and graal).
Doug Simon <doug.simon@oracle.com>
parents: 4577
diff changeset
313 mx.abort('Host JDK directory is missing: ' + src)
b24386206122 Made all vm builds go into subdirectories, even product builds to simplify building the various types of VMs (server, client and graal).
Doug Simon <doug.simon@oracle.com>
parents: 4577
diff changeset
314 shutil.copytree(src, dst)
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
315
4584
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
316 # Make a copy of the default VM so that this JDK can be
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
317 # reliably used as the bootstrap for a HotSpot build.
5680
87fc13b59258 Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5649
diff changeset
318 jvmCfg = _vmCfgInJdk(jdk)
4584
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
319 if not exists(jvmCfg):
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
320 mx.abort(jvmCfg + ' does not exist')
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
321
4584
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
322 lines = []
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
323 defaultVM = None
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
324 with open(jvmCfg) as f:
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
325 for line in f:
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
326 if line.startswith('-') and defaultVM is None:
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
327 parts = line.split()
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
328 assert len(parts) == 2, parts
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
329 assert parts[1] == 'KNOWN', parts[1]
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
330 defaultVM = parts[0][1:]
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
331 lines.append('-' + defaultVM + '0 KNOWN\n')
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
332 lines.append(line)
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
333
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
334 assert defaultVM is not None, 'Could not find default VM in ' + jvmCfg
4607
ee87cfe2f8f9 Made GraalVM build work on Mac OS X.
Doug Simon <doug.simon@oracle.com>
parents: 4602
diff changeset
335 shutil.copytree(join(_vmLibDirInJdk(jdk), defaultVM), join(_vmLibDirInJdk(jdk), defaultVM + '0'))
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
336
4584
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
337 with open(jvmCfg, 'w') as f:
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
338 for line in lines:
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
339 f.write(line)
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
340
5596
e4b1bc5e29e0 hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents: 5517
diff changeset
341 # Install a copy of the disassembler library
e4b1bc5e29e0 hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents: 5517
diff changeset
342 try:
e4b1bc5e29e0 hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents: 5517
diff changeset
343 hsdis([], copyToDir=_vmLibDirInJdk(jdk))
e4b1bc5e29e0 hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents: 5517
diff changeset
344 except SystemExit:
e4b1bc5e29e0 hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents: 5517
diff changeset
345 pass
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
346 else:
4582
b24386206122 Made all vm builds go into subdirectories, even product builds to simplify building the various types of VMs (server, client and graal).
Doug Simon <doug.simon@oracle.com>
parents: 4577
diff changeset
347 if not exists(jdk):
4587
5b04b33dac74 add jtt tests, converted from the maxine repository using ConvertJTT
Lukas Stadler <lukas.stadler@jku.at>
parents: 4584
diff changeset
348 mx.abort('The ' + build + ' VM has not been created - run \'mx clean; mx build ' + build + '\'')
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
349 return jdk
4177
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
350
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
351 # run a command in the windows SDK Debug Shell
4215
a2caa019ba3a Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4187
diff changeset
352 def _runInDebugShell(cmd, workingDir, logFile=None, findInOutput=None, respondTo={}):
4177
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
353 newLine = os.linesep
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
354 STARTTOKEN = 'RUNINDEBUGSHELL_STARTSEQUENCE'
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
355 ENDTOKEN = 'RUNINDEBUGSHELL_ENDSEQUENCE'
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
356
4252
67e88b7624d5 Removed need for GRAAL environment variable on Windows.
Doug Simon <doug.simon@oracle.com>
parents: 4247
diff changeset
357 winSDK = mx.get_env('WIN_SDK', 'C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\')
67e88b7624d5 Removed need for GRAAL environment variable on Windows.
Doug Simon <doug.simon@oracle.com>
parents: 4247
diff changeset
358
67e88b7624d5 Removed need for GRAAL environment variable on Windows.
Doug Simon <doug.simon@oracle.com>
parents: 4247
diff changeset
359 p = subprocess.Popen('cmd.exe /E:ON /V:ON /K ""' + winSDK + '/Bin/SetEnv.cmd" & echo ' + STARTTOKEN + '"', \
67e88b7624d5 Removed need for GRAAL environment variable on Windows.
Doug Simon <doug.simon@oracle.com>
parents: 4247
diff changeset
360 shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, creationflags=subprocess.CREATE_NEW_PROCESS_GROUP)
4269
ffd5ce8fc736 Moved IDE project configuration into mx.py.
Doug Simon <doug.simon@oracle.com>
parents: 4257
diff changeset
361 stdout = p.stdout
ffd5ce8fc736 Moved IDE project configuration into mx.py.
Doug Simon <doug.simon@oracle.com>
parents: 4257
diff changeset
362 stdin = p.stdin
4177
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
363 if logFile:
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
364 log = open(logFile, 'w')
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
365 ret = False
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
366 while True:
5680
87fc13b59258 Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5649
diff changeset
367 line = stdout.readline().decode(sys.stdout.encoding)
4177
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
368 if logFile:
5680
87fc13b59258 Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5649
diff changeset
369 log.write(line.encode('utf-8'))
4177
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
370 line = line.strip()
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
371 mx.log(line)
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
372 if line == STARTTOKEN:
4269
ffd5ce8fc736 Moved IDE project configuration into mx.py.
Doug Simon <doug.simon@oracle.com>
parents: 4257
diff changeset
373 stdin.write('cd /D ' + workingDir + ' & ' + cmd + ' & echo ' + ENDTOKEN + newLine)
4177
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
374 for regex in respondTo.keys():
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
375 match = regex.search(line)
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
376 if match:
4269
ffd5ce8fc736 Moved IDE project configuration into mx.py.
Doug Simon <doug.simon@oracle.com>
parents: 4257
diff changeset
377 stdin.write(respondTo[regex] + newLine)
4177
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
378 if findInOutput:
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
379 match = findInOutput.search(line)
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
380 if match:
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
381 ret = True
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
382 if line == ENDTOKEN:
5680
87fc13b59258 Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5649
diff changeset
383 if not findInOutput:
5868
a10e72af4dc5 Make windows build work even if Visual Studio is not installed (only the Windows SDK is required)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5782
diff changeset
384 stdin.write('echo ERRXXX%errorlevel%' + newLine)
5680
87fc13b59258 Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5649
diff changeset
385 else:
87fc13b59258 Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5649
diff changeset
386 break
5868
a10e72af4dc5 Make windows build work even if Visual Studio is not installed (only the Windows SDK is required)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5782
diff changeset
387 if line.startswith('ERRXXX'):
a10e72af4dc5 Make windows build work even if Visual Studio is not installed (only the Windows SDK is required)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5782
diff changeset
388 if line == 'ERRXXX0':
5680
87fc13b59258 Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5649
diff changeset
389 ret = True
87fc13b59258 Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5649
diff changeset
390 break;
4269
ffd5ce8fc736 Moved IDE project configuration into mx.py.
Doug Simon <doug.simon@oracle.com>
parents: 4257
diff changeset
391 stdin.write('exit' + newLine)
4177
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
392 if logFile:
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
393 log.close()
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
394 return ret
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
395
5103
276e14614531 Added jdkhome command to mx.
Doug Simon <doug.simon@oracle.com>
parents: 5094
diff changeset
396 def jdkhome(args, vm=None):
276e14614531 Added jdkhome command to mx.
Doug Simon <doug.simon@oracle.com>
parents: 5094
diff changeset
397 """prints the JDK directory selected for the 'vm' command"""
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
398
5103
276e14614531 Added jdkhome command to mx.
Doug Simon <doug.simon@oracle.com>
parents: 5094
diff changeset
399 build = _vmbuild if _vmSourcesAvailable else 'product'
276e14614531 Added jdkhome command to mx.
Doug Simon <doug.simon@oracle.com>
parents: 5094
diff changeset
400 print join(_graal_home, 'jdk' + mx.java().version, build)
276e14614531 Added jdkhome command to mx.
Doug Simon <doug.simon@oracle.com>
parents: 5094
diff changeset
401
4577
bc8b58c11768 Added debug build of HotSpot Client to the gate.
Doug Simon <doug.simon@oracle.com>
parents: 4575
diff changeset
402 def build(args, vm=None):
4575
ccb5369481a2 Clarified mx help text on how to build/run [Graal|Client|Server].
Doug Simon <doug.simon@oracle.com>
parents: 4572
diff changeset
403 """build the VM binary
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
404
4575
ccb5369481a2 Clarified mx help text on how to build/run [Graal|Client|Server].
Doug Simon <doug.simon@oracle.com>
parents: 4572
diff changeset
405 The global '--vm' option selects which VM to build. This command also
ccb5369481a2 Clarified mx help text on how to build/run [Graal|Client|Server].
Doug Simon <doug.simon@oracle.com>
parents: 4572
diff changeset
406 compiles the Graal classes irrespective of what VM is being built.
ccb5369481a2 Clarified mx help text on how to build/run [Graal|Client|Server].
Doug Simon <doug.simon@oracle.com>
parents: 4572
diff changeset
407 The optional last argument specifies what build level is to be used
ccb5369481a2 Clarified mx help text on how to build/run [Graal|Client|Server].
Doug Simon <doug.simon@oracle.com>
parents: 4572
diff changeset
408 for the VM binary."""
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
409
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
410 # Call mx.build to compile the Java sources
4559
723df37192d6 Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4540
diff changeset
411 opts2 = mx.build(['--source', '1.7'] + args, parser=ArgumentParser(prog='mx build'))
4145
9aee7df31417 Removed 'tests' command.
Doug Simon <doug.simon@oracle.com>
parents: 4144
diff changeset
412
4559
723df37192d6 Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4540
diff changeset
413 if not _vmSourcesAvailable or not opts2.native:
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
414 return
4234
057620486c90 Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents: 4230
diff changeset
415
4559
723df37192d6 Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4540
diff changeset
416 builds = opts2.remainder
4234
057620486c90 Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents: 4230
diff changeset
417 if len(builds) == 0:
057620486c90 Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents: 4230
diff changeset
418 builds = ['product']
057620486c90 Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents: 4230
diff changeset
419
4577
bc8b58c11768 Added debug build of HotSpot Client to the gate.
Doug Simon <doug.simon@oracle.com>
parents: 4575
diff changeset
420 if vm is None:
bc8b58c11768 Added debug build of HotSpot Client to the gate.
Doug Simon <doug.simon@oracle.com>
parents: 4575
diff changeset
421 vm = _vm
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
422
4417
648a7873cea2 Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents: 4407
diff changeset
423 if vm == 'server':
648a7873cea2 Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents: 4407
diff changeset
424 buildSuffix = ''
648a7873cea2 Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents: 4407
diff changeset
425 elif vm == 'client':
648a7873cea2 Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents: 4407
diff changeset
426 buildSuffix = '1'
648a7873cea2 Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents: 4407
diff changeset
427 else:
4559
723df37192d6 Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4540
diff changeset
428 assert vm == 'graal', vm
4417
648a7873cea2 Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents: 4407
diff changeset
429 buildSuffix = 'graal'
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
430
4234
057620486c90 Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents: 4230
diff changeset
431 for build in builds:
5094
d3f547b08304 added mechanism for disabling automatic native builds from the IDE (set IDE_BUILD_TARGET="" in mx/env)
Doug Simon <doug.simon@oracle.com>
parents: 5090
diff changeset
432 if build == 'ide-build-target':
d3f547b08304 added mechanism for disabling automatic native builds from the IDE (set IDE_BUILD_TARGET="" in mx/env)
Doug Simon <doug.simon@oracle.com>
parents: 5090
diff changeset
433 build = os.environ.get('IDE_BUILD_TARGET', 'product')
d3f547b08304 added mechanism for disabling automatic native builds from the IDE (set IDE_BUILD_TARGET="" in mx/env)
Doug Simon <doug.simon@oracle.com>
parents: 5090
diff changeset
434 if len(build) == 0:
d3f547b08304 added mechanism for disabling automatic native builds from the IDE (set IDE_BUILD_TARGET="" in mx/env)
Doug Simon <doug.simon@oracle.com>
parents: 5090
diff changeset
435 mx.log('[skipping build from IDE as IDE_BUILD_TARGET environment variable is ""]')
d3f547b08304 added mechanism for disabling automatic native builds from the IDE (set IDE_BUILD_TARGET="" in mx/env)
Doug Simon <doug.simon@oracle.com>
parents: 5090
diff changeset
436 continue
d3f547b08304 added mechanism for disabling automatic native builds from the IDE (set IDE_BUILD_TARGET="" in mx/env)
Doug Simon <doug.simon@oracle.com>
parents: 5090
diff changeset
437
4582
b24386206122 Made all vm builds go into subdirectories, even product builds to simplify building the various types of VMs (server, client and graal).
Doug Simon <doug.simon@oracle.com>
parents: 4577
diff changeset
438 jdk = _jdk(build, create=True)
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
439
4607
ee87cfe2f8f9 Made GraalVM build work on Mac OS X.
Doug Simon <doug.simon@oracle.com>
parents: 4602
diff changeset
440 vmDir = join(_vmLibDirInJdk(jdk), vm)
4417
648a7873cea2 Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents: 4407
diff changeset
441 if not exists(vmDir):
648a7873cea2 Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents: 4407
diff changeset
442 mx.log('Creating VM directory in JDK7: ' + vmDir)
648a7873cea2 Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents: 4407
diff changeset
443 os.makedirs(vmDir)
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
444
4234
057620486c90 Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents: 4230
diff changeset
445 def filterXusage(line):
057620486c90 Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents: 4230
diff changeset
446 if not 'Xusage.txt' in line:
057620486c90 Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents: 4230
diff changeset
447 sys.stderr.write(line + os.linesep)
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
448
5153
57546200db29 fixed comment and error message in commands.py
Doug Simon <doug.simon@oracle.com>
parents: 5152
diff changeset
449 # Check that the declaration of graal_projects in arguments.cpp is up to date
5152
cfdb3c24bd6c changed Graal class path declaration (back) to a constant that is checked for correctness during building
Doug Simon <doug.simon@oracle.com>
parents: 5103
diff changeset
450 argumentsCpp = join(_graal_home, 'src', 'share', 'vm', 'runtime', 'arguments.cpp')
cfdb3c24bd6c changed Graal class path declaration (back) to a constant that is checked for correctness during building
Doug Simon <doug.simon@oracle.com>
parents: 5103
diff changeset
451 assert exists(argumentsCpp), 'File does not exist: ' + argumentsCpp
cfdb3c24bd6c changed Graal class path declaration (back) to a constant that is checked for correctness during building
Doug Simon <doug.simon@oracle.com>
parents: 5103
diff changeset
452 with open(argumentsCpp) as fp:
cfdb3c24bd6c changed Graal class path declaration (back) to a constant that is checked for correctness during building
Doug Simon <doug.simon@oracle.com>
parents: 5103
diff changeset
453 source = fp.read();
cfdb3c24bd6c changed Graal class path declaration (back) to a constant that is checked for correctness during building
Doug Simon <doug.simon@oracle.com>
parents: 5103
diff changeset
454 decl = 'const char* graal_projects[] = {'
cfdb3c24bd6c changed Graal class path declaration (back) to a constant that is checked for correctness during building
Doug Simon <doug.simon@oracle.com>
parents: 5103
diff changeset
455 start = source.find(decl)
cfdb3c24bd6c changed Graal class path declaration (back) to a constant that is checked for correctness during building
Doug Simon <doug.simon@oracle.com>
parents: 5103
diff changeset
456 assert start != -1, 'Could not find "' + decl + '" in ' + fp.name
cfdb3c24bd6c changed Graal class path declaration (back) to a constant that is checked for correctness during building
Doug Simon <doug.simon@oracle.com>
parents: 5103
diff changeset
457 end = source.find('};', start)
cfdb3c24bd6c changed Graal class path declaration (back) to a constant that is checked for correctness during building
Doug Simon <doug.simon@oracle.com>
parents: 5103
diff changeset
458 assert end != -1, 'Could not find "' + decl + '" ... "};" in ' + fp.name
cfdb3c24bd6c changed Graal class path declaration (back) to a constant that is checked for correctness during building
Doug Simon <doug.simon@oracle.com>
parents: 5103
diff changeset
459 actual = frozenset([a.strip().strip('"') for a in source[start + len(decl):end].split(',')])
cfdb3c24bd6c changed Graal class path declaration (back) to a constant that is checked for correctness during building
Doug Simon <doug.simon@oracle.com>
parents: 5103
diff changeset
460 expected = frozenset([p.name for p in mx.project('com.oracle.graal.hotspot').all_deps([], False)])
cfdb3c24bd6c changed Graal class path declaration (back) to a constant that is checked for correctness during building
Doug Simon <doug.simon@oracle.com>
parents: 5103
diff changeset
461 missing = expected - actual
cfdb3c24bd6c changed Graal class path declaration (back) to a constant that is checked for correctness during building
Doug Simon <doug.simon@oracle.com>
parents: 5103
diff changeset
462 extra = actual - expected
cfdb3c24bd6c changed Graal class path declaration (back) to a constant that is checked for correctness during building
Doug Simon <doug.simon@oracle.com>
parents: 5103
diff changeset
463 if len(missing) != 0:
5153
57546200db29 fixed comment and error message in commands.py
Doug Simon <doug.simon@oracle.com>
parents: 5152
diff changeset
464 mx.abort(fp.name + ':' + str(source[:start].count('\n') + 1) + ': add missing projects to declaration:\n ' + '\n '.join(missing))
5152
cfdb3c24bd6c changed Graal class path declaration (back) to a constant that is checked for correctness during building
Doug Simon <doug.simon@oracle.com>
parents: 5103
diff changeset
465 if len(extra) != 0:
5153
57546200db29 fixed comment and error message in commands.py
Doug Simon <doug.simon@oracle.com>
parents: 5152
diff changeset
466 mx.abort(fp.name + ':' + str(source[:start].count('\n') + 1) + ': remove projects from declaration:\n ' + '\n '.join(extra))
5239
b9db4fee6eb2 skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents: 5234
diff changeset
467
b9db4fee6eb2 skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents: 5234
diff changeset
468 # Check if a build really needs to be done
b9db4fee6eb2 skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents: 5234
diff changeset
469 timestampFile = join(vmDir, '.build-timestamp')
b9db4fee6eb2 skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents: 5234
diff changeset
470 if opts2.force or not exists(timestampFile):
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
471 mustBuild = True
5239
b9db4fee6eb2 skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents: 5234
diff changeset
472 else:
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
473 mustBuild = False
5239
b9db4fee6eb2 skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents: 5234
diff changeset
474 timestamp = os.path.getmtime(timestampFile)
b9db4fee6eb2 skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents: 5234
diff changeset
475 sources = []
b9db4fee6eb2 skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents: 5234
diff changeset
476 for d in ['src', 'make']:
5244
55ff4ba8d7b1 ignore src/share/tools directory in native build out-of-date check
Doug Simon <doug.simon@oracle.com>
parents: 5239
diff changeset
477 for root, dirnames, files in os.walk(join(_graal_home, d)):
5239
b9db4fee6eb2 skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents: 5234
diff changeset
478 # ignore <graal>/src/share/tools
5244
55ff4ba8d7b1 ignore src/share/tools directory in native build out-of-date check
Doug Simon <doug.simon@oracle.com>
parents: 5239
diff changeset
479 if root == join(_graal_home, 'src', 'share'):
55ff4ba8d7b1 ignore src/share/tools directory in native build out-of-date check
Doug Simon <doug.simon@oracle.com>
parents: 5239
diff changeset
480 dirnames.remove('tools')
55ff4ba8d7b1 ignore src/share/tools directory in native build out-of-date check
Doug Simon <doug.simon@oracle.com>
parents: 5239
diff changeset
481 sources += [join(root, name) for name in files]
5239
b9db4fee6eb2 skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents: 5234
diff changeset
482 for f in sources:
b9db4fee6eb2 skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents: 5234
diff changeset
483 if len(f) != 0 and os.path.getmtime(f) > timestamp:
b9db4fee6eb2 skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents: 5234
diff changeset
484 mustBuild = True
5244
55ff4ba8d7b1 ignore src/share/tools directory in native build out-of-date check
Doug Simon <doug.simon@oracle.com>
parents: 5239
diff changeset
485 break
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
486
5239
b9db4fee6eb2 skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents: 5234
diff changeset
487 if not mustBuild:
b9db4fee6eb2 skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents: 5234
diff changeset
488 mx.log('[all files in src and make directories are older than ' + timestampFile[len(_graal_home) + 1:] + ' - skipping native build]')
b9db4fee6eb2 skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents: 5234
diff changeset
489 continue
b9db4fee6eb2 skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents: 5234
diff changeset
490
4234
057620486c90 Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents: 4230
diff changeset
491 if platform.system() == 'Windows':
057620486c90 Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents: 4230
diff changeset
492 compilelogfile = _graal_home + '/graalCompile.log'
4252
67e88b7624d5 Removed need for GRAAL environment variable on Windows.
Doug Simon <doug.simon@oracle.com>
parents: 4247
diff changeset
493 mksHome = mx.get_env('MKS_HOME', 'C:\\cygwin\\bin')
67e88b7624d5 Removed need for GRAAL environment variable on Windows.
Doug Simon <doug.simon@oracle.com>
parents: 4247
diff changeset
494
4572
76841bdd5f3e (Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents: 4559
diff changeset
495 variant = {'client': 'compiler1', 'server': 'compiler2'}.get(vm, vm)
76841bdd5f3e (Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents: 4559
diff changeset
496 project_config = variant + '_' + build
76841bdd5f3e (Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents: 4559
diff changeset
497 _runInDebugShell('msbuild ' + _graal_home + r'\build\vs-amd64\jvm.vcproj /p:Configuration=' + project_config + ' /target:clean', _graal_home)
76841bdd5f3e (Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents: 4559
diff changeset
498 winCompileCmd = r'set HotSpotMksHome=' + mksHome + r'& set OUT_DIR=' + jdk + r'& set JAVA_HOME=' + jdk + r'& set path=%JAVA_HOME%\bin;%path%;%HotSpotMksHome%& cd /D "' +_graal_home + r'\make\windows"& call create.bat ' + _graal_home
4234
057620486c90 Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents: 4230
diff changeset
499 print(winCompileCmd)
057620486c90 Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents: 4230
diff changeset
500 winCompileSuccess = re.compile(r"^Writing \.vcxproj file:")
057620486c90 Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents: 4230
diff changeset
501 if not _runInDebugShell(winCompileCmd, _graal_home, compilelogfile, winCompileSuccess):
057620486c90 Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents: 4230
diff changeset
502 mx.log('Error executing create command')
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
503 return
4572
76841bdd5f3e (Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents: 4559
diff changeset
504 winBuildCmd = 'msbuild ' + _graal_home + r'\build\vs-amd64\jvm.vcxproj /p:Configuration=' + project_config + ' /p:Platform=x64'
5680
87fc13b59258 Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5649
diff changeset
505 if not _runInDebugShell(winBuildCmd, _graal_home, compilelogfile):
4234
057620486c90 Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents: 4230
diff changeset
506 mx.log('Error building project')
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
507 return
4234
057620486c90 Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents: 4230
diff changeset
508 else:
4582
b24386206122 Made all vm builds go into subdirectories, even product builds to simplify building the various types of VMs (server, client and graal).
Doug Simon <doug.simon@oracle.com>
parents: 4577
diff changeset
509 cpus = multiprocessing.cpu_count()
4572
76841bdd5f3e (Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents: 4559
diff changeset
510 if build == 'debug':
76841bdd5f3e (Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents: 4559
diff changeset
511 build = 'jvmg'
4234
057620486c90 Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents: 4230
diff changeset
512 env = os.environ
057620486c90 Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents: 4230
diff changeset
513 env.setdefault('ARCH_DATA_MODEL', '64')
057620486c90 Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents: 4230
diff changeset
514 env.setdefault('LANG', 'C')
4582
b24386206122 Made all vm builds go into subdirectories, even product builds to simplify building the various types of VMs (server, client and graal).
Doug Simon <doug.simon@oracle.com>
parents: 4577
diff changeset
515 env.setdefault('HOTSPOT_BUILD_JOBS', str(cpus))
4294
600cbdce9805 force ALT_BOOTDIR to the proper jdk to avoid installing non-product builds into the product build
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4293
diff changeset
516 env['ALT_BOOTDIR'] = jdk
4234
057620486c90 Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents: 4230
diff changeset
517 env.setdefault('INSTALL', 'y')
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
518
4582
b24386206122 Made all vm builds go into subdirectories, even product builds to simplify building the various types of VMs (server, client and graal).
Doug Simon <doug.simon@oracle.com>
parents: 4577
diff changeset
519 # Clear these 2 variables as having them set can cause very confusing build problems
b24386206122 Made all vm builds go into subdirectories, even product builds to simplify building the various types of VMs (server, client and graal).
Doug Simon <doug.simon@oracle.com>
parents: 4577
diff changeset
520 env.pop('LD_LIBRARY_PATH', None)
b24386206122 Made all vm builds go into subdirectories, even product builds to simplify building the various types of VMs (server, client and graal).
Doug Simon <doug.simon@oracle.com>
parents: 4577
diff changeset
521 env.pop('CLASSPATH', None)
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
522
4417
648a7873cea2 Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents: 4407
diff changeset
523 mx.run([mx.gmake_cmd(), build + buildSuffix], cwd=join(_graal_home, 'make'), err=filterXusage)
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
524
5680
87fc13b59258 Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5649
diff changeset
525 jvmCfg = _vmCfgInJdk(jdk)
4559
723df37192d6 Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4540
diff changeset
526 found = False
723df37192d6 Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4540
diff changeset
527 if not exists(jvmCfg):
723df37192d6 Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4540
diff changeset
528 mx.abort(jvmCfg + ' does not exist')
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
529
4559
723df37192d6 Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4540
diff changeset
530 prefix = '-' + vm
723df37192d6 Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4540
diff changeset
531 vmKnown = prefix + ' KNOWN\n'
723df37192d6 Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4540
diff changeset
532 lines = []
723df37192d6 Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4540
diff changeset
533 with open(jvmCfg) as f:
723df37192d6 Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4540
diff changeset
534 for line in f:
723df37192d6 Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4540
diff changeset
535 if vmKnown in line:
723df37192d6 Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4540
diff changeset
536 found = True
723df37192d6 Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4540
diff changeset
537 break
723df37192d6 Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4540
diff changeset
538 if not line.startswith(prefix):
723df37192d6 Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4540
diff changeset
539 lines.append(line)
723df37192d6 Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4540
diff changeset
540 if not found:
723df37192d6 Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4540
diff changeset
541 mx.log('Appending "' + prefix + ' KNOWN" to ' + jvmCfg)
723df37192d6 Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4540
diff changeset
542 lines.append(vmKnown)
723df37192d6 Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4540
diff changeset
543 with open(jvmCfg, 'w') as f:
723df37192d6 Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4540
diff changeset
544 for line in lines:
723df37192d6 Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4540
diff changeset
545 f.write(line)
5194
a6eceb5efb0e added --ecl option to mx for saving VM execution(s) as Eclipse launch configurations
Doug Simon <doug.simon@oracle.com>
parents: 5189
diff changeset
546
5239
b9db4fee6eb2 skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents: 5234
diff changeset
547 if exists(timestampFile):
b9db4fee6eb2 skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents: 5234
diff changeset
548 os.utime(timestampFile, None)
b9db4fee6eb2 skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents: 5234
diff changeset
549 else:
b9db4fee6eb2 skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents: 5234
diff changeset
550 file(timestampFile, 'a')
b9db4fee6eb2 skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents: 5234
diff changeset
551
5257
a549662f6c6f added 'vmg' and 'vmfg' commands to mx as convenient aliases for running the debug and fastdebug builds of the selected VM
Doug Simon <doug.simon@oracle.com>
parents: 5245
diff changeset
552 def vmg(args):
a549662f6c6f added 'vmg' and 'vmfg' commands to mx as convenient aliases for running the debug and fastdebug builds of the selected VM
Doug Simon <doug.simon@oracle.com>
parents: 5245
diff changeset
553 """run the debug build of VM selected by the '--vm' option"""
a549662f6c6f added 'vmg' and 'vmfg' commands to mx as convenient aliases for running the debug and fastdebug builds of the selected VM
Doug Simon <doug.simon@oracle.com>
parents: 5245
diff changeset
554 return vm(args, vmbuild='debug')
a549662f6c6f added 'vmg' and 'vmfg' commands to mx as convenient aliases for running the debug and fastdebug builds of the selected VM
Doug Simon <doug.simon@oracle.com>
parents: 5245
diff changeset
555
a549662f6c6f added 'vmg' and 'vmfg' commands to mx as convenient aliases for running the debug and fastdebug builds of the selected VM
Doug Simon <doug.simon@oracle.com>
parents: 5245
diff changeset
556 def vmfg(args):
a549662f6c6f added 'vmg' and 'vmfg' commands to mx as convenient aliases for running the debug and fastdebug builds of the selected VM
Doug Simon <doug.simon@oracle.com>
parents: 5245
diff changeset
557 """run the fastdebug build of VM selected by the '--vm' option"""
a549662f6c6f added 'vmg' and 'vmfg' commands to mx as convenient aliases for running the debug and fastdebug builds of the selected VM
Doug Simon <doug.simon@oracle.com>
parents: 5245
diff changeset
558 return vm(args, vmbuild='fastdebug')
a549662f6c6f added 'vmg' and 'vmfg' commands to mx as convenient aliases for running the debug and fastdebug builds of the selected VM
Doug Simon <doug.simon@oracle.com>
parents: 5245
diff changeset
559
4417
648a7873cea2 Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents: 4407
diff changeset
560 def vm(args, vm=None, nonZeroIsFatal=True, out=None, err=None, cwd=None, timeout=None, vmbuild=None):
4575
ccb5369481a2 Clarified mx help text on how to build/run [Graal|Client|Server].
Doug Simon <doug.simon@oracle.com>
parents: 4572
diff changeset
561 """run the VM selected by the '--vm' option"""
4219
47f7d91d34cf Fix javac build issues with classpath
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4216
diff changeset
562
4417
648a7873cea2 Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents: 4407
diff changeset
563 if vm is None:
648a7873cea2 Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents: 4407
diff changeset
564 vm = _vm
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
565
4219
47f7d91d34cf Fix javac build issues with classpath
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4216
diff changeset
566 build = vmbuild if vmbuild is not None else _vmbuild if _vmSourcesAvailable else 'product'
5596
e4b1bc5e29e0 hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents: 5517
diff changeset
567 jdk = _jdk(build)
5189
6fbf12b8e572 automated download of hsdis lib if PrintAssembly option is used; added support for hsdis on the Mac
Doug Simon <doug.simon@oracle.com>
parents: 5153
diff changeset
568 mx.expand_project_in_args(args)
5194
a6eceb5efb0e added --ecl option to mx for saving VM execution(s) as Eclipse launch configurations
Doug Simon <doug.simon@oracle.com>
parents: 5189
diff changeset
569 if _make_eclipse_launch:
a6eceb5efb0e added --ecl option to mx for saving VM execution(s) as Eclipse launch configurations
Doug Simon <doug.simon@oracle.com>
parents: 5189
diff changeset
570 mx.make_eclipse_launch(args, 'graal-' + build, name=None, deps=mx.project('com.oracle.graal.hotspot').all_deps([], True))
5189
6fbf12b8e572 automated download of hsdis lib if PrintAssembly option is used; added support for hsdis on the Mac
Doug Simon <doug.simon@oracle.com>
parents: 5153
diff changeset
571 if len([a for a in args if 'PrintAssembly' in a]) != 0:
5596
e4b1bc5e29e0 hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents: 5517
diff changeset
572 hsdis([], copyToDir=_vmLibDirInJdk(jdk))
5032
e2de9649f0a9 Integrated mxtool updates from Maxine project.
Doug Simon <doug.simon@oracle.com>
parents: 5024
diff changeset
573 if mx.java().debug_port is not None:
e2de9649f0a9 Integrated mxtool updates from Maxine project.
Doug Simon <doug.simon@oracle.com>
parents: 5024
diff changeset
574 args = ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=' + str(mx.java().debug_port)] + args
5024
7ccdae96e98a Allow JaCoCon to append to the execution file
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5016
diff changeset
575 if _jacoco == 'on' or _jacoco == 'append':
4684
e136f2d0d002 Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4660
diff changeset
576 jacocoagent = mx.library("JACOCOAGENT", True)
5366
67e63e8dcbd2 build JaCoCo exclude list by scanning for snippets
Doug Simon <doug.simon@oracle.com>
parents: 5295
diff changeset
577 # Exclude all compiler tests and snippets
67e63e8dcbd2 build JaCoCo exclude list by scanning for snippets
Doug Simon <doug.simon@oracle.com>
parents: 5295
diff changeset
578 excludes = ['com.oracle.graal.compiler.tests.*']
67e63e8dcbd2 build JaCoCo exclude list by scanning for snippets
Doug Simon <doug.simon@oracle.com>
parents: 5295
diff changeset
579 for p in mx.projects():
5762
b30cced39597 generalized functionality for finding classes based on searching for patterns in source code and moved it from commands.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents: 5729
diff changeset
580 excludes += _find_classes_with_annotations(p, None, ['@Snippet', '@ClassSubstitution'], includeInnerClasses=True)
b30cced39597 generalized functionality for finding classes based on searching for patterns in source code and moved it from commands.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents: 5729
diff changeset
581 excludes += p.find_classes_with_matching_source_line(None, lambda line: 'JaCoCo Exclude' in line, includeInnerClasses=True)
b30cced39597 generalized functionality for finding classes based on searching for patterns in source code and moved it from commands.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents: 5729
diff changeset
582
4684
e136f2d0d002 Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4660
diff changeset
583 agentOptions = {
5024
7ccdae96e98a Allow JaCoCon to append to the execution file
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5016
diff changeset
584 'append' : 'true' if _jacoco == 'append' else 'false',
4684
e136f2d0d002 Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4660
diff changeset
585 'bootclasspath' : 'true',
5064
8a88c903e381 Updated mx commands.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5047
diff changeset
586 'includes' : 'com.oracle.*',
5366
67e63e8dcbd2 build JaCoCo exclude list by scanning for snippets
Doug Simon <doug.simon@oracle.com>
parents: 5295
diff changeset
587 'excludes' : ':'.join(excludes)
4684
e136f2d0d002 Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4660
diff changeset
588 }
e136f2d0d002 Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4660
diff changeset
589 args = ['-javaagent:' + jacocoagent.get_path(True) + '=' + ','.join([k + '=' + v for k, v in agentOptions.items()])] + args
5596
e4b1bc5e29e0 hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents: 5517
diff changeset
590 exe = join(jdk, 'bin', mx.exe_suffix('java'))
4417
648a7873cea2 Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents: 4407
diff changeset
591 return mx.run([exe, '-' + vm] + args, nonZeroIsFatal=nonZeroIsFatal, out=out, err=err, cwd=cwd, timeout=timeout)
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
592
5762
b30cced39597 generalized functionality for finding classes based on searching for patterns in source code and moved it from commands.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents: 5729
diff changeset
593 def _find_classes_with_annotations(p, pkgRoot, annotations, includeInnerClasses=False):
5366
67e63e8dcbd2 build JaCoCo exclude list by scanning for snippets
Doug Simon <doug.simon@oracle.com>
parents: 5295
diff changeset
594 """
5482
9f4783c0269e folded -G:+CheckcastCounters functionality into checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents: 5438
diff changeset
595 Scan the sources of project 'p' for Java source files containing a line starting with 'annotation'
5762
b30cced39597 generalized functionality for finding classes based on searching for patterns in source code and moved it from commands.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents: 5729
diff changeset
596 (ignoring preceding whitespace) and return the fully qualified class name for each Java
b30cced39597 generalized functionality for finding classes based on searching for patterns in source code and moved it from commands.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents: 5729
diff changeset
597 source file matched in a list.
5366
67e63e8dcbd2 build JaCoCo exclude list by scanning for snippets
Doug Simon <doug.simon@oracle.com>
parents: 5295
diff changeset
598 """
5762
b30cced39597 generalized functionality for finding classes based on searching for patterns in source code and moved it from commands.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents: 5729
diff changeset
599
b30cced39597 generalized functionality for finding classes based on searching for patterns in source code and moved it from commands.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents: 5729
diff changeset
600 matches = lambda line : len([a for a in annotations if line == a or line.startswith(a + '(')]) != 0
b30cced39597 generalized functionality for finding classes based on searching for patterns in source code and moved it from commands.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents: 5729
diff changeset
601 return p.find_classes_with_matching_source_line(pkgRoot, matches, includeInnerClasses)
5366
67e63e8dcbd2 build JaCoCo exclude list by scanning for snippets
Doug Simon <doug.simon@oracle.com>
parents: 5295
diff changeset
602
5649
14505f3e6b4c modified harness for running JUnit and JTT tests such that only projects declaring a 'testHarness' attribute in mx/projects are scanned for tests
Doug Simon <doug.simon@oracle.com>
parents: 5596
diff changeset
603 def _run_tests(args, harnessName, harness):
4630
ef0ff914c10f Make it possible to pass jvm args in jtt and unittest
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4602
diff changeset
604 pos = [a for a in args if a[0] != '-' and a[0] != '@' ]
4159
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
605 neg = [a[1:] for a in args if a[0] == '-']
4630
ef0ff914c10f Make it possible to pass jvm args in jtt and unittest
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4602
diff changeset
606 vmArgs = [a[1:] for a in args if a[0] == '@']
4159
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
607
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
608 def containsAny(c, substrings):
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
609 for s in substrings:
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
610 if s in c:
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
611 return True
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
612 return False
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
613
5649
14505f3e6b4c modified harness for running JUnit and JTT tests such that only projects declaring a 'testHarness' attribute in mx/projects are scanned for tests
Doug Simon <doug.simon@oracle.com>
parents: 5596
diff changeset
614 for p in mx.projects():
14505f3e6b4c modified harness for running JUnit and JTT tests such that only projects declaring a 'testHarness' attribute in mx/projects are scanned for tests
Doug Simon <doug.simon@oracle.com>
parents: 5596
diff changeset
615 if getattr(p, 'testHarness', None) == harnessName:
5762
b30cced39597 generalized functionality for finding classes based on searching for patterns in source code and moved it from commands.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents: 5729
diff changeset
616 classes = _find_classes_with_annotations(p, None, ['@Test'])
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
617
5649
14505f3e6b4c modified harness for running JUnit and JTT tests such that only projects declaring a 'testHarness' attribute in mx/projects are scanned for tests
Doug Simon <doug.simon@oracle.com>
parents: 5596
diff changeset
618 if len(pos) != 0:
14505f3e6b4c modified harness for running JUnit and JTT tests such that only projects declaring a 'testHarness' attribute in mx/projects are scanned for tests
Doug Simon <doug.simon@oracle.com>
parents: 5596
diff changeset
619 classes = [c for c in classes if containsAny(c, pos)]
14505f3e6b4c modified harness for running JUnit and JTT tests such that only projects declaring a 'testHarness' attribute in mx/projects are scanned for tests
Doug Simon <doug.simon@oracle.com>
parents: 5596
diff changeset
620 if len(neg) != 0:
14505f3e6b4c modified harness for running JUnit and JTT tests such that only projects declaring a 'testHarness' attribute in mx/projects are scanned for tests
Doug Simon <doug.simon@oracle.com>
parents: 5596
diff changeset
621 classes = [c for c in classes if not containsAny(c, neg)]
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
622
5649
14505f3e6b4c modified harness for running JUnit and JTT tests such that only projects declaring a 'testHarness' attribute in mx/projects are scanned for tests
Doug Simon <doug.simon@oracle.com>
parents: 5596
diff changeset
623 if len(classes) != 0:
14505f3e6b4c modified harness for running JUnit and JTT tests such that only projects declaring a 'testHarness' attribute in mx/projects are scanned for tests
Doug Simon <doug.simon@oracle.com>
parents: 5596
diff changeset
624 mx.log('running tests in ' + p.name)
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
625 harness(p, vmArgs, classes)
5649
14505f3e6b4c modified harness for running JUnit and JTT tests such that only projects declaring a 'testHarness' attribute in mx/projects are scanned for tests
Doug Simon <doug.simon@oracle.com>
parents: 5596
diff changeset
626
14505f3e6b4c modified harness for running JUnit and JTT tests such that only projects declaring a 'testHarness' attribute in mx/projects are scanned for tests
Doug Simon <doug.simon@oracle.com>
parents: 5596
diff changeset
627 def unittest(args):
14505f3e6b4c modified harness for running JUnit and JTT tests such that only projects declaring a 'testHarness' attribute in mx/projects are scanned for tests
Doug Simon <doug.simon@oracle.com>
parents: 5596
diff changeset
628 """run the Graal Compiler Unit Tests in the GraalVM
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
629
5649
14505f3e6b4c modified harness for running JUnit and JTT tests such that only projects declaring a 'testHarness' attribute in mx/projects are scanned for tests
Doug Simon <doug.simon@oracle.com>
parents: 5596
diff changeset
630 If filters are supplied, only tests whose fully qualified name
14505f3e6b4c modified harness for running JUnit and JTT tests such that only projects declaring a 'testHarness' attribute in mx/projects are scanned for tests
Doug Simon <doug.simon@oracle.com>
parents: 5596
diff changeset
631 include a filter as a substring are run. Negative filters are
14505f3e6b4c modified harness for running JUnit and JTT tests such that only projects declaring a 'testHarness' attribute in mx/projects are scanned for tests
Doug Simon <doug.simon@oracle.com>
parents: 5596
diff changeset
632 those with a '-' prefix. VM args should have a @ prefix."""
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
633
5649
14505f3e6b4c modified harness for running JUnit and JTT tests such that only projects declaring a 'testHarness' attribute in mx/projects are scanned for tests
Doug Simon <doug.simon@oracle.com>
parents: 5596
diff changeset
634 def harness(p, vmArgs, classes):
14505f3e6b4c modified harness for running JUnit and JTT tests such that only projects declaring a 'testHarness' attribute in mx/projects are scanned for tests
Doug Simon <doug.simon@oracle.com>
parents: 5596
diff changeset
635 vm(['-XX:-BootstrapGraal', '-esa'] + vmArgs + ['-cp', mx.classpath(p.name), 'org.junit.runner.JUnitCore'] + classes)
14505f3e6b4c modified harness for running JUnit and JTT tests such that only projects declaring a 'testHarness' attribute in mx/projects are scanned for tests
Doug Simon <doug.simon@oracle.com>
parents: 5596
diff changeset
636 _run_tests(args, 'unittest', harness)
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
637
4587
5b04b33dac74 add jtt tests, converted from the maxine repository using ConvertJTT
Lukas Stadler <lukas.stadler@jku.at>
parents: 4584
diff changeset
638 def jtt(args):
5b04b33dac74 add jtt tests, converted from the maxine repository using ConvertJTT
Lukas Stadler <lukas.stadler@jku.at>
parents: 4584
diff changeset
639 """run the Java Tester Tests in the GraalVM
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
640
4587
5b04b33dac74 add jtt tests, converted from the maxine repository using ConvertJTT
Lukas Stadler <lukas.stadler@jku.at>
parents: 4584
diff changeset
641 If filters are supplied, only tests whose fully qualified name
5b04b33dac74 add jtt tests, converted from the maxine repository using ConvertJTT
Lukas Stadler <lukas.stadler@jku.at>
parents: 4584
diff changeset
642 include a filter as a substring are run. Negative filters are
4630
ef0ff914c10f Make it possible to pass jvm args in jtt and unittest
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4602
diff changeset
643 those with a '-' prefix. VM args should have a @ prefix."""
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
644
5649
14505f3e6b4c modified harness for running JUnit and JTT tests such that only projects declaring a 'testHarness' attribute in mx/projects are scanned for tests
Doug Simon <doug.simon@oracle.com>
parents: 5596
diff changeset
645 def harness(p, vmArgs, classes):
14505f3e6b4c modified harness for running JUnit and JTT tests such that only projects declaring a 'testHarness' attribute in mx/projects are scanned for tests
Doug Simon <doug.simon@oracle.com>
parents: 5596
diff changeset
646 vm(['-XX:-BootstrapGraal', '-XX:CompileOnly=com/oracle/graal/jtt', '-XX:CompileCommand=compileonly,java/lang/Object::<init>', '-XX:CompileCommand=quiet', '-Xcomp', '-esa'] + vmArgs + ['-cp', mx.classpath(p.name), 'org.junit.runner.JUnitCore'] + classes)
14505f3e6b4c modified harness for running JUnit and JTT tests such that only projects declaring a 'testHarness' attribute in mx/projects are scanned for tests
Doug Simon <doug.simon@oracle.com>
parents: 5596
diff changeset
647 _run_tests(args, 'jtt', harness)
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
648
4584
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
649 def buildvms(args):
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
650 """build one or more VMs in various configurations"""
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
651
4584
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
652 parser = ArgumentParser(prog='mx buildvms');
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
653 parser.add_argument('--vms', help='a comma separated list of VMs to build (default: server,client,graal)', default='server,client,graal')
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
654 parser.add_argument('--builds', help='a comma separated list of build types (default: product,fastdebug,debug)', default='product,fastdebug,debug')
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
655
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
656 args = parser.parse_args(args)
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
657 vms = args.vms.split(',')
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
658 builds = args.builds.split(',')
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
659
4584
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
660 allStart = time.time()
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
661 for v in vms:
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
662 for vmbuild in builds:
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
663 logFile = join(v + '-' + vmbuild + '.log')
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
664 log = open(join(_graal_home, logFile), 'wb')
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
665 start = time.time()
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
666 mx.log('BEGIN: ' + v + '-' + vmbuild + '\t(see: ' + logFile + ')')
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
667 # Run as subprocess so that output can be directed to a file
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
668 subprocess.check_call([sys.executable, '-u', join('mxtool', 'mx.py'), '--vm', v, 'build', vmbuild], cwd=_graal_home, stdout=log, stderr=subprocess.STDOUT)
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
669 duration = datetime.timedelta(seconds=time.time() - start)
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
670 mx.log('END: ' + v + '-' + vmbuild + '\t[' + str(duration) + ']')
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
671 allDuration = datetime.timedelta(seconds=time.time() - allStart)
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
672 mx.log('TOTAL TIME: ' + '[' + str(allDuration) + ']')
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
673
4159
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
674 def gate(args):
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
675 """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
676
4438
0312460af9fc Made gate do a full clean and added timing report for all gate tasks to end of gate log.
Doug Simon <doug.simon@oracle.com>
parents: 4417
diff changeset
677 If this command exits with a 0 exit code, then the source code is in
4159
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
678 a state that would be accepted for integration into the main repository."""
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
679
4234
057620486c90 Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents: 4230
diff changeset
680 class Task:
057620486c90 Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents: 4230
diff changeset
681 def __init__(self, title):
057620486c90 Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents: 4230
diff changeset
682 self.start = time.time()
057620486c90 Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents: 4230
diff changeset
683 self.title = title
4438
0312460af9fc Made gate do a full clean and added timing report for all gate tasks to end of gate log.
Doug Simon <doug.simon@oracle.com>
parents: 4417
diff changeset
684 self.end = None
0312460af9fc Made gate do a full clean and added timing report for all gate tasks to end of gate log.
Doug Simon <doug.simon@oracle.com>
parents: 4417
diff changeset
685 self.duration = None
4234
057620486c90 Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents: 4230
diff changeset
686 mx.log(time.strftime('gate: %d %b %Y %H:%M:%S: BEGIN: ') + title)
057620486c90 Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents: 4230
diff changeset
687 def stop(self):
4438
0312460af9fc Made gate do a full clean and added timing report for all gate tasks to end of gate log.
Doug Simon <doug.simon@oracle.com>
parents: 4417
diff changeset
688 self.end = time.time()
0312460af9fc Made gate do a full clean and added timing report for all gate tasks to end of gate log.
Doug Simon <doug.simon@oracle.com>
parents: 4417
diff changeset
689 self.duration = datetime.timedelta(seconds=self.end - self.start)
0312460af9fc Made gate do a full clean and added timing report for all gate tasks to end of gate log.
Doug Simon <doug.simon@oracle.com>
parents: 4417
diff changeset
690 mx.log(time.strftime('gate: %d %b %Y %H:%M:%S: END: ') + self.title + ' [' + str(self.duration) + ']')
0312460af9fc Made gate do a full clean and added timing report for all gate tasks to end of gate log.
Doug Simon <doug.simon@oracle.com>
parents: 4417
diff changeset
691 return self
4234
057620486c90 Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents: 4230
diff changeset
692 def abort(self, codeOrMessage):
4438
0312460af9fc Made gate do a full clean and added timing report for all gate tasks to end of gate log.
Doug Simon <doug.simon@oracle.com>
parents: 4417
diff changeset
693 self.end = time.time()
0312460af9fc Made gate do a full clean and added timing report for all gate tasks to end of gate log.
Doug Simon <doug.simon@oracle.com>
parents: 4417
diff changeset
694 self.duration = datetime.timedelta(seconds=self.end - self.start)
0312460af9fc Made gate do a full clean and added timing report for all gate tasks to end of gate log.
Doug Simon <doug.simon@oracle.com>
parents: 4417
diff changeset
695 mx.log(time.strftime('gate: %d %b %Y %H:%M:%S: ABORT: ') + self.title + ' [' + str(self.duration) + ']')
4234
057620486c90 Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents: 4230
diff changeset
696 mx.abort(codeOrMessage)
4438
0312460af9fc Made gate do a full clean and added timing report for all gate tasks to end of gate log.
Doug Simon <doug.simon@oracle.com>
parents: 4417
diff changeset
697 return self
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
698
4601
ade18666f2be Added --omit-native-build to gate command so that native cleaning and building can be omitted for changesets that made no changes to the C/C++ code.
Doug Simon <doug.simon@oracle.com>
parents: 4584
diff changeset
699 parser = ArgumentParser(prog='mx gate');
5232
c005ca943790 added -j option to gate command to disable cleaning of Java class files
Doug Simon <doug.simon@oracle.com>
parents: 5197
diff changeset
700 parser.add_argument('-j', '--omit-java-clean', action='store_false', dest='cleanJava', help='omit cleaning Java native code')
5750
30876d0bb92d In gate command, allways build natives, use '-n' to avoid cleaning them only
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5729
diff changeset
701 parser.add_argument('-n', '--omit-native-clean', action='store_false', dest='cleanNative', help='omit cleaning and building native code')
4608
05a33fabcfe6 Added -g option to 'mx gate' to omit the server and client builds (i.e. -g == graal only).
Doug Simon <doug.simon@oracle.com>
parents: 4607
diff changeset
702 parser.add_argument('-g', '--only-build-graalvm', action='store_false', dest='buildNonGraal', help='only build the Graal VM')
5033
d7ecce178ad2 Add jacoco report and a -XX:+DeoptimizeALot -XX:+VerifyOops bootstrap run to the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5032
diff changeset
703 parser.add_argument('--jacocout', help='specify the output directory for jacoco report')
4601
ade18666f2be Added --omit-native-build to gate command so that native cleaning and building can be omitted for changesets that made no changes to the C/C++ code.
Doug Simon <doug.simon@oracle.com>
parents: 4584
diff changeset
704
ade18666f2be Added --omit-native-build to gate command so that native cleaning and building can be omitted for changesets that made no changes to the C/C++ code.
Doug Simon <doug.simon@oracle.com>
parents: 4584
diff changeset
705 args = parser.parse_args(args)
ade18666f2be Added --omit-native-build to gate command so that native cleaning and building can be omitted for changesets that made no changes to the C/C++ code.
Doug Simon <doug.simon@oracle.com>
parents: 4584
diff changeset
706
5431
0bd1ba69db2a removed double declaration of _vmbuild global variable in gate command
Doug Simon <doug.simon@oracle.com>
parents: 5430
diff changeset
707 global _vmbuild
0bd1ba69db2a removed double declaration of _vmbuild global variable in gate command
Doug Simon <doug.simon@oracle.com>
parents: 5430
diff changeset
708 global _vm
0bd1ba69db2a removed double declaration of _vmbuild global variable in gate command
Doug Simon <doug.simon@oracle.com>
parents: 5430
diff changeset
709 global _jacoco
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
710
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
711 tasks = []
4234
057620486c90 Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents: 4230
diff changeset
712 total = Task('Gate')
057620486c90 Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents: 4230
diff changeset
713 try:
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
714
4438
0312460af9fc Made gate do a full clean and added timing report for all gate tasks to end of gate log.
Doug Simon <doug.simon@oracle.com>
parents: 4417
diff changeset
715 t = Task('Clean')
5232
c005ca943790 added -j option to gate command to disable cleaning of Java class files
Doug Simon <doug.simon@oracle.com>
parents: 5197
diff changeset
716 cleanArgs = []
5750
30876d0bb92d In gate command, allways build natives, use '-n' to avoid cleaning them only
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5729
diff changeset
717 if not args.cleanNative:
5232
c005ca943790 added -j option to gate command to disable cleaning of Java class files
Doug Simon <doug.simon@oracle.com>
parents: 5197
diff changeset
718 cleanArgs.append('--no-native')
c005ca943790 added -j option to gate command to disable cleaning of Java class files
Doug Simon <doug.simon@oracle.com>
parents: 5197
diff changeset
719 if not args.cleanJava:
c005ca943790 added -j option to gate command to disable cleaning of Java class files
Doug Simon <doug.simon@oracle.com>
parents: 5197
diff changeset
720 cleanArgs.append('--no-java')
c005ca943790 added -j option to gate command to disable cleaning of Java class files
Doug Simon <doug.simon@oracle.com>
parents: 5197
diff changeset
721 clean(cleanArgs)
4438
0312460af9fc Made gate do a full clean and added timing report for all gate tasks to end of gate log.
Doug Simon <doug.simon@oracle.com>
parents: 4417
diff changeset
722 tasks.append(t.stop())
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
723
4234
057620486c90 Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents: 4230
diff changeset
724 t = Task('BuildJava')
057620486c90 Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents: 4230
diff changeset
725 build(['--no-native'])
4438
0312460af9fc Made gate do a full clean and added timing report for all gate tasks to end of gate log.
Doug Simon <doug.simon@oracle.com>
parents: 4417
diff changeset
726 tasks.append(t.stop())
4483
58ecb156a3e8 Gate : run fastdebug configuration before product in order to get a better log if the gate fails
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4482
diff changeset
727 for vmbuild in ['fastdebug', 'product']:
4234
057620486c90 Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents: 4230
diff changeset
728 _vmbuild = vmbuild
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
729
5750
30876d0bb92d In gate command, allways build natives, use '-n' to avoid cleaning them only
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5729
diff changeset
730 t = Task('BuildHotSpotGraal:' + vmbuild)
30876d0bb92d In gate command, allways build natives, use '-n' to avoid cleaning them only
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5729
diff changeset
731 buildvms(['--vms', 'graal', '--builds', vmbuild])
30876d0bb92d In gate command, allways build natives, use '-n' to avoid cleaning them only
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5729
diff changeset
732 tasks.append(t.stop())
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
733
4234
057620486c90 Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents: 4230
diff changeset
734 t = Task('BootstrapWithSystemAssertions:' + vmbuild)
057620486c90 Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents: 4230
diff changeset
735 vm(['-esa', '-version'])
4438
0312460af9fc Made gate do a full clean and added timing report for all gate tasks to end of gate log.
Doug Simon <doug.simon@oracle.com>
parents: 4417
diff changeset
736 tasks.append(t.stop())
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
737
5033
d7ecce178ad2 Add jacoco report and a -XX:+DeoptimizeALot -XX:+VerifyOops bootstrap run to the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5032
diff changeset
738 if vmbuild == 'product' and args.jacocout is not None:
d7ecce178ad2 Add jacoco report and a -XX:+DeoptimizeALot -XX:+VerifyOops bootstrap run to the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5032
diff changeset
739 _jacoco = 'on'
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
740
4234
057620486c90 Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents: 4230
diff changeset
741 t = Task('UnitTests:' + vmbuild)
057620486c90 Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents: 4230
diff changeset
742 unittest([])
4438
0312460af9fc Made gate do a full clean and added timing report for all gate tasks to end of gate log.
Doug Simon <doug.simon@oracle.com>
parents: 4417
diff changeset
743 tasks.append(t.stop())
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
744
5033
d7ecce178ad2 Add jacoco report and a -XX:+DeoptimizeALot -XX:+VerifyOops bootstrap run to the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5032
diff changeset
745 if vmbuild == 'product' and args.jacocout is not None:
d7ecce178ad2 Add jacoco report and a -XX:+DeoptimizeALot -XX:+VerifyOops bootstrap run to the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5032
diff changeset
746 _jacoco = 'append'
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
747
4684
e136f2d0d002 Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4660
diff changeset
748 t = Task('JavaTesterTests:' + vmbuild)
5688
9bb0ba9e8ba6 Adjust loop unroll policy a bit
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5680
diff changeset
749 jtt(['@-XX:CompileCommand=exclude,*::run*'] if vmbuild == 'product' else [])
4684
e136f2d0d002 Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4660
diff changeset
750 tasks.append(t.stop())
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
751
5033
d7ecce178ad2 Add jacoco report and a -XX:+DeoptimizeALot -XX:+VerifyOops bootstrap run to the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5032
diff changeset
752 if vmbuild == 'product' and args.jacocout is not None:
d7ecce178ad2 Add jacoco report and a -XX:+DeoptimizeALot -XX:+VerifyOops bootstrap run to the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5032
diff changeset
753 _jacoco = 'off'
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
754
4240
394424b7df1a Disabled certain DaCapo tests for fastdebug testing in the gate.
Doug Simon <doug.simon@oracle.com>
parents: 4238
diff changeset
755 for test in sanitycheck.getDacapos(level=sanitycheck.SanityCheckLevel.Gate, gateBuildLevel=vmbuild):
4238
e0d09e05aa9b Made the gate time each DaCapo test individually.
Doug Simon <doug.simon@oracle.com>
parents: 4235
diff changeset
756 t = Task(str(test) + ':' + vmbuild)
4417
648a7873cea2 Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents: 4407
diff changeset
757 if not test.test('graal'):
5244
55ff4ba8d7b1 ignore src/share/tools directory in native build out-of-date check
Doug Simon <doug.simon@oracle.com>
parents: 5239
diff changeset
758 t.abort(test.name + ' Failed')
4438
0312460af9fc Made gate do a full clean and added timing report for all gate tasks to end of gate log.
Doug Simon <doug.simon@oracle.com>
parents: 4417
diff changeset
759 tasks.append(t.stop())
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
760
5033
d7ecce178ad2 Add jacoco report and a -XX:+DeoptimizeALot -XX:+VerifyOops bootstrap run to the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5032
diff changeset
761 if args.jacocout is not None:
d7ecce178ad2 Add jacoco report and a -XX:+DeoptimizeALot -XX:+VerifyOops bootstrap run to the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5032
diff changeset
762 jacocoreport([args.jacocout])
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
763
5033
d7ecce178ad2 Add jacoco report and a -XX:+DeoptimizeALot -XX:+VerifyOops bootstrap run to the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5032
diff changeset
764 t = Task('BootstrapWithDeoptALot')
d7ecce178ad2 Add jacoco report and a -XX:+DeoptimizeALot -XX:+VerifyOops bootstrap run to the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5032
diff changeset
765 vm(['-XX:+DeoptimizeALot', '-XX:+VerifyOops', '-version'], vmbuild='fastdebug')
d7ecce178ad2 Add jacoco report and a -XX:+DeoptimizeALot -XX:+VerifyOops bootstrap run to the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5032
diff changeset
766 tasks.append(t.stop())
5016
c142a64141a8 Reorder gate checks to do the important stuff first
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4684
diff changeset
767
c142a64141a8 Reorder gate checks to do the important stuff first
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4684
diff changeset
768 t = Task('Checkstyle')
c142a64141a8 Reorder gate checks to do the important stuff first
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4684
diff changeset
769 if mx.checkstyle([]) != 0:
c142a64141a8 Reorder gate checks to do the important stuff first
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4684
diff changeset
770 t.abort('Checkstyle warnings were found')
c142a64141a8 Reorder gate checks to do the important stuff first
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4684
diff changeset
771 tasks.append(t.stop())
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
772
5016
c142a64141a8 Reorder gate checks to do the important stuff first
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4684
diff changeset
773 t = Task('Canonicalization Check')
c142a64141a8 Reorder gate checks to do the important stuff first
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4684
diff changeset
774 mx.log(time.strftime('%d %b %Y %H:%M:%S - Ensuring mx/projects files are canonicalized...'))
c142a64141a8 Reorder gate checks to do the important stuff first
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4684
diff changeset
775 if mx.canonicalizeprojects([]) != 0:
c142a64141a8 Reorder gate checks to do the important stuff first
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4684
diff changeset
776 t.abort('Rerun "mx canonicalizeprojects" and check-in the modified mx/projects files.')
c142a64141a8 Reorder gate checks to do the important stuff first
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4684
diff changeset
777 tasks.append(t.stop())
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
778
5016
c142a64141a8 Reorder gate checks to do the important stuff first
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4684
diff changeset
779 t = Task('CleanAndBuildGraalVisualizer')
c142a64141a8 Reorder gate checks to do the important stuff first
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4684
diff changeset
780 mx.run(['ant', '-f', join(_graal_home, 'visualizer', 'build.xml'), '-q', 'clean', 'build'])
c142a64141a8 Reorder gate checks to do the important stuff first
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4684
diff changeset
781 tasks.append(t.stop())
c142a64141a8 Reorder gate checks to do the important stuff first
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4684
diff changeset
782
c142a64141a8 Reorder gate checks to do the important stuff first
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4684
diff changeset
783 # Prevent Graal modifications from breaking the standard builds
5750
30876d0bb92d In gate command, allways build natives, use '-n' to avoid cleaning them only
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5729
diff changeset
784 if args.buildNonGraal:
5016
c142a64141a8 Reorder gate checks to do the important stuff first
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4684
diff changeset
785 t = Task('BuildHotSpotVarieties')
c142a64141a8 Reorder gate checks to do the important stuff first
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4684
diff changeset
786 buildvms(['--vms', 'client,server', '--builds', 'fastdebug,product'])
c142a64141a8 Reorder gate checks to do the important stuff first
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4684
diff changeset
787 tasks.append(t.stop())
5430
27536e9982fa added execution of DaCapo_pmd by [server|client]+[product|fastdebug] to the gate
Doug Simon <doug.simon@oracle.com>
parents: 5410
diff changeset
788
27536e9982fa added execution of DaCapo_pmd by [server|client]+[product|fastdebug] to the gate
Doug Simon <doug.simon@oracle.com>
parents: 5410
diff changeset
789 for vmbuild in ['product', 'fastdebug']:
27536e9982fa added execution of DaCapo_pmd by [server|client]+[product|fastdebug] to the gate
Doug Simon <doug.simon@oracle.com>
parents: 5410
diff changeset
790 _vmbuild = vmbuild
27536e9982fa added execution of DaCapo_pmd by [server|client]+[product|fastdebug] to the gate
Doug Simon <doug.simon@oracle.com>
parents: 5410
diff changeset
791 for theVm in ['client', 'server']:
27536e9982fa added execution of DaCapo_pmd by [server|client]+[product|fastdebug] to the gate
Doug Simon <doug.simon@oracle.com>
parents: 5410
diff changeset
792 _vm = theVm
27536e9982fa added execution of DaCapo_pmd by [server|client]+[product|fastdebug] to the gate
Doug Simon <doug.simon@oracle.com>
parents: 5410
diff changeset
793
27536e9982fa added execution of DaCapo_pmd by [server|client]+[product|fastdebug] to the gate
Doug Simon <doug.simon@oracle.com>
parents: 5410
diff changeset
794 t = Task('DaCapo_pmd:' + theVm + ':' + vmbuild)
27536e9982fa added execution of DaCapo_pmd by [server|client]+[product|fastdebug] to the gate
Doug Simon <doug.simon@oracle.com>
parents: 5410
diff changeset
795 dacapo(['pmd'])
27536e9982fa added execution of DaCapo_pmd by [server|client]+[product|fastdebug] to the gate
Doug Simon <doug.simon@oracle.com>
parents: 5410
diff changeset
796 tasks.append(t.stop())
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
797
4247
3f6c6e61614e Changed 'mx build' such that all Java sources for a project are compiled together instead of by source directory.
Doug Simon <doug.simon@oracle.com>
parents: 4244
diff changeset
798 except KeyboardInterrupt:
3f6c6e61614e Changed 'mx build' such that all Java sources for a project are compiled together instead of by source directory.
Doug Simon <doug.simon@oracle.com>
parents: 4244
diff changeset
799 total.abort(1)
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
800
4584
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
801 except BaseException as e:
4247
3f6c6e61614e Changed 'mx build' such that all Java sources for a project are compiled together instead of by source directory.
Doug Simon <doug.simon@oracle.com>
parents: 4244
diff changeset
802 import traceback
3f6c6e61614e Changed 'mx build' such that all Java sources for a project are compiled together instead of by source directory.
Doug Simon <doug.simon@oracle.com>
parents: 4244
diff changeset
803 traceback.print_exc()
4234
057620486c90 Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents: 4230
diff changeset
804 total.abort(str(e))
4159
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
805
4234
057620486c90 Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents: 4230
diff changeset
806 total.stop()
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
807
4438
0312460af9fc Made gate do a full clean and added timing report for all gate tasks to end of gate log.
Doug Simon <doug.simon@oracle.com>
parents: 4417
diff changeset
808 mx.log('Gate task times:')
0312460af9fc Made gate do a full clean and added timing report for all gate tasks to end of gate log.
Doug Simon <doug.simon@oracle.com>
parents: 4417
diff changeset
809 for t in tasks:
0312460af9fc Made gate do a full clean and added timing report for all gate tasks to end of gate log.
Doug Simon <doug.simon@oracle.com>
parents: 4417
diff changeset
810 mx.log(' ' + str(t.duration) + '\t' + t.title)
0312460af9fc Made gate do a full clean and added timing report for all gate tasks to end of gate log.
Doug Simon <doug.simon@oracle.com>
parents: 4417
diff changeset
811 mx.log(' =======')
0312460af9fc Made gate do a full clean and added timing report for all gate tasks to end of gate log.
Doug Simon <doug.simon@oracle.com>
parents: 4417
diff changeset
812 mx.log(' ' + str(total.duration))
4215
a2caa019ba3a Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4187
diff changeset
813
4536
8caa4f2df081 Added 'gv' command to mx for launching the GraalVisualizer.
Doug Simon <doug.simon@oracle.com>
parents: 4483
diff changeset
814 def gv(args):
8caa4f2df081 Added 'gv' command to mx for launching the GraalVisualizer.
Doug Simon <doug.simon@oracle.com>
parents: 4483
diff changeset
815 """run the Graal Visualizer"""
5047
6bc165b0fdcd Added 'intro' command to mx that runs a simple 'hello world' program and visualizes its compilation in the Graal Visualizer.
Doug Simon <doug.simon@oracle.com>
parents: 5034
diff changeset
816 with open(join(_graal_home, '.graal_visualizer.log'), 'w') as fp:
5089
206e68bb66c6 Made the IdealGraphVisualizer runnable from mx with new 'igv' command.
Doug Simon <doug.simon@oracle.com>
parents: 5064
diff changeset
817 mx.log('[Graal Visualizer log is in ' + fp.name + ']')
206e68bb66c6 Made the IdealGraphVisualizer runnable from mx with new 'igv' command.
Doug Simon <doug.simon@oracle.com>
parents: 5064
diff changeset
818 if not exists(join(_graal_home, 'visualizer', 'build.xml')):
206e68bb66c6 Made the IdealGraphVisualizer runnable from mx with new 'igv' command.
Doug Simon <doug.simon@oracle.com>
parents: 5064
diff changeset
819 mx.log('[This initial execution may take a while as the NetBeans platform needs to be downloaded]')
5047
6bc165b0fdcd Added 'intro' command to mx that runs a simple 'hello world' program and visualizes its compilation in the Graal Visualizer.
Doug Simon <doug.simon@oracle.com>
parents: 5034
diff changeset
820 mx.run(['ant', '-f', join(_graal_home, 'visualizer', 'build.xml'), '-l', fp.name, 'run'])
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
821
5089
206e68bb66c6 Made the IdealGraphVisualizer runnable from mx with new 'igv' command.
Doug Simon <doug.simon@oracle.com>
parents: 5064
diff changeset
822 def igv(args):
206e68bb66c6 Made the IdealGraphVisualizer runnable from mx with new 'igv' command.
Doug Simon <doug.simon@oracle.com>
parents: 5064
diff changeset
823 """run the Ideal Graph Visualizer"""
206e68bb66c6 Made the IdealGraphVisualizer runnable from mx with new 'igv' command.
Doug Simon <doug.simon@oracle.com>
parents: 5064
diff changeset
824 with open(join(_graal_home, '.ideal_graph_visualizer.log'), 'w') as fp:
206e68bb66c6 Made the IdealGraphVisualizer runnable from mx with new 'igv' command.
Doug Simon <doug.simon@oracle.com>
parents: 5064
diff changeset
825 mx.log('[Ideal Graph Visualizer log is in ' + fp.name + ']')
206e68bb66c6 Made the IdealGraphVisualizer runnable from mx with new 'igv' command.
Doug Simon <doug.simon@oracle.com>
parents: 5064
diff changeset
826 if not exists(join(_graal_home, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'nbplatform')):
206e68bb66c6 Made the IdealGraphVisualizer runnable from mx with new 'igv' command.
Doug Simon <doug.simon@oracle.com>
parents: 5064
diff changeset
827 mx.log('[This initial execution may take a while as the NetBeans platform needs to be downloaded]')
206e68bb66c6 Made the IdealGraphVisualizer runnable from mx with new 'igv' command.
Doug Simon <doug.simon@oracle.com>
parents: 5064
diff changeset
828 mx.run(['ant', '-f', join(_graal_home, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'build.xml'), '-l', fp.name, 'run'])
206e68bb66c6 Made the IdealGraphVisualizer runnable from mx with new 'igv' command.
Doug Simon <doug.simon@oracle.com>
parents: 5064
diff changeset
829
4215
a2caa019ba3a Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4187
diff changeset
830 def bench(args):
4324
b0aa4a52b89c Added support for project specs in classpath.
Doug Simon <doug.simon@oracle.com>
parents: 4294
diff changeset
831 """run benchmarks and parse their output for results
4282
063ea022532c mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4276
diff changeset
832
063ea022532c mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4276
diff changeset
833 Results are JSON formated : {group : {benchmark : score}}."""
063ea022532c mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4276
diff changeset
834 resultFile = None
063ea022532c mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4276
diff changeset
835 if '-resultfile' in args:
063ea022532c mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4276
diff changeset
836 index = args.index('-resultfile')
063ea022532c mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4276
diff changeset
837 if index + 1 < len(args):
063ea022532c mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4276
diff changeset
838 resultFile = args[index + 1]
4293
d4906ea4255b Handle SIGTERM : killing mx will properly kill subprocesses
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4288
diff changeset
839 del args[index]
d4906ea4255b Handle SIGTERM : killing mx will properly kill subprocesses
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4288
diff changeset
840 del args[index]
4282
063ea022532c mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4276
diff changeset
841 else:
063ea022532c mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4276
diff changeset
842 mx.abort('-resultfile must be followed by a file name')
4559
723df37192d6 Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4540
diff changeset
843 vm = _vm
4282
063ea022532c mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4276
diff changeset
844 if len(args) is 0:
063ea022532c mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4276
diff changeset
845 args += ['all']
063ea022532c mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4276
diff changeset
846
4219
47f7d91d34cf Fix javac build issues with classpath
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4216
diff changeset
847 results = {}
4282
063ea022532c mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4276
diff changeset
848 benchmarks = []
4219
47f7d91d34cf Fix javac build issues with classpath
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4216
diff changeset
849 #DaCapo
4282
063ea022532c mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4276
diff changeset
850 if ('dacapo' in args or 'all' in args):
063ea022532c mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4276
diff changeset
851 benchmarks += sanitycheck.getDacapos(level=sanitycheck.SanityCheckLevel.Benchmark)
4335
0d661161fa24 Add possibility to run individual DaCapo & SPECjvm2008 benchmarks, small fix in success and score regular expressions for SPECjvm2008
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4330
diff changeset
852 else:
0d661161fa24 Add possibility to run individual DaCapo & SPECjvm2008 benchmarks, small fix in success and score regular expressions for SPECjvm2008
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4330
diff changeset
853 dacapos = [a[7:] for a in args if a.startswith('dacapo:')]
0d661161fa24 Add possibility to run individual DaCapo & SPECjvm2008 benchmarks, small fix in success and score regular expressions for SPECjvm2008
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4330
diff changeset
854 for dacapo in dacapos:
0d661161fa24 Add possibility to run individual DaCapo & SPECjvm2008 benchmarks, small fix in success and score regular expressions for SPECjvm2008
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4330
diff changeset
855 if dacapo not in sanitycheck.dacapoSanityWarmup.keys():
0d661161fa24 Add possibility to run individual DaCapo & SPECjvm2008 benchmarks, small fix in success and score regular expressions for SPECjvm2008
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4330
diff changeset
856 mx.abort('Unknown dacapo : ' + dacapo)
0d661161fa24 Add possibility to run individual DaCapo & SPECjvm2008 benchmarks, small fix in success and score regular expressions for SPECjvm2008
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4330
diff changeset
857 benchmarks += [sanitycheck.getDacapo(dacapo, sanitycheck.dacapoSanityWarmup[dacapo][sanitycheck.SanityCheckLevel.Benchmark])]
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
858
4480
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
859 if ('scaladacapo' in args or 'all' in args):
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
860 benchmarks += sanitycheck.getScalaDacapos(level=sanitycheck.SanityCheckLevel.Benchmark)
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
861 else:
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
862 dacapos = [a[7:] for a in args if a.startswith('scaladacapo:')]
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
863 for dacapo in dacapos:
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
864 if dacapo not in sanitycheck.dacapoScalaSanityWarmup.keys():
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
865 mx.abort('Unknown dacapo : ' + dacapo)
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
866 benchmarks += [sanitycheck.getScalaDacapo(dacapo, sanitycheck.dacapoScalaSanityWarmup[dacapo][sanitycheck.SanityCheckLevel.Benchmark])]
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
867
4219
47f7d91d34cf Fix javac build issues with classpath
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4216
diff changeset
868 #Bootstrap
4282
063ea022532c mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4276
diff changeset
869 if ('bootstrap' in args or 'all' in args):
063ea022532c mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4276
diff changeset
870 benchmarks += sanitycheck.getBootstraps()
4230
b780ecb920c9 Add SPECjvm2008 to benchmarks, use dacapos defined in sanitycheck for the gate
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4228
diff changeset
871 #SPECjvm2008
4282
063ea022532c mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4276
diff changeset
872 if ('specjvm2008' in args or 'all' in args):
4336
b5c12b21879c fix for SPECjvm2008 bench in commands.py
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4335
diff changeset
873 benchmarks += [sanitycheck.getSPECjvm2008([], True, 120, 120)]
4335
0d661161fa24 Add possibility to run individual DaCapo & SPECjvm2008 benchmarks, small fix in success and score regular expressions for SPECjvm2008
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4330
diff changeset
874 else:
0d661161fa24 Add possibility to run individual DaCapo & SPECjvm2008 benchmarks, small fix in success and score regular expressions for SPECjvm2008
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4330
diff changeset
875 specjvms = [a[12:] for a in args if a.startswith('specjvm2008:')]
0d661161fa24 Add possibility to run individual DaCapo & SPECjvm2008 benchmarks, small fix in success and score regular expressions for SPECjvm2008
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4330
diff changeset
876 for specjvm in specjvms:
0d661161fa24 Add possibility to run individual DaCapo & SPECjvm2008 benchmarks, small fix in success and score regular expressions for SPECjvm2008
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4330
diff changeset
877 benchmarks += [sanitycheck.getSPECjvm2008([specjvm], True, 120, 120)]
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
878
4219
47f7d91d34cf Fix javac build issues with classpath
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4216
diff changeset
879 for test in benchmarks:
5195
8125c1f6472b Add DaCapo 1st run as a benchmark group
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5189
diff changeset
880 for (group, res) in test.bench(vm).items():
8125c1f6472b Add DaCapo 1st run as a benchmark group
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5189
diff changeset
881 if not results.has_key(group):
8125c1f6472b Add DaCapo 1st run as a benchmark group
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5189
diff changeset
882 results[group] = {};
8125c1f6472b Add DaCapo 1st run as a benchmark group
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5189
diff changeset
883 results[group].update(res)
4282
063ea022532c mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4276
diff changeset
884 mx.log(json.dumps(results))
063ea022532c mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4276
diff changeset
885 if resultFile:
063ea022532c mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4276
diff changeset
886 with open(resultFile, 'w') as f:
063ea022532c mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4276
diff changeset
887 f.write(json.dumps(results))
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
888
4228
e872562f95f8 add a simple specjvm2008 command, fail a benchmark if one of the failureRE matches
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4227
diff changeset
889 def specjvm2008(args):
4537
43b4e9201c29 Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4483
diff changeset
890 """run one or all SPECjvm2008 benchmarks
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
891
4537
43b4e9201c29 Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4483
diff changeset
892 All options begining with - will be passed to the vm except for -ikv -wt and -it.
43b4e9201c29 Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4483
diff changeset
893 Other options are supposed to be benchmark names and will be passed to SPECjvm2008."""
43b4e9201c29 Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4483
diff changeset
894 benchArgs = [a for a in args if a[0] != '-']
43b4e9201c29 Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4483
diff changeset
895 vmArgs = [a for a in args if a[0] == '-']
43b4e9201c29 Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4483
diff changeset
896 wt = None
43b4e9201c29 Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4483
diff changeset
897 it = None
43b4e9201c29 Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4483
diff changeset
898 skipValid = False
5295
31fc6b6c0425 Pass -v argument to SPECjvm2008 harness
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5269
diff changeset
899 if '-v' in vmArgs:
31fc6b6c0425 Pass -v argument to SPECjvm2008 harness
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5269
diff changeset
900 vmArgs.remove('-v')
31fc6b6c0425 Pass -v argument to SPECjvm2008 harness
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5269
diff changeset
901 benchArgs.append('-v')
4537
43b4e9201c29 Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4483
diff changeset
902 if '-ikv' in vmArgs:
43b4e9201c29 Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4483
diff changeset
903 skipValid = True
43b4e9201c29 Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4483
diff changeset
904 vmArgs.remove('-ikv')
43b4e9201c29 Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4483
diff changeset
905 if '-wt' in vmArgs:
43b4e9201c29 Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4483
diff changeset
906 wtIdx = args.index('-wt')
43b4e9201c29 Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4483
diff changeset
907 try:
43b4e9201c29 Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4483
diff changeset
908 wt = int(args[wtIdx+1])
43b4e9201c29 Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4483
diff changeset
909 except:
43b4e9201c29 Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4483
diff changeset
910 mx.abort('-wt (Warmup time) needs a numeric value (seconds)')
43b4e9201c29 Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4483
diff changeset
911 vmArgs.remove('-wt')
43b4e9201c29 Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4483
diff changeset
912 benchArgs.remove(args[wtIdx+1])
43b4e9201c29 Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4483
diff changeset
913 if '-it' in vmArgs:
43b4e9201c29 Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4483
diff changeset
914 itIdx = args.index('-it')
43b4e9201c29 Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4483
diff changeset
915 try:
43b4e9201c29 Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4483
diff changeset
916 it = int(args[itIdx+1])
43b4e9201c29 Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4483
diff changeset
917 except:
43b4e9201c29 Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4483
diff changeset
918 mx.abort('-it (Iteration time) needs a numeric value (seconds)')
43b4e9201c29 Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4483
diff changeset
919 vmArgs.remove('-it')
43b4e9201c29 Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4483
diff changeset
920 benchArgs.remove(args[itIdx+1])
5229
ce6cb3a1eb44 mx dacapo, mx scaladacapo and mx specjvm2008 should use the specified vm
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5197
diff changeset
921 vm = _vm;
ce6cb3a1eb44 mx dacapo, mx scaladacapo and mx specjvm2008 should use the specified vm
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5197
diff changeset
922 sanitycheck.getSPECjvm2008(benchArgs, skipValid, wt, it).bench(vm, opts=vmArgs)
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
923
5596
e4b1bc5e29e0 hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents: 5517
diff changeset
924 def hsdis(args, copyToDir=None):
e4b1bc5e29e0 hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents: 5517
diff changeset
925 """downloads the hsdis library
4482
7903b6c28f9c Add hsdis command to mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4480
diff changeset
926
7903b6c28f9c Add hsdis command to mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4480
diff changeset
927 This is needed to support HotSpot's assembly dumping features.
5596
e4b1bc5e29e0 hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents: 5517
diff changeset
928 By default it downloads the Intel syntax version, use the 'att' argument to install AT&T syntax."""
4482
7903b6c28f9c Add hsdis command to mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4480
diff changeset
929 flavor = 'intel'
7903b6c28f9c Add hsdis command to mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4480
diff changeset
930 if 'att' in args:
7903b6c28f9c Add hsdis command to mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4480
diff changeset
931 flavor = 'att'
7903b6c28f9c Add hsdis command to mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4480
diff changeset
932 lib = mx.lib_suffix('hsdis-amd64')
5596
e4b1bc5e29e0 hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents: 5517
diff changeset
933 path = join(_graal_home, 'lib', lib)
5189
6fbf12b8e572 automated download of hsdis lib if PrintAssembly option is used; added support for hsdis on the Mac
Doug Simon <doug.simon@oracle.com>
parents: 5153
diff changeset
934 if not exists(path):
6fbf12b8e572 automated download of hsdis lib if PrintAssembly option is used; added support for hsdis on the Mac
Doug Simon <doug.simon@oracle.com>
parents: 5153
diff changeset
935 mx.download(path, ['http://lafo.ssw.uni-linz.ac.at/hsdis/' + flavor + "/" + lib])
5596
e4b1bc5e29e0 hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents: 5517
diff changeset
936 if copyToDir is not None and exists(copyToDir):
e4b1bc5e29e0 hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents: 5517
diff changeset
937 shutil.copy(path, copyToDir)
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
938
5245
71ac4221b1b0 added hcfdis command
Doug Simon <doug.simon@oracle.com>
parents: 5244
diff changeset
939 def hcfdis(args):
71ac4221b1b0 added hcfdis command
Doug Simon <doug.simon@oracle.com>
parents: 5244
diff changeset
940 """disassembles HexCodeFiles embedded in text files
71ac4221b1b0 added hcfdis command
Doug Simon <doug.simon@oracle.com>
parents: 5244
diff changeset
941
71ac4221b1b0 added hcfdis command
Doug Simon <doug.simon@oracle.com>
parents: 5244
diff changeset
942 Run a tool over the input files to convert all embedded HexCodeFiles
71ac4221b1b0 added hcfdis command
Doug Simon <doug.simon@oracle.com>
parents: 5244
diff changeset
943 to a disassembled format."""
71ac4221b1b0 added hcfdis command
Doug Simon <doug.simon@oracle.com>
parents: 5244
diff changeset
944 path = join(_graal_home, 'lib', 'hcfdis.jar')
71ac4221b1b0 added hcfdis command
Doug Simon <doug.simon@oracle.com>
parents: 5244
diff changeset
945 if not exists(path):
71ac4221b1b0 added hcfdis command
Doug Simon <doug.simon@oracle.com>
parents: 5244
diff changeset
946 mx.download(path, ['http://lafo.ssw.uni-linz.ac.at/hcfdis.jar'])
71ac4221b1b0 added hcfdis command
Doug Simon <doug.simon@oracle.com>
parents: 5244
diff changeset
947 mx.run_java(['-jar', path] + args)
71ac4221b1b0 added hcfdis command
Doug Simon <doug.simon@oracle.com>
parents: 5244
diff changeset
948
4684
e136f2d0d002 Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4660
diff changeset
949 def jacocoreport(args):
e136f2d0d002 Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4660
diff changeset
950 """creates a JaCoCo coverage report
e136f2d0d002 Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4660
diff changeset
951
e136f2d0d002 Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4660
diff changeset
952 Creates the report from the 'jacoco.exec' file in the current directory.
e136f2d0d002 Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4660
diff changeset
953 Default output directory is 'coverage', but an alternative can be provided as an argument."""
e136f2d0d002 Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4660
diff changeset
954 jacocoreport = mx.library("JACOCOREPORT", True)
e136f2d0d002 Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4660
diff changeset
955 out = 'coverage'
e136f2d0d002 Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4660
diff changeset
956 if len(args) == 1:
e136f2d0d002 Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4660
diff changeset
957 out = args[0]
e136f2d0d002 Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4660
diff changeset
958 elif len(args) > 1:
e136f2d0d002 Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4660
diff changeset
959 mx.abort('jacocoreport takes only one argument : an output directory')
e136f2d0d002 Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4660
diff changeset
960 mx.run_java(['-jar', jacocoreport.get_path(True), '-in', 'jacoco.exec', '-g', join(_graal_home, 'graal'), out])
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
961
5700
12a34d1bcaa2 added site command to generate a javadoc-based website
Doug Simon <doug.simon@oracle.com>
parents: 5688
diff changeset
962 def site(args):
12a34d1bcaa2 added site command to generate a javadoc-based website
Doug Simon <doug.simon@oracle.com>
parents: 5688
diff changeset
963 """creates a website containing javadoc and the project dependency graph"""
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
964
5771
613a3ddb9a71 moved core site functionality into mx.py
Doug Simon <doug.simon@oracle.com>
parents: 5764
diff changeset
965 return mx.site(['--name', 'Graal',
5782
488864d5069a added support for passing -tag option to javadoc to suppress warnings about unrecognized tags in javadoc comments
Doug Simon <doug.simon@oracle.com>
parents: 5771
diff changeset
966 '--jd', '@-tag', '--jd', '@test:X',
488864d5069a added support for passing -tag option to javadoc to suppress warnings about unrecognized tags in javadoc comments
Doug Simon <doug.simon@oracle.com>
parents: 5771
diff changeset
967 '--jd', '@-tag', '--jd', '@run:X',
488864d5069a added support for passing -tag option to javadoc to suppress warnings about unrecognized tags in javadoc comments
Doug Simon <doug.simon@oracle.com>
parents: 5771
diff changeset
968 '--jd', '@-tag', '--jd', '@bug:X',
488864d5069a added support for passing -tag option to javadoc to suppress warnings about unrecognized tags in javadoc comments
Doug Simon <doug.simon@oracle.com>
parents: 5771
diff changeset
969 '--jd', '@-tag', '--jd', '@summary:X',
488864d5069a added support for passing -tag option to javadoc to suppress warnings about unrecognized tags in javadoc comments
Doug Simon <doug.simon@oracle.com>
parents: 5771
diff changeset
970 '--jd', '@-tag', '--jd', '@vmoption:X',
5771
613a3ddb9a71 moved core site functionality into mx.py
Doug Simon <doug.simon@oracle.com>
parents: 5764
diff changeset
971 '--overview', join(_graal_home, 'graal', 'overview.html'),
613a3ddb9a71 moved core site functionality into mx.py
Doug Simon <doug.simon@oracle.com>
parents: 5764
diff changeset
972 '--title', 'Graal OpenJDK Project Documentation',
613a3ddb9a71 moved core site functionality into mx.py
Doug Simon <doug.simon@oracle.com>
parents: 5764
diff changeset
973 '--dot-output-base', 'modules'] + args)
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
974
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
975 def mx_init():
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
976 _vmbuild = 'product'
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
977 commands = {
4226
e03ff10d4bfc Made the gate clean the Java projects only.
Doug Simon <doug.simon@oracle.com>
parents: 4225
diff changeset
978 'build': [build, '[-options]'],
4601
ade18666f2be Added --omit-native-build to gate command so that native cleaning and building can be omitted for changesets that made no changes to the C/C++ code.
Doug Simon <doug.simon@oracle.com>
parents: 4584
diff changeset
979 'buildvms': [buildvms, '[-options]'],
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
980 'clean': [clean, ''],
4482
7903b6c28f9c Add hsdis command to mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4480
diff changeset
981 'hsdis': [hsdis, '[att]'],
5245
71ac4221b1b0 added hcfdis command
Doug Simon <doug.simon@oracle.com>
parents: 5244
diff changeset
982 'hcfdis': [hcfdis, ''],
5089
206e68bb66c6 Made the IdealGraphVisualizer runnable from mx with new 'igv' command.
Doug Simon <doug.simon@oracle.com>
parents: 5064
diff changeset
983 'igv' : [igv, ''],
5103
276e14614531 Added jdkhome command to mx.
Doug Simon <doug.simon@oracle.com>
parents: 5094
diff changeset
984 'jdkhome': [jdkhome, ''],
4228
e872562f95f8 add a simple specjvm2008 command, fail a benchmark if one of the failureRE matches
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4227
diff changeset
985 'dacapo': [dacapo, '[[n] benchmark] [VM options|@DaCapo options]'],
4480
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
986 'scaladacapo': [scaladacapo, '[[n] benchmark] [VM options|@Scala DaCapo options]'],
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
987 'specjvm2008': [specjvm2008, '[VM options|@specjvm2008 options]'],
5090
0a1e5b876667 Disabled 'examples' command until the examples are revived.
Doug Simon <doug.simon@oracle.com>
parents: 5089
diff changeset
988 #'example': [example, '[-v] example names...'],
4601
ade18666f2be Added --omit-native-build to gate command so that native cleaning and building can be omitted for changesets that made no changes to the C/C++ code.
Doug Simon <doug.simon@oracle.com>
parents: 4584
diff changeset
989 'gate' : [gate, '[-options]'],
4536
8caa4f2df081 Added 'gv' command to mx for launching the GraalVisualizer.
Doug Simon <doug.simon@oracle.com>
parents: 4483
diff changeset
990 'gv' : [gv, ''],
4559
723df37192d6 Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4540
diff changeset
991 'bench' : [bench, '[-resultfile file] [all(default)|dacapo|specjvm2008|bootstrap]'],
4159
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
992 'unittest' : [unittest, '[filters...]'],
4587
5b04b33dac74 add jtt tests, converted from the maxine repository using ConvertJTT
Lukas Stadler <lukas.stadler@jku.at>
parents: 4584
diff changeset
993 'jtt' : [jtt, '[filters...]'],
4684
e136f2d0d002 Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4660
diff changeset
994 'jacocoreport' : [jacocoreport, '[output directory]'],
5700
12a34d1bcaa2 added site command to generate a javadoc-based website
Doug Simon <doug.simon@oracle.com>
parents: 5688
diff changeset
995 'site' : [site, '[-options]'],
5257
a549662f6c6f added 'vmg' and 'vmfg' commands to mx as convenient aliases for running the debug and fastdebug builds of the selected VM
Doug Simon <doug.simon@oracle.com>
parents: 5245
diff changeset
996 'vm': [vm, '[-options] class [args...]'],
a549662f6c6f added 'vmg' and 'vmfg' commands to mx as convenient aliases for running the debug and fastdebug builds of the selected VM
Doug Simon <doug.simon@oracle.com>
parents: 5245
diff changeset
997 'vmg': [vmg, '[-options] class [args...]'],
a549662f6c6f added 'vmg' and 'vmfg' commands to mx as convenient aliases for running the debug and fastdebug builds of the selected VM
Doug Simon <doug.simon@oracle.com>
parents: 5245
diff changeset
998 'vmfg': [vmfg, '[-options] class [args...]']
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
999 }
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
1000
5064
8a88c903e381 Updated mx commands.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5047
diff changeset
1001 mx.add_argument('--jacoco', help='instruments com.oracle.* classes using JaCoCo', default='off', choices=['off', 'on', 'append'])
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
1002
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
1003 if (_vmSourcesAvailable):
4575
ccb5369481a2 Clarified mx help text on how to build/run [Graal|Client|Server].
Doug Simon <doug.simon@oracle.com>
parents: 4572
diff changeset
1004 mx.add_argument('--vm', action='store', dest='vm', default='graal', choices=['graal', 'server', 'client'], help='the VM to build/run (default: graal)')
4417
648a7873cea2 Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents: 4407
diff changeset
1005 mx.add_argument('--product', action='store_const', dest='vmbuild', const='product', help='select the product build of the VM')
648a7873cea2 Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents: 4407
diff changeset
1006 mx.add_argument('--debug', action='store_const', dest='vmbuild', const='debug', help='select the debug build of the VM')
648a7873cea2 Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents: 4407
diff changeset
1007 mx.add_argument('--fastdebug', action='store_const', dest='vmbuild', const='fastdebug', help='select the fast debug build of the VM')
5194
a6eceb5efb0e added --ecl option to mx for saving VM execution(s) as Eclipse launch configurations
Doug Simon <doug.simon@oracle.com>
parents: 5189
diff changeset
1008 mx.add_argument('--ecl', action='store_true', dest='make_eclipse_launch', help='create launch configuration for running VM execution(s) in Eclipse')
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
1009
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
1010 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
1011 'export': [export, '[-options] [zipfile]'],
4240
394424b7df1a Disabled certain DaCapo tests for fastdebug testing in the gate.
Doug Simon <doug.simon@oracle.com>
parents: 4238
diff changeset
1012 'build': [build, '[-options] [product|debug|fastdebug]...']
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
1013 })
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
1014
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
1015 mx.commands.update(commands)
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
1016
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
1017 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
1018 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
1019 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
1020 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
1021 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
1022 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
1023 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
1024 mx.abort('Requires Java version 1.7 or greater, got version ' + version)
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
1025
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
1026 if (_vmSourcesAvailable):
4559
723df37192d6 Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4540
diff changeset
1027 if hasattr(opts, 'vm') and opts.vm is not None:
723df37192d6 Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4540
diff changeset
1028 global _vm
723df37192d6 Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4540
diff changeset
1029 _vm = opts.vm
4216
a13d61d3910e fix for when no vm build is explicitely selected
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4215
diff changeset
1030 if hasattr(opts, 'vmbuild') and opts.vmbuild is not None:
4178
d1b26c17910a Add the Dacapo benchmarks to the "lib" folder instead of using the environment variable. Fixed an issue in the downloader.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4177
diff changeset
1031 global _vmbuild
4156
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
1032 _vmbuild = opts.vmbuild
5194
a6eceb5efb0e added --ecl option to mx for saving VM execution(s) as Eclipse launch configurations
Doug Simon <doug.simon@oracle.com>
parents: 5189
diff changeset
1033 global _make_eclipse_launch
a6eceb5efb0e added --ecl option to mx for saving VM execution(s) as Eclipse launch configurations
Doug Simon <doug.simon@oracle.com>
parents: 5189
diff changeset
1034 _make_eclipse_launch = getattr(opts, 'make_eclipse_launch', False)
5024
7ccdae96e98a Allow JaCoCon to append to the execution file
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5016
diff changeset
1035 global _jacoco
7ccdae96e98a Allow JaCoCon to append to the execution file
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5016
diff changeset
1036 _jacoco = opts.jacoco