Mercurial > hg > graal-compiler
annotate mx/mx_graal.py @ 21198:d2bae7605fe4
Introduce StackMove LIR instruction.
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Mon, 27 Apr 2015 10:57:34 +0200 |
parents | 41ec6d89cb84 |
children | 326a1f374198 b426469fadb7 |
rev | line source |
---|---|
3718 | 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 | 3 # |
4 # ---------------------------------------------------------------------------------------------------- | |
5 # | |
18897
9afee75cee46
mx: add microbench command to run JMH benchmarks
Roland Schatz <roland.schatz@oracle.com>
parents:
18894
diff
changeset
|
6 # Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. |
3718 | 7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
8 # | |
9 # This code is free software; you can redistribute it and/or modify it | |
10 # under the terms of the GNU General Public License version 2 only, as | |
11 # published by the Free Software Foundation. | |
12 # | |
13 # This code is distributed in the hope that it will be useful, but WITHOUT | |
14 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 # version 2 for more details (a copy is included in the LICENSE file that | |
17 # accompanied this code). | |
18 # | |
19 # You should have received a copy of the GNU General Public License version | |
20 # 2 along with this work; if not, write to the Free Software Foundation, | |
21 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
22 # | |
23 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
24 # or visit www.oracle.com if you need additional information or have any | |
25 # questions. | |
26 # | |
27 # ---------------------------------------------------------------------------------------------------- | |
28 | |
18876
c446d00f2cdf
mx: added support for Jython 2.7b3 and made ordering in generated files more deterministic\nContributed-by: Igor Ignatyev <igor.ignatyev@oracle.com>
Doug Simon <doug.simon@oracle.com>
parents:
18869
diff
changeset
|
29 import os, stat, errno, sys, shutil, zipfile, tarfile, tempfile, re, time, datetime, platform, subprocess, StringIO, socket |
16419
7520833c6e7f
eliminate JUnitWrapper
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16417
diff
changeset
|
30 from os.path import join, exists, dirname, basename |
15113 | 31 from argparse import ArgumentParser, RawDescriptionHelpFormatter, REMAINDER |
13508
8a5b39d0bfb5
mx: add completion support for graal options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13507
diff
changeset
|
32 from outputparser import OutputParser, ValuesMatcher |
16628
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16627
diff
changeset
|
33 import hashlib |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
34 import mx |
13472
72e2ec923b7b
added support to replace NetBeans platform used by IGV if it is out of date (GRAAL-420)
Doug Simon <doug.simon@oracle.com>
parents:
13471
diff
changeset
|
35 import xml.dom.minidom |
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
|
36 import sanitycheck |
11367
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
37 import itertools |
9116
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
38 import json, textwrap |
15329 | 39 import fnmatch |
3718 | 40 |
10574
0cad5096735e
commands.py: Make sure _jdk returns an absolute path. Use _jdk and _jdksDir where necessary
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
10570
diff
changeset
|
41 # This works because when mx loads this file, it makes sure __file__ gets an absolute path |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
42 _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
|
43 |
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 """ 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
|
45 _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
|
46 |
11296
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
47 """ The VMs that can be built and run along with an optional description. Only VMs with a |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
48 description are listed in the dialogue for setting the default VM (see _get_vm()). """ |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
49 _vmChoices = { |
15862
283c8d31c560
mx: update vm choice helptext
Bernhard Urban <bernhard.urban@jku.at>
parents:
15844
diff
changeset
|
50 'graal' : 'Normal compilation is performed with a tiered system (C1 + Graal), Truffle compilation is performed with Graal.', |
283c8d31c560
mx: update vm choice helptext
Bernhard Urban <bernhard.urban@jku.at>
parents:
15844
diff
changeset
|
51 'server' : 'Normal compilation is performed with a tiered system (C1 + C2), Truffle compilation is performed with Graal. Use this for optimal Truffle performance.', |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
52 'client' : None, # normal compilation with client compiler, explicit compilation (e.g., by Truffle) with Graal |
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
53 'server-nograal' : None, # all compilation with tiered system (i.e., client + server), Graal omitted |
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
54 'client-nograal' : None, # all compilation with client compiler, Graal omitted |
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
55 'original' : None, # default VM copied from bootstrap JDK |
11296
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
56 } |
9095
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
57 |
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
58 """ The VM that will be run by the 'vm' command and built by default by the 'build' command. |
11296
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
59 This can be set via the global '--vm' option or the DEFAULT_VM environment variable. |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
60 It can also be temporarily set by using of a VM context manager object in a 'with' statement. """ |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
61 _vm = None |
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
|
62 |
9095
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
63 """ The VM builds that will be run by the 'vm' command - default is first in list """ |
9157
a38d748d4130
Add support for the 'optimized' build in mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9130
diff
changeset
|
64 _vmbuildChoices = ['product', 'fastdebug', 'debug', 'optimized'] |
9095
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
65 |
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
66 """ The VM build that will be run by the 'vm' command. |
11371
74414b248381
mx: added --vmbuild global option, removed --product, --fastdebug, --debug options as well as suffix of build command
Doug Simon <doug.simon@oracle.com>
parents:
11368
diff
changeset
|
67 This can be set via the global '--vmbuild' option. |
11296
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
68 It can also be temporarily set by using of a VM context manager object in a 'with' statement. """ |
9095
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
69 _vmbuild = _vmbuildChoices[0] |
3718 | 70 |
5024
7ccdae96e98a
Allow JaCoCon to append to the execution file
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5016
diff
changeset
|
71 _jacoco = 'off' |
4684
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
72 |
11401
2d228d304247
minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents:
11395
diff
changeset
|
73 """ The current working directory to switch to before running the VM. """ |
2d228d304247
minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents:
11395
diff
changeset
|
74 _vm_cwd = None |
10454
590b0c26877f
mx: add --workdir argument
Bernhard Urban <bernhard.urban@jku.at>
parents:
10417
diff
changeset
|
75 |
11401
2d228d304247
minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents:
11395
diff
changeset
|
76 """ The base directory in which the JDKs cloned from $JAVA_HOME exist. """ |
2d228d304247
minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents:
11395
diff
changeset
|
77 _installed_jdks = None |
10570
2f80624df8a2
Add a --vmdir argument to mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
10568
diff
changeset
|
78 |
11401
2d228d304247
minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents:
11395
diff
changeset
|
79 """ Prefix for running the VM. """ |
2d228d304247
minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents:
11395
diff
changeset
|
80 _vm_prefix = None |
5875
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5871
diff
changeset
|
81 |
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
|
82 _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
|
83 |
15594
62738ce98804
mx: set _minVersion to 1.8
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15593
diff
changeset
|
84 _minVersion = mx.VersionSpec('1.8') |
7916
9bff64f43299
Better java version numbers support in mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7788
diff
changeset
|
85 |
20102
6e5df2d60fbd
mx: fix compliance check for EXTRA_JAVA_HOMES, add maximum JAVA_HOME version in mx_graal
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
20032
diff
changeset
|
86 # max version (first _unsupported_ version) |
20805
379471b334cb
Lift 8u40 mx restriction
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
20102
diff
changeset
|
87 _untilVersion = None |
20102
6e5df2d60fbd
mx: fix compliance check for EXTRA_JAVA_HOMES, add maximum JAVA_HOME version in mx_graal
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
20032
diff
changeset
|
88 |
16902
0583d157992a
formalized the set of distribution jars that are installed into the JDK to ensure both mx and the HotSpot make system do the necessary deployment
Doug Simon <doug.simon@oracle.com>
parents:
16877
diff
changeset
|
89 class JDKDeployedDist: |
21032 | 90 def __init__(self, name, isExtension=False, isGraalClassLoader=False): |
16902
0583d157992a
formalized the set of distribution jars that are installed into the JDK to ensure both mx and the HotSpot make system do the necessary deployment
Doug Simon <doug.simon@oracle.com>
parents:
16877
diff
changeset
|
91 self.name = name |
0583d157992a
formalized the set of distribution jars that are installed into the JDK to ensure both mx and the HotSpot make system do the necessary deployment
Doug Simon <doug.simon@oracle.com>
parents:
16877
diff
changeset
|
92 self.isExtension = isExtension |
21031
e1c063565b3c
Graal Services: use services files in jre/lib/graal/services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
20996
diff
changeset
|
93 self.isGraalClassLoader = isGraalClassLoader |
16902
0583d157992a
formalized the set of distribution jars that are installed into the JDK to ensure both mx and the HotSpot make system do the necessary deployment
Doug Simon <doug.simon@oracle.com>
parents:
16877
diff
changeset
|
94 |
0583d157992a
formalized the set of distribution jars that are installed into the JDK to ensure both mx and the HotSpot make system do the necessary deployment
Doug Simon <doug.simon@oracle.com>
parents:
16877
diff
changeset
|
95 _jdkDeployedDists = [ |
21031
e1c063565b3c
Graal Services: use services files in jre/lib/graal/services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
20996
diff
changeset
|
96 JDKDeployedDist('TRUFFLE'), |
e1c063565b3c
Graal Services: use services files in jre/lib/graal/services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
20996
diff
changeset
|
97 JDKDeployedDist('GRAAL_LOADER'), |
e1c063565b3c
Graal Services: use services files in jre/lib/graal/services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
20996
diff
changeset
|
98 JDKDeployedDist('GRAAL', isGraalClassLoader=True), |
e1c063565b3c
Graal Services: use services files in jre/lib/graal/services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
20996
diff
changeset
|
99 JDKDeployedDist('GRAAL_TRUFFLE', isGraalClassLoader=True) |
16902
0583d157992a
formalized the set of distribution jars that are installed into the JDK to ensure both mx and the HotSpot make system do the necessary deployment
Doug Simon <doug.simon@oracle.com>
parents:
16877
diff
changeset
|
100 ] |
0583d157992a
formalized the set of distribution jars that are installed into the JDK to ensure both mx and the HotSpot make system do the necessary deployment
Doug Simon <doug.simon@oracle.com>
parents:
16877
diff
changeset
|
101 |
16627
68deb37eed70
mx: fix permissions of copied bootstrap JDK files (don't make everything executable)
Bernhard Urban <bernhard.urban@jku.at>
parents:
16623
diff
changeset
|
102 JDK_UNIX_PERMISSIONS_DIR = 0755 |
68deb37eed70
mx: fix permissions of copied bootstrap JDK files (don't make everything executable)
Bernhard Urban <bernhard.urban@jku.at>
parents:
16623
diff
changeset
|
103 JDK_UNIX_PERMISSIONS_FILE = 0644 |
16782
9f5e33cf8d52
Factored out the '_copyToJdk' function and allow copying files to jre/lib/ext.
Danilo Ansaloni <danilo.ansaloni@oracle.com>
parents:
16729
diff
changeset
|
104 JDK_UNIX_PERMISSIONS_EXEC = 0755 |
13919
9d70445ea369
mx: set correct permissions for graal.jar
Bernhard Urban <bernhard.urban@jku.at>
parents:
13846
diff
changeset
|
105 |
14602
591f4a575ebf
issue warning/error where ever relevant if a non-supported VM (e.g., client VM on Mac) is used in mx
Doug Simon <doug.simon@oracle.com>
parents:
14595
diff
changeset
|
106 def isVMSupported(vm): |
18799
750db34c9fe1
client-nograal is supported on Mac
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18733
diff
changeset
|
107 if 'client' == vm and len(platform.mac_ver()[0]) != 0: |
14602
591f4a575ebf
issue warning/error where ever relevant if a non-supported VM (e.g., client VM on Mac) is used in mx
Doug Simon <doug.simon@oracle.com>
parents:
14595
diff
changeset
|
108 # Client VM not supported: java launcher on Mac OS X translates '-client' to '-server' |
591f4a575ebf
issue warning/error where ever relevant if a non-supported VM (e.g., client VM on Mac) is used in mx
Doug Simon <doug.simon@oracle.com>
parents:
14595
diff
changeset
|
109 return False |
591f4a575ebf
issue warning/error where ever relevant if a non-supported VM (e.g., client VM on Mac) is used in mx
Doug Simon <doug.simon@oracle.com>
parents:
14595
diff
changeset
|
110 return True |
591f4a575ebf
issue warning/error where ever relevant if a non-supported VM (e.g., client VM on Mac) is used in mx
Doug Simon <doug.simon@oracle.com>
parents:
14595
diff
changeset
|
111 |
11296
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
112 def _get_vm(): |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
113 """ |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
114 Gets the configured VM, presenting a dialogue if there is no currently configured VM. |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
115 """ |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
116 global _vm |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
117 if _vm: |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
118 return _vm |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
119 vm = mx.get_env('DEFAULT_VM') |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
120 if vm is None: |
21169
41ec6d89cb84
mx: fix calls to is_interactive()
Andreas Woess <andreas.woess@oracle.com>
parents:
21166
diff
changeset
|
121 if not mx.is_interactive(): |
11296
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
122 mx.abort('Need to specify VM with --vm option or DEFAULT_VM environment variable') |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
123 envPath = join(_graal_home, 'mx', 'env') |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
124 mx.log('Please select the VM to be executed from the following: ') |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
125 items = [k for k in _vmChoices.keys() if _vmChoices[k] is not None] |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
126 descriptions = [_vmChoices[k] for k in _vmChoices.keys() if _vmChoices[k] is not None] |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
127 vm = mx.select_items(items, descriptions, allowMultiple=False) |
11511
3110bea9a6b0
mx: add helper method for yes/no question
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11493
diff
changeset
|
128 if mx.ask_yes_no('Persist this choice by adding "DEFAULT_VM=' + vm + '" to ' + envPath, 'y'): |
11296
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
129 with open(envPath, 'a') as fp: |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
130 print >> fp, 'DEFAULT_VM=' + vm |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
131 _vm = vm |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
132 return vm |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
133 |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
134 """ |
11296
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
135 A context manager that can be used with the 'with' statement to set the VM |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
136 used by all VM executions within the scope of the 'with' statement. For example: |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
137 |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
138 with VM('server'): |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
139 dacapo(['pmd']) |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
140 """ |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
141 class VM: |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
142 def __init__(self, vm=None, build=None): |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
143 assert vm is None or vm in _vmChoices.keys() |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
144 assert build is None or build in _vmbuildChoices |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
145 self.vm = vm if vm else _vm |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
146 self.build = build if build else _vmbuild |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
147 self.previousVm = _vm |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
148 self.previousBuild = _vmbuild |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
149 |
11296
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
150 def __enter__(self): |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
151 global _vm, _vmbuild |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
152 _vm = self.vm |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
153 _vmbuild = self.build |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
154 |
11296
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
155 def __exit__(self, exc_type, exc_value, traceback): |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
156 global _vm, _vmbuild |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
157 _vm = self.previousVm |
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
158 _vmbuild = self.previousBuild |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
159 |
16627
68deb37eed70
mx: fix permissions of copied bootstrap JDK files (don't make everything executable)
Bernhard Urban <bernhard.urban@jku.at>
parents:
16623
diff
changeset
|
160 def chmodRecursive(dirname, chmodFlagsDir): |
17233
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
161 if mx.get_os() == 'windows': |
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
162 return |
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
163 |
16627
68deb37eed70
mx: fix permissions of copied bootstrap JDK files (don't make everything executable)
Bernhard Urban <bernhard.urban@jku.at>
parents:
16623
diff
changeset
|
164 def _chmodDir(chmodFlags, dirname, fnames): |
68deb37eed70
mx: fix permissions of copied bootstrap JDK files (don't make everything executable)
Bernhard Urban <bernhard.urban@jku.at>
parents:
16623
diff
changeset
|
165 os.chmod(dirname, chmodFlagsDir) |
6705
0cb1ac637dd0
Added recursive chmod for cases where JAVA_HOME is not owned by graal workspace owner.
Laurent Daynes <Laurent.Daynes@oracle.com>
parents:
6702
diff
changeset
|
166 |
16627
68deb37eed70
mx: fix permissions of copied bootstrap JDK files (don't make everything executable)
Bernhard Urban <bernhard.urban@jku.at>
parents:
16623
diff
changeset
|
167 os.path.walk(dirname, _chmodDir, chmodFlagsDir) |
6705
0cb1ac637dd0
Added recursive chmod for cases where JAVA_HOME is not owned by graal workspace owner.
Laurent Daynes <Laurent.Daynes@oracle.com>
parents:
6702
diff
changeset
|
168 |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
169 def clean(args): |
6291
633136426f26
consolidated jtt command into unittest command and removed need for explicit 'testHarness' property in 'projects' file
Doug Simon <doug.simon@oracle.com>
parents:
6278
diff
changeset
|
170 """clean 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
|
171 opts = mx.clean(args, parser=ArgumentParser(prog='mx clean')) |
15580
ce201bb843b4
mx clean: try to change permission if deletion fails on windows
Bernhard Urban <bernhard.urban@jku.at>
parents:
15577
diff
changeset
|
172 |
4226
e03ff10d4bfc
Made the gate clean the Java projects only.
Doug Simon <doug.simon@oracle.com>
parents:
4225
diff
changeset
|
173 if opts.native: |
15580
ce201bb843b4
mx clean: try to change permission if deletion fails on windows
Bernhard Urban <bernhard.urban@jku.at>
parents:
15577
diff
changeset
|
174 def handleRemoveReadonly(func, path, exc): |
ce201bb843b4
mx clean: try to change permission if deletion fails on windows
Bernhard Urban <bernhard.urban@jku.at>
parents:
15577
diff
changeset
|
175 excvalue = exc[1] |
ce201bb843b4
mx clean: try to change permission if deletion fails on windows
Bernhard Urban <bernhard.urban@jku.at>
parents:
15577
diff
changeset
|
176 if mx.get_os() == 'windows' and func in (os.rmdir, os.remove) and excvalue.errno == errno.EACCES: |
15870
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15862
diff
changeset
|
177 os.chmod(path, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) # 0777 |
15580
ce201bb843b4
mx clean: try to change permission if deletion fails on windows
Bernhard Urban <bernhard.urban@jku.at>
parents:
15577
diff
changeset
|
178 func(path) |
ce201bb843b4
mx clean: try to change permission if deletion fails on windows
Bernhard Urban <bernhard.urban@jku.at>
parents:
15577
diff
changeset
|
179 else: |
ce201bb843b4
mx clean: try to change permission if deletion fails on windows
Bernhard Urban <bernhard.urban@jku.at>
parents:
15577
diff
changeset
|
180 raise |
ce201bb843b4
mx clean: try to change permission if deletion fails on windows
Bernhard Urban <bernhard.urban@jku.at>
parents:
15577
diff
changeset
|
181 |
9095
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
182 def rmIfExists(name): |
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
183 if os.path.isdir(name): |
15580
ce201bb843b4
mx clean: try to change permission if deletion fails on windows
Bernhard Urban <bernhard.urban@jku.at>
parents:
15577
diff
changeset
|
184 shutil.rmtree(name, ignore_errors=False, onerror=handleRemoveReadonly) |
9095
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
185 elif os.path.isfile(name): |
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
186 os.unlink(name) |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
187 |
9095
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
188 rmIfExists(join(_graal_home, 'build')) |
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
189 rmIfExists(join(_graal_home, 'build-nograal')) |
9119
0c9c4ae236b2
refactoring to ensure the path to the JDKs dir is consistent between the _jdk() and clean() command
Doug Simon <doug.simon@oracle.com>
parents:
9118
diff
changeset
|
190 rmIfExists(_jdksDir()) |
3718 | 191 |
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
|
192 def export(args): |
15420
5947bb02474f
mx export: change the way of marking a repo as dirty
Bernhard Urban <bernhard.urban@jku.at>
parents:
15405
diff
changeset
|
193 """create archives of builds split by vmbuild and vm""" |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
194 |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
195 parser = ArgumentParser(prog='mx export') |
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
|
196 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
|
197 |
15405
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
198 # collect data about export |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
199 infos = dict() |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
200 infos['timestamp'] = time.time() |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
201 |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
202 hgcfg = mx.HgConfig() |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
203 hgcfg.check() |
15420
5947bb02474f
mx export: change the way of marking a repo as dirty
Bernhard Urban <bernhard.urban@jku.at>
parents:
15405
diff
changeset
|
204 infos['revision'] = hgcfg.tip('.') + ('+' if hgcfg.isDirty('.') else '') |
15405
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
205 # TODO: infos['repository'] |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
206 |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
207 infos['jdkversion'] = str(mx.java().version) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
208 |
17012
ad10671d1bbd
mx: move get_arch() to mxtool
Bernhard Urban <bernhard.urban@jku.at>
parents:
16983
diff
changeset
|
209 infos['architecture'] = mx.get_arch() |
15405
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
210 infos['platform'] = mx.get_os() |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
211 |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
212 if mx.get_os != 'windows': |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
213 pass |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
214 # infos['ccompiler'] |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
215 # infos['linker'] |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
216 |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
217 infos['hostname'] = socket.gethostname() |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
218 |
15405
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
219 def _writeJson(suffix, properties): |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
220 d = infos.copy() |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
221 for k, v in properties.iteritems(): |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
222 assert not d.has_key(k) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
223 d[k] = v |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
224 |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
225 jsonFileName = 'export-' + suffix + '.json' |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
226 with open(jsonFileName, 'w') as f: |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
227 print >> f, json.dumps(d) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
228 return jsonFileName |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
229 |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
230 |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
231 def _genFileName(archivtype, middle): |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
232 idPrefix = infos['revision'] + '_' |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
233 idSuffix = '.tar.gz' |
15870
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15862
diff
changeset
|
234 return join(_graal_home, "graalvm_" + archivtype + "_" + idPrefix + middle + idSuffix) |
15405
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
235 |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
236 def _genFileArchPlatformName(archivtype, middle): |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
237 return _genFileName(archivtype, infos['platform'] + '_' + infos['architecture'] + '_' + middle) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
238 |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
239 |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
240 # archive different build types of hotspot |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
241 for vmBuild in _vmbuildChoices: |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
242 jdkpath = join(_jdksDir(), vmBuild) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
243 if not exists(jdkpath): |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
244 mx.logv("skipping " + vmBuild) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
245 continue |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
246 |
15405
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
247 tarName = _genFileArchPlatformName('basejdk', vmBuild) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
248 mx.logv("creating basejdk " + tarName) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
249 vmSet = set() |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
250 with tarfile.open(tarName, 'w:gz') as tar: |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
251 for root, _, files in os.walk(jdkpath): |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
252 if basename(root) in _vmChoices.keys(): |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
253 # TODO: add some assert to check path assumption |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
254 vmSet.add(root) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
255 continue |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
256 |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
257 for f in files: |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
258 name = join(root, f) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
259 # print name |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
260 tar.add(name, name) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
261 |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
262 n = _writeJson("basejdk-" + vmBuild, {'vmbuild' : vmBuild}) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
263 tar.add(n, n) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
264 |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
265 # create a separate archive for each VM |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
266 for vm in vmSet: |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
267 bVm = basename(vm) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
268 vmTarName = _genFileArchPlatformName('vm', vmBuild + '_' + bVm) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
269 mx.logv("creating vm " + vmTarName) |
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
|
270 |
15405
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
271 debugFiles = set() |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
272 with tarfile.open(vmTarName, 'w:gz') as tar: |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
273 for root, _, files in os.walk(vm): |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
274 for f in files: |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
275 # TODO: mac, windows, solaris? |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
276 if any(map(f.endswith, [".debuginfo"])): |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
277 debugFiles.add(f) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
278 else: |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
279 name = join(root, f) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
280 # print name |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
281 tar.add(name, name) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
282 |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
283 n = _writeJson("vm-" + vmBuild + "-" + bVm, {'vmbuild' : vmBuild, 'vm' : bVm}) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
284 tar.add(n, n) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
285 |
15405
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
286 if len(debugFiles) > 0: |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
287 debugTarName = _genFileArchPlatformName('debugfilesvm', vmBuild + '_' + bVm) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
288 mx.logv("creating debugfilesvm " + debugTarName) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
289 with tarfile.open(debugTarName, 'w:gz') as tar: |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
290 for f in debugFiles: |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
291 name = join(root, f) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
292 # print name |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
293 tar.add(name, name) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
294 |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
295 n = _writeJson("debugfilesvm-" + vmBuild + "-" + bVm, {'vmbuild' : vmBuild, 'vm' : bVm}) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
296 tar.add(n, n) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
297 |
15405
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
298 # graal directory |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
299 graalDirTarName = _genFileName('classfiles', 'javac') |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
300 mx.logv("creating graal " + graalDirTarName) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
301 with tarfile.open(graalDirTarName, 'w:gz') as tar: |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
302 for root, _, files in os.walk("graal"): |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
303 for f in [f for f in files if not f.endswith('.java')]: |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
304 name = join(root, f) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
305 # print name |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
306 tar.add(name, name) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
307 |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
308 n = _writeJson("graal", {'javacompiler' : 'javac'}) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
309 tar.add(n, n) |
5dcf0ae606f3
mx: new export command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15404
diff
changeset
|
310 |
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
|
311 |
11367
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
312 def _run_benchmark(args, availableBenchmarks, runBenchmark): |
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
313 |
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
314 vmOpts, benchmarksAndOptions = _extract_VM_args(args, useDoubleDash=availableBenchmarks is None) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
315 |
11367
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
316 if availableBenchmarks is None: |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
317 harnessArgs = benchmarksAndOptions |
11367
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
318 return runBenchmark(None, harnessArgs, 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
|
319 |
11367
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
320 if len(benchmarksAndOptions) == 0: |
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
321 mx.abort('at least one benchmark name or "all" must be specified') |
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
322 benchmarks = list(itertools.takewhile(lambda x: not x.startswith('-'), benchmarksAndOptions)) |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
323 harnessArgs = benchmarksAndOptions[len(benchmarks):] |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
324 |
11367
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
325 if 'all' in benchmarks: |
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
326 benchmarks = availableBenchmarks |
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
327 else: |
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
328 for bm in benchmarks: |
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
329 if bm not in availableBenchmarks: |
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
330 mx.abort('unknown benchmark: ' + bm + '\nselect one of: ' + str(availableBenchmarks)) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
331 |
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
|
332 failed = [] |
11367
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
333 for bm in benchmarks: |
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
334 if not runBenchmark(bm, harnessArgs, vmOpts): |
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
335 failed.append(bm) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
336 |
4157
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
337 if len(failed) != 0: |
11367
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
338 mx.abort('Benchmark failures: ' + str(failed)) |
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
339 |
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
340 def dacapo(args): |
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
341 """run one or more DaCapo benchmarks""" |
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
342 |
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
343 def launcher(bm, harnessArgs, extraVmOpts): |
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
344 return sanitycheck.getDacapo(bm, harnessArgs).test(_get_vm(), extraVmOpts=extraVmOpts) |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
345 |
11367
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
346 _run_benchmark(args, sanitycheck.dacapoSanityWarmup.keys(), launcher) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
347 |
4480
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
348 def scaladacapo(args): |
11367
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
349 """run one or more 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
|
350 |
11367
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
351 def launcher(bm, harnessArgs, extraVmOpts): |
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
352 return sanitycheck.getScalaDacapo(bm, harnessArgs).test(_get_vm(), extraVmOpts=extraVmOpts) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
353 |
11367
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
354 _run_benchmark(args, sanitycheck.dacapoScalaSanityWarmup.keys(), launcher) |
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
|
355 |
4607
ee87cfe2f8f9
Made GraalVM build work on Mac OS X.
Doug Simon <doug.simon@oracle.com>
parents:
4602
diff
changeset
|
356 def _vmLibDirInJdk(jdk): |
ee87cfe2f8f9
Made GraalVM build work on Mac OS X.
Doug Simon <doug.simon@oracle.com>
parents:
4602
diff
changeset
|
357 """ |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
358 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
|
359 subdirectories are located. |
4607
ee87cfe2f8f9
Made GraalVM build work on Mac OS X.
Doug Simon <doug.simon@oracle.com>
parents:
4602
diff
changeset
|
360 """ |
17233
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
361 mxos = mx.get_os() |
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
362 if mxos == 'darwin': |
4607
ee87cfe2f8f9
Made GraalVM build work on Mac OS X.
Doug Simon <doug.simon@oracle.com>
parents:
4602
diff
changeset
|
363 return join(jdk, 'jre', 'lib') |
17233
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
364 if mxos == 'windows' or mxos == 'cygwin': |
5680
87fc13b59258
Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5649
diff
changeset
|
365 return join(jdk, 'jre', 'bin') |
17012
ad10671d1bbd
mx: move get_arch() to mxtool
Bernhard Urban <bernhard.urban@jku.at>
parents:
16983
diff
changeset
|
366 return join(jdk, 'jre', 'lib', mx.get_arch()) |
4607
ee87cfe2f8f9
Made GraalVM build work on Mac OS X.
Doug Simon <doug.simon@oracle.com>
parents:
4602
diff
changeset
|
367 |
17014
6a30738791f7
mx: add helper for determine jli location
Bernhard Urban <bernhard.urban@jku.at>
parents:
17012
diff
changeset
|
368 def _vmJliLibDirs(jdk): |
6a30738791f7
mx: add helper for determine jli location
Bernhard Urban <bernhard.urban@jku.at>
parents:
17012
diff
changeset
|
369 """ |
6a30738791f7
mx: add helper for determine jli location
Bernhard Urban <bernhard.urban@jku.at>
parents:
17012
diff
changeset
|
370 Get the directories within a JDK where the jli library designates to. |
6a30738791f7
mx: add helper for determine jli location
Bernhard Urban <bernhard.urban@jku.at>
parents:
17012
diff
changeset
|
371 """ |
17233
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
372 mxos = mx.get_os() |
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
373 if mxos == 'darwin': |
17014
6a30738791f7
mx: add helper for determine jli location
Bernhard Urban <bernhard.urban@jku.at>
parents:
17012
diff
changeset
|
374 return [join(jdk, 'jre', 'lib', 'jli')] |
17233
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
375 if mxos == 'windows' or mxos == 'cygwin': |
17014
6a30738791f7
mx: add helper for determine jli location
Bernhard Urban <bernhard.urban@jku.at>
parents:
17012
diff
changeset
|
376 return [join(jdk, 'jre', 'bin'), join(jdk, 'bin')] |
6a30738791f7
mx: add helper for determine jli location
Bernhard Urban <bernhard.urban@jku.at>
parents:
17012
diff
changeset
|
377 return [join(jdk, 'jre', 'lib', mx.get_arch(), 'jli'), join(jdk, 'lib', mx.get_arch(), 'jli')] |
6a30738791f7
mx: add helper for determine jli location
Bernhard Urban <bernhard.urban@jku.at>
parents:
17012
diff
changeset
|
378 |
17015
ffddcdca8e74
mx: support different name for jvm.cfg
Bernhard Urban <bernhard.urban@jku.at>
parents:
17014
diff
changeset
|
379 def _vmCfgInJdk(jdk, jvmCfgFile='jvm.cfg'): |
5680
87fc13b59258
Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5649
diff
changeset
|
380 """ |
87fc13b59258
Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5649
diff
changeset
|
381 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
|
382 """ |
17233
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
383 mxos = mx.get_os() |
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
384 if mxos == "windows" or mxos == "cygwin": |
17015
ffddcdca8e74
mx: support different name for jvm.cfg
Bernhard Urban <bernhard.urban@jku.at>
parents:
17014
diff
changeset
|
385 return join(jdk, 'jre', 'lib', mx.get_arch(), jvmCfgFile) |
ffddcdca8e74
mx: support different name for jvm.cfg
Bernhard Urban <bernhard.urban@jku.at>
parents:
17014
diff
changeset
|
386 return join(_vmLibDirInJdk(jdk), jvmCfgFile) |
5680
87fc13b59258
Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5649
diff
changeset
|
387 |
9119
0c9c4ae236b2
refactoring to ensure the path to the JDKs dir is consistent between the _jdk() and clean() command
Doug Simon <doug.simon@oracle.com>
parents:
9118
diff
changeset
|
388 def _jdksDir(): |
11401
2d228d304247
minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents:
11395
diff
changeset
|
389 return os.path.abspath(join(_installed_jdks if _installed_jdks else _graal_home, 'jdk' + str(mx.java().version))) |
9119
0c9c4ae236b2
refactoring to ensure the path to the JDKs dir is consistent between the _jdk() and clean() command
Doug Simon <doug.simon@oracle.com>
parents:
9118
diff
changeset
|
390 |
17055
3e4d3be0b6bf
mx: fix default handling of vm config and build type
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
17052
diff
changeset
|
391 def _handle_missing_VM(bld, vm=None): |
3e4d3be0b6bf
mx: fix default handling of vm config and build type
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
17052
diff
changeset
|
392 if not vm: |
3e4d3be0b6bf
mx: fix default handling of vm config and build type
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
17052
diff
changeset
|
393 vm = _get_vm() |
11296
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
394 mx.log('The ' + bld + ' ' + vm + ' VM has not been created') |
21169
41ec6d89cb84
mx: fix calls to is_interactive()
Andreas Woess <andreas.woess@oracle.com>
parents:
21166
diff
changeset
|
395 if mx.is_interactive(): |
11511
3110bea9a6b0
mx: add helper method for yes/no question
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11493
diff
changeset
|
396 if mx.ask_yes_no('Build it now', 'y'): |
11371
74414b248381
mx: added --vmbuild global option, removed --product, --fastdebug, --debug options as well as suffix of build command
Doug Simon <doug.simon@oracle.com>
parents:
11368
diff
changeset
|
397 with VM(vm, bld): |
74414b248381
mx: added --vmbuild global option, removed --product, --fastdebug, --debug options as well as suffix of build command
Doug Simon <doug.simon@oracle.com>
parents:
11368
diff
changeset
|
398 build([]) |
11296
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
399 return |
11493
94779c895aad
fixed documentation of --installed-jdks mx option
Doug Simon <doug.simon@oracle.com>
parents:
11424
diff
changeset
|
400 mx.abort('You need to run "mx --vm ' + vm + ' --vmbuild ' + bld + ' build" to build the selected VM') |
11296
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
401 |
17055
3e4d3be0b6bf
mx: fix default handling of vm config and build type
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
17052
diff
changeset
|
402 def _jdk(build=None, vmToCheck=None, create=False, installJars=True): |
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
|
403 """ |
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
|
404 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
|
405 """ |
17055
3e4d3be0b6bf
mx: fix default handling of vm config and build type
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
17052
diff
changeset
|
406 if not build: |
3e4d3be0b6bf
mx: fix default handling of vm config and build type
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
17052
diff
changeset
|
407 build = _vmbuild if _vmSourcesAvailable else 'product' |
9119
0c9c4ae236b2
refactoring to ensure the path to the JDKs dir is consistent between the _jdk() and clean() command
Doug Simon <doug.simon@oracle.com>
parents:
9118
diff
changeset
|
408 jdk = join(_jdksDir(), build) |
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
|
409 if create: |
10574
0cad5096735e
commands.py: Make sure _jdk returns an absolute path. Use _jdk and _jdksDir where necessary
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
10570
diff
changeset
|
410 srcJdk = mx.java().jdk |
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
|
411 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
|
412 mx.log('Creating ' + jdk + ' from ' + srcJdk) |
13525
7cbd4f2194aa
mx: omit weird logic to copy bootstrap jdk, just do cp -R
Bernhard Urban <bernhard.urban@jku.at>
parents:
13524
diff
changeset
|
413 shutil.copytree(srcJdk, jdk) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
414 |
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
|
415 # 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
|
416 # 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
|
417 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
|
418 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
|
419 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
|
420 |
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
|
421 defaultVM = None |
8647
5f8299106dd9
A server0 "build" needs to create a jdk copy if it does not exist yet
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8646
diff
changeset
|
422 jvmCfgLines = [] |
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
|
423 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
|
424 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
|
425 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
|
426 parts = line.split() |
12540
0aa37fd2f33e
mx: fix detection for sparc. ignore unparsable lines in jvm.cfg
Bernhard Urban <bernhard.urban@jku.at>
parents:
12497
diff
changeset
|
427 if len(parts) == 2: |
0aa37fd2f33e
mx: fix detection for sparc. ignore unparsable lines in jvm.cfg
Bernhard Urban <bernhard.urban@jku.at>
parents:
12497
diff
changeset
|
428 assert parts[1] == 'KNOWN', parts[1] |
0aa37fd2f33e
mx: fix detection for sparc. ignore unparsable lines in jvm.cfg
Bernhard Urban <bernhard.urban@jku.at>
parents:
12497
diff
changeset
|
429 defaultVM = parts[0][1:] |
0aa37fd2f33e
mx: fix detection for sparc. ignore unparsable lines in jvm.cfg
Bernhard Urban <bernhard.urban@jku.at>
parents:
12497
diff
changeset
|
430 jvmCfgLines += ['# default VM is a copy of the unmodified ' + defaultVM + ' VM\n'] |
0aa37fd2f33e
mx: fix detection for sparc. ignore unparsable lines in jvm.cfg
Bernhard Urban <bernhard.urban@jku.at>
parents:
12497
diff
changeset
|
431 jvmCfgLines += ['-original KNOWN\n'] |
0aa37fd2f33e
mx: fix detection for sparc. ignore unparsable lines in jvm.cfg
Bernhard Urban <bernhard.urban@jku.at>
parents:
12497
diff
changeset
|
432 else: |
0aa37fd2f33e
mx: fix detection for sparc. ignore unparsable lines in jvm.cfg
Bernhard Urban <bernhard.urban@jku.at>
parents:
12497
diff
changeset
|
433 # skip lines which we cannot parse (e.g. '-hotspot ALIASED_TO -client') |
12583
110c3faa57e9
mx: print warning if encounter a non-parsable line in jvm.cfg
Bernhard Urban <bernhard.urban@jku.at>
parents:
12540
diff
changeset
|
434 mx.log("WARNING: skipping not parsable line \"" + line + "\"") |
8647
5f8299106dd9
A server0 "build" needs to create a jdk copy if it does not exist yet
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8646
diff
changeset
|
435 else: |
5f8299106dd9
A server0 "build" needs to create a jdk copy if it does not exist yet
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8646
diff
changeset
|
436 jvmCfgLines += [line] |
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
|
437 |
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
|
438 assert defaultVM is not None, 'Could not find default VM in ' + jvmCfg |
17233
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
439 chmodRecursive(jdk, JDK_UNIX_PERMISSIONS_DIR) |
9117
cbfcb1054619
renamed 'boot' VM to 'original' VM
Doug Simon <doug.simon@oracle.com>
parents:
9116
diff
changeset
|
440 shutil.move(join(_vmLibDirInJdk(jdk), defaultVM), join(_vmLibDirInJdk(jdk), 'original')) |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
441 |
18733
d7ec30ebb0f2
Properly chmod files modified when creating JDK image
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18714
diff
changeset
|
442 if mx.get_os() != 'windows': |
d7ec30ebb0f2
Properly chmod files modified when creating JDK image
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18714
diff
changeset
|
443 os.chmod(jvmCfg, JDK_UNIX_PERMISSIONS_FILE) |
8261
2237260c6fdb
the contents of jvm.cfg are reset when copying the JDK so that the non-default VMs must be built before being run
Doug Simon <doug.simon@oracle.com>
parents:
8223
diff
changeset
|
444 with open(jvmCfg, 'w') as fp: |
8647
5f8299106dd9
A server0 "build" needs to create a jdk copy if it does not exist yet
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8646
diff
changeset
|
445 for line in jvmCfgLines: |
5f8299106dd9
A server0 "build" needs to create a jdk copy if it does not exist yet
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8646
diff
changeset
|
446 fp.write(line) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
447 |
13523
137142009b0b
mx: append graal revision to release file of jdk
Bernhard Urban <bernhard.urban@jku.at>
parents:
13522
diff
changeset
|
448 # patch 'release' file (append graalvm revision) |
137142009b0b
mx: append graal revision to release file of jdk
Bernhard Urban <bernhard.urban@jku.at>
parents:
13522
diff
changeset
|
449 releaseFile = join(jdk, 'release') |
137142009b0b
mx: append graal revision to release file of jdk
Bernhard Urban <bernhard.urban@jku.at>
parents:
13522
diff
changeset
|
450 if exists(releaseFile): |
137142009b0b
mx: append graal revision to release file of jdk
Bernhard Urban <bernhard.urban@jku.at>
parents:
13522
diff
changeset
|
451 releaseFileLines = [] |
137142009b0b
mx: append graal revision to release file of jdk
Bernhard Urban <bernhard.urban@jku.at>
parents:
13522
diff
changeset
|
452 with open(releaseFile) as f: |
137142009b0b
mx: append graal revision to release file of jdk
Bernhard Urban <bernhard.urban@jku.at>
parents:
13522
diff
changeset
|
453 for line in f: |
137142009b0b
mx: append graal revision to release file of jdk
Bernhard Urban <bernhard.urban@jku.at>
parents:
13522
diff
changeset
|
454 releaseFileLines.append(line) |
137142009b0b
mx: append graal revision to release file of jdk
Bernhard Urban <bernhard.urban@jku.at>
parents:
13522
diff
changeset
|
455 |
18733
d7ec30ebb0f2
Properly chmod files modified when creating JDK image
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18714
diff
changeset
|
456 if mx.get_os() != 'windows': |
d7ec30ebb0f2
Properly chmod files modified when creating JDK image
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18714
diff
changeset
|
457 os.chmod(releaseFile, JDK_UNIX_PERMISSIONS_FILE) |
13523
137142009b0b
mx: append graal revision to release file of jdk
Bernhard Urban <bernhard.urban@jku.at>
parents:
13522
diff
changeset
|
458 with open(releaseFile, 'w') as fp: |
137142009b0b
mx: append graal revision to release file of jdk
Bernhard Urban <bernhard.urban@jku.at>
parents:
13522
diff
changeset
|
459 for line in releaseFileLines: |
137142009b0b
mx: append graal revision to release file of jdk
Bernhard Urban <bernhard.urban@jku.at>
parents:
13522
diff
changeset
|
460 if line.startswith("SOURCE="): |
137142009b0b
mx: append graal revision to release file of jdk
Bernhard Urban <bernhard.urban@jku.at>
parents:
13522
diff
changeset
|
461 try: |
13695
b688e7da4c69
refined class path used by unittest to only include dependencies of the tests that will be run
Doug Simon <doug.simon@oracle.com>
parents:
13526
diff
changeset
|
462 sourceLine = line[0:-2] # remove last char |
13523
137142009b0b
mx: append graal revision to release file of jdk
Bernhard Urban <bernhard.urban@jku.at>
parents:
13522
diff
changeset
|
463 hgcfg = mx.HgConfig() |
137142009b0b
mx: append graal revision to release file of jdk
Bernhard Urban <bernhard.urban@jku.at>
parents:
13522
diff
changeset
|
464 hgcfg.check() |
13695
b688e7da4c69
refined class path used by unittest to only include dependencies of the tests that will be run
Doug Simon <doug.simon@oracle.com>
parents:
13526
diff
changeset
|
465 revision = hgcfg.tip('.')[:12] # take first 12 chars |
13523
137142009b0b
mx: append graal revision to release file of jdk
Bernhard Urban <bernhard.urban@jku.at>
parents:
13522
diff
changeset
|
466 fp.write(sourceLine + ' graal:' + revision + '\"\n') |
137142009b0b
mx: append graal revision to release file of jdk
Bernhard Urban <bernhard.urban@jku.at>
parents:
13522
diff
changeset
|
467 except: |
137142009b0b
mx: append graal revision to release file of jdk
Bernhard Urban <bernhard.urban@jku.at>
parents:
13522
diff
changeset
|
468 fp.write(line) |
137142009b0b
mx: append graal revision to release file of jdk
Bernhard Urban <bernhard.urban@jku.at>
parents:
13522
diff
changeset
|
469 else: |
137142009b0b
mx: append graal revision to release file of jdk
Bernhard Urban <bernhard.urban@jku.at>
parents:
13522
diff
changeset
|
470 fp.write(line) |
137142009b0b
mx: append graal revision to release file of jdk
Bernhard Urban <bernhard.urban@jku.at>
parents:
13522
diff
changeset
|
471 |
5596
e4b1bc5e29e0
hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents:
5517
diff
changeset
|
472 # 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
|
473 try: |
e4b1bc5e29e0
hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents:
5517
diff
changeset
|
474 hsdis([], copyToDir=_vmLibDirInJdk(jdk)) |
e4b1bc5e29e0
hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents:
5517
diff
changeset
|
475 except SystemExit: |
e4b1bc5e29e0
hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents:
5517
diff
changeset
|
476 pass |
3718 | 477 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
|
478 if not exists(jdk): |
11797
65dbed1fdf46
be verbose when the JDK specified by --installed-jdks is missing
Doug Simon <doug.simon@oracle.com>
parents:
11784
diff
changeset
|
479 if _installed_jdks: |
65dbed1fdf46
be verbose when the JDK specified by --installed-jdks is missing
Doug Simon <doug.simon@oracle.com>
parents:
11784
diff
changeset
|
480 mx.log("The selected JDK directory does not (yet) exist: " + jdk) |
17055
3e4d3be0b6bf
mx: fix default handling of vm config and build type
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
17052
diff
changeset
|
481 _handle_missing_VM(build, vmToCheck) |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
482 |
16623
addc0564e5b5
split com.oracle.graal.truffle.* projects into a separate graal-truffle.jar and added truffle.jar to the boot class path
Doug Simon <doug.simon@oracle.com>
parents:
16622
diff
changeset
|
483 if installJars: |
16902
0583d157992a
formalized the set of distribution jars that are installed into the JDK to ensure both mx and the HotSpot make system do the necessary deployment
Doug Simon <doug.simon@oracle.com>
parents:
16877
diff
changeset
|
484 for jdkDist in _jdkDeployedDists: |
0583d157992a
formalized the set of distribution jars that are installed into the JDK to ensure both mx and the HotSpot make system do the necessary deployment
Doug Simon <doug.simon@oracle.com>
parents:
16877
diff
changeset
|
485 dist = mx.distribution(jdkDist.name) |
16875
73d994651fcd
fixed regression when building original VM without a Java build beforehand
Doug Simon <doug.simon@oracle.com>
parents:
16863
diff
changeset
|
486 if exists(dist.path): |
21031
e1c063565b3c
Graal Services: use services files in jre/lib/graal/services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
20996
diff
changeset
|
487 _installDistInJdks(jdkDist) |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
488 |
8261
2237260c6fdb
the contents of jvm.cfg are reset when copying the JDK so that the non-default VMs must be built before being run
Doug Simon <doug.simon@oracle.com>
parents:
8223
diff
changeset
|
489 if vmToCheck is not None: |
2237260c6fdb
the contents of jvm.cfg are reset when copying the JDK so that the non-default VMs must be built before being run
Doug Simon <doug.simon@oracle.com>
parents:
8223
diff
changeset
|
490 jvmCfg = _vmCfgInJdk(jdk) |
2237260c6fdb
the contents of jvm.cfg are reset when copying the JDK so that the non-default VMs must be built before being run
Doug Simon <doug.simon@oracle.com>
parents:
8223
diff
changeset
|
491 found = False |
2237260c6fdb
the contents of jvm.cfg are reset when copying the JDK so that the non-default VMs must be built before being run
Doug Simon <doug.simon@oracle.com>
parents:
8223
diff
changeset
|
492 with open(jvmCfg) as f: |
2237260c6fdb
the contents of jvm.cfg are reset when copying the JDK so that the non-default VMs must be built before being run
Doug Simon <doug.simon@oracle.com>
parents:
8223
diff
changeset
|
493 for line in f: |
2237260c6fdb
the contents of jvm.cfg are reset when copying the JDK so that the non-default VMs must be built before being run
Doug Simon <doug.simon@oracle.com>
parents:
8223
diff
changeset
|
494 if line.strip() == '-' + vmToCheck + ' KNOWN': |
2237260c6fdb
the contents of jvm.cfg are reset when copying the JDK so that the non-default VMs must be built before being run
Doug Simon <doug.simon@oracle.com>
parents:
8223
diff
changeset
|
495 found = True |
2237260c6fdb
the contents of jvm.cfg are reset when copying the JDK so that the non-default VMs must be built before being run
Doug Simon <doug.simon@oracle.com>
parents:
8223
diff
changeset
|
496 break |
2237260c6fdb
the contents of jvm.cfg are reset when copying the JDK so that the non-default VMs must be built before being run
Doug Simon <doug.simon@oracle.com>
parents:
8223
diff
changeset
|
497 if not found: |
11296
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
498 _handle_missing_VM(build, vmToCheck) |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
499 |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
500 return jdk |
4177
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
501 |
11936
4cdf7623fbe6
ensure graal.options in the JDK is deployed/updated/deleted each time the VM is run
Doug Simon <doug.simon@oracle.com>
parents:
11867
diff
changeset
|
502 def _updateInstalledGraalOptionsFile(jdk): |
4cdf7623fbe6
ensure graal.options in the JDK is deployed/updated/deleted each time the VM is run
Doug Simon <doug.simon@oracle.com>
parents:
11867
diff
changeset
|
503 graalOptions = join(_graal_home, 'graal.options') |
4cdf7623fbe6
ensure graal.options in the JDK is deployed/updated/deleted each time the VM is run
Doug Simon <doug.simon@oracle.com>
parents:
11867
diff
changeset
|
504 jreLibDir = join(jdk, 'jre', 'lib') |
4cdf7623fbe6
ensure graal.options in the JDK is deployed/updated/deleted each time the VM is run
Doug Simon <doug.simon@oracle.com>
parents:
11867
diff
changeset
|
505 if exists(graalOptions): |
4cdf7623fbe6
ensure graal.options in the JDK is deployed/updated/deleted each time the VM is run
Doug Simon <doug.simon@oracle.com>
parents:
11867
diff
changeset
|
506 shutil.copy(graalOptions, join(jreLibDir, 'graal.options')) |
4cdf7623fbe6
ensure graal.options in the JDK is deployed/updated/deleted each time the VM is run
Doug Simon <doug.simon@oracle.com>
parents:
11867
diff
changeset
|
507 else: |
4cdf7623fbe6
ensure graal.options in the JDK is deployed/updated/deleted each time the VM is run
Doug Simon <doug.simon@oracle.com>
parents:
11867
diff
changeset
|
508 toDelete = join(jreLibDir, 'graal.options') |
4cdf7623fbe6
ensure graal.options in the JDK is deployed/updated/deleted each time the VM is run
Doug Simon <doug.simon@oracle.com>
parents:
11867
diff
changeset
|
509 if exists(toDelete): |
4cdf7623fbe6
ensure graal.options in the JDK is deployed/updated/deleted each time the VM is run
Doug Simon <doug.simon@oracle.com>
parents:
11867
diff
changeset
|
510 os.unlink(toDelete) |
4cdf7623fbe6
ensure graal.options in the JDK is deployed/updated/deleted each time the VM is run
Doug Simon <doug.simon@oracle.com>
parents:
11867
diff
changeset
|
511 |
16605
c55478e640e1
generalized check that VM is up-to-date with all generated sources
Doug Simon <doug.simon@oracle.com>
parents:
16600
diff
changeset
|
512 def _makeHotspotGeneratedSourcesDir(): |
16628
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16627
diff
changeset
|
513 """ |
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16627
diff
changeset
|
514 Gets the directory containing all the HotSpot sources generated from |
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16627
diff
changeset
|
515 Graal Java sources. This directory will be created if it doesn't yet exist. |
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16627
diff
changeset
|
516 """ |
16600
6e7311d571ff
modify the 'mx vm' command to check that the VM is up-to-date with respect to graalRuntime.inline.hpp
Doug Simon <doug.simon@oracle.com>
parents:
16599
diff
changeset
|
517 hsSrcGenDir = join(mx.project('com.oracle.graal.hotspot').source_gen_dir(), 'hotspot') |
6e7311d571ff
modify the 'mx vm' command to check that the VM is up-to-date with respect to graalRuntime.inline.hpp
Doug Simon <doug.simon@oracle.com>
parents:
16599
diff
changeset
|
518 if not exists(hsSrcGenDir): |
6e7311d571ff
modify the 'mx vm' command to check that the VM is up-to-date with respect to graalRuntime.inline.hpp
Doug Simon <doug.simon@oracle.com>
parents:
16599
diff
changeset
|
519 os.makedirs(hsSrcGenDir) |
16605
c55478e640e1
generalized check that VM is up-to-date with all generated sources
Doug Simon <doug.simon@oracle.com>
parents:
16600
diff
changeset
|
520 return hsSrcGenDir |
c55478e640e1
generalized check that VM is up-to-date with all generated sources
Doug Simon <doug.simon@oracle.com>
parents:
16600
diff
changeset
|
521 |
16628
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16627
diff
changeset
|
522 def _update_graalRuntime_inline_hpp(dist): |
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16627
diff
changeset
|
523 """ |
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16627
diff
changeset
|
524 (Re)generates graalRuntime.inline.hpp based on a given distribution |
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16627
diff
changeset
|
525 that transitively represents all the input for the generation process. |
16605
c55478e640e1
generalized check that VM is up-to-date with all generated sources
Doug Simon <doug.simon@oracle.com>
parents:
16600
diff
changeset
|
526 |
16628
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16627
diff
changeset
|
527 A SHA1 digest is computed for all generated content and is written to |
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16627
diff
changeset
|
528 graalRuntime.inline.hpp as well as stored in a generated class |
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16627
diff
changeset
|
529 that is appended to the dist.path jar. At runtime, these two digests |
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16627
diff
changeset
|
530 are checked for consistency. |
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16627
diff
changeset
|
531 """ |
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16627
diff
changeset
|
532 |
15940
d676c4beeab8
renamed project (and package) com.oracle.graal.hotspot.codegen to com.oracle.graal.hotspot.sourcegen
Doug Simon <doug.simon@oracle.com>
parents:
15917
diff
changeset
|
533 p = mx.project('com.oracle.graal.hotspot.sourcegen') |
d676c4beeab8
renamed project (and package) com.oracle.graal.hotspot.codegen to com.oracle.graal.hotspot.sourcegen
Doug Simon <doug.simon@oracle.com>
parents:
15917
diff
changeset
|
534 mainClass = 'com.oracle.graal.hotspot.sourcegen.GenGraalRuntimeInlineHpp' |
15916
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
15896
diff
changeset
|
535 if exists(join(p.output_dir(), mainClass.replace('.', os.sep) + '.class')): |
16628
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16627
diff
changeset
|
536 genSrcDir = _makeHotspotGeneratedSourcesDir() |
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16627
diff
changeset
|
537 graalRuntime_inline_hpp = join(genSrcDir, 'graalRuntime.inline.hpp') |
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16627
diff
changeset
|
538 cp = os.pathsep.join([mx.distribution(d).path for d in dist.distDependencies] + [dist.path, p.output_dir()]) |
15896
db776f9bea7c
mx: prevent spurious "Could not find or load main class com.oracle.graal.hotspot.HotSpotOptionsLoader" error message
Doug Simon <doug.simon@oracle.com>
parents:
15873
diff
changeset
|
539 tmp = StringIO.StringIO() |
17262
b641450c19ce
mx: rename helper functions for cygwin support and update comments
Bernhard Urban <bernhard.urban@jku.at>
parents:
17233
diff
changeset
|
540 mx.run_java(['-cp', mx._separatedCygpathU2W(cp), mainClass], out=tmp.write) |
16628
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16627
diff
changeset
|
541 |
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16627
diff
changeset
|
542 # Compute SHA1 for currently generated graalRuntime.inline.hpp content |
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16627
diff
changeset
|
543 # and all other generated sources in genSrcDir |
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16627
diff
changeset
|
544 d = hashlib.sha1() |
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16627
diff
changeset
|
545 d.update(tmp.getvalue()) |
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16627
diff
changeset
|
546 for e in os.listdir(genSrcDir): |
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16627
diff
changeset
|
547 if e != 'graalRuntime.inline.hpp': |
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16627
diff
changeset
|
548 with open(join(genSrcDir, e)) as fp: |
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16627
diff
changeset
|
549 d.update(fp.read()) |
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16627
diff
changeset
|
550 sha1 = d.hexdigest() |
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16627
diff
changeset
|
551 |
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16627
diff
changeset
|
552 # Add SHA1 to end of graalRuntime.inline.hpp |
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16627
diff
changeset
|
553 print >> tmp, '' |
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16627
diff
changeset
|
554 print >> tmp, 'const char* GraalRuntime::_generated_sources_sha1 = "' + sha1 + '";' |
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16627
diff
changeset
|
555 |
16600
6e7311d571ff
modify the 'mx vm' command to check that the VM is up-to-date with respect to graalRuntime.inline.hpp
Doug Simon <doug.simon@oracle.com>
parents:
16599
diff
changeset
|
556 mx.update_file(graalRuntime_inline_hpp, tmp.getvalue()) |
6e7311d571ff
modify the 'mx vm' command to check that the VM is up-to-date with respect to graalRuntime.inline.hpp
Doug Simon <doug.simon@oracle.com>
parents:
16599
diff
changeset
|
557 |
16628
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16627
diff
changeset
|
558 # Store SHA1 in generated Java class and append class to specified jar |
18711
88c280297bd2
put GeneratedSourcesSha1 into com.oracle.graal.hotspot.sourcegen package
Doug Simon <doug.simon@oracle.com>
parents:
18709
diff
changeset
|
559 javaPackageName = 'com.oracle.graal.hotspot.sourcegen' |
88c280297bd2
put GeneratedSourcesSha1 into com.oracle.graal.hotspot.sourcegen package
Doug Simon <doug.simon@oracle.com>
parents:
18709
diff
changeset
|
560 javaClassName = javaPackageName + '.GeneratedSourcesSha1' |
16628
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16627
diff
changeset
|
561 javaSource = join(_graal_home, 'GeneratedSourcesSha1.java') |
18711
88c280297bd2
put GeneratedSourcesSha1 into com.oracle.graal.hotspot.sourcegen package
Doug Simon <doug.simon@oracle.com>
parents:
18709
diff
changeset
|
562 javaClass = join(_graal_home, javaClassName.replace('.', os.path.sep) + '.class') |
16629
be59a1d39281
respect dependency order between distributions when building them
Doug Simon <doug.simon@oracle.com>
parents:
16628
diff
changeset
|
563 with open(javaSource, 'w') as fp: |
18711
88c280297bd2
put GeneratedSourcesSha1 into com.oracle.graal.hotspot.sourcegen package
Doug Simon <doug.simon@oracle.com>
parents:
18709
diff
changeset
|
564 print >> fp, 'package ' + javaPackageName + ';' |
16628
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16627
diff
changeset
|
565 print >> fp, 'class GeneratedSourcesSha1 { private static final String value = "' + sha1 + '"; }' |
17262
b641450c19ce
mx: rename helper functions for cygwin support and update comments
Bernhard Urban <bernhard.urban@jku.at>
parents:
17233
diff
changeset
|
566 subprocess.check_call([mx.java().javac, '-d', mx._cygpathU2W(_graal_home), mx._cygpathU2W(javaSource)], stderr=subprocess.PIPE, stdout=subprocess.PIPE) |
16628
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16627
diff
changeset
|
567 zf = zipfile.ZipFile(dist.path, 'a') |
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16627
diff
changeset
|
568 with open(javaClass, 'rb') as fp: |
18711
88c280297bd2
put GeneratedSourcesSha1 into com.oracle.graal.hotspot.sourcegen package
Doug Simon <doug.simon@oracle.com>
parents:
18709
diff
changeset
|
569 zf.writestr(javaClassName.replace('.', '/') + '.class', fp.read()) |
16628
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16627
diff
changeset
|
570 zf.close() |
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16627
diff
changeset
|
571 os.unlink(javaSource) |
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16627
diff
changeset
|
572 os.unlink(javaClass) |
18711
88c280297bd2
put GeneratedSourcesSha1 into com.oracle.graal.hotspot.sourcegen package
Doug Simon <doug.simon@oracle.com>
parents:
18709
diff
changeset
|
573 javaClassParent = os.path.dirname(javaClass) |
88c280297bd2
put GeneratedSourcesSha1 into com.oracle.graal.hotspot.sourcegen package
Doug Simon <doug.simon@oracle.com>
parents:
18709
diff
changeset
|
574 while len(os.listdir(javaClassParent)) == 0: |
88c280297bd2
put GeneratedSourcesSha1 into com.oracle.graal.hotspot.sourcegen package
Doug Simon <doug.simon@oracle.com>
parents:
18709
diff
changeset
|
575 os.rmdir(javaClassParent) |
88c280297bd2
put GeneratedSourcesSha1 into com.oracle.graal.hotspot.sourcegen package
Doug Simon <doug.simon@oracle.com>
parents:
18709
diff
changeset
|
576 javaClassParent = os.path.dirname(javaClassParent) |
15870
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15862
diff
changeset
|
577 |
16863
0d2e3399acfe
mx: add argument for permissions to copyToJdk()
Danilo Ansaloni <danilo.ansaloni@oracle.com>
parents:
16862
diff
changeset
|
578 def _copyToJdk(src, dst, permissions=JDK_UNIX_PERMISSIONS_FILE): |
16782
9f5e33cf8d52
Factored out the '_copyToJdk' function and allow copying files to jre/lib/ext.
Danilo Ansaloni <danilo.ansaloni@oracle.com>
parents:
16729
diff
changeset
|
579 name = os.path.basename(src) |
9f5e33cf8d52
Factored out the '_copyToJdk' function and allow copying files to jre/lib/ext.
Danilo Ansaloni <danilo.ansaloni@oracle.com>
parents:
16729
diff
changeset
|
580 dstLib = join(dst, name) |
9f5e33cf8d52
Factored out the '_copyToJdk' function and allow copying files to jre/lib/ext.
Danilo Ansaloni <danilo.ansaloni@oracle.com>
parents:
16729
diff
changeset
|
581 if mx.get_env('SYMLINK_GRAAL_JAR', None) == 'true': |
9f5e33cf8d52
Factored out the '_copyToJdk' function and allow copying files to jre/lib/ext.
Danilo Ansaloni <danilo.ansaloni@oracle.com>
parents:
16729
diff
changeset
|
582 # Using symlinks is much faster than copying but may |
9f5e33cf8d52
Factored out the '_copyToJdk' function and allow copying files to jre/lib/ext.
Danilo Ansaloni <danilo.ansaloni@oracle.com>
parents:
16729
diff
changeset
|
583 # cause issues if the lib is being updated while |
9f5e33cf8d52
Factored out the '_copyToJdk' function and allow copying files to jre/lib/ext.
Danilo Ansaloni <danilo.ansaloni@oracle.com>
parents:
16729
diff
changeset
|
584 # the VM is running. |
9f5e33cf8d52
Factored out the '_copyToJdk' function and allow copying files to jre/lib/ext.
Danilo Ansaloni <danilo.ansaloni@oracle.com>
parents:
16729
diff
changeset
|
585 if not os.path.islink(dstLib) or not os.path.realpath(dstLib) == src: |
9f5e33cf8d52
Factored out the '_copyToJdk' function and allow copying files to jre/lib/ext.
Danilo Ansaloni <danilo.ansaloni@oracle.com>
parents:
16729
diff
changeset
|
586 if exists(dstLib): |
9f5e33cf8d52
Factored out the '_copyToJdk' function and allow copying files to jre/lib/ext.
Danilo Ansaloni <danilo.ansaloni@oracle.com>
parents:
16729
diff
changeset
|
587 os.remove(dstLib) |
16858
a8af2abc2039
fixed regression in mx causing problems for the SYMLINK_GRAAL_JAR feature
Doug Simon <doug.simon@oracle.com>
parents:
16782
diff
changeset
|
588 os.symlink(src, dstLib) |
16782
9f5e33cf8d52
Factored out the '_copyToJdk' function and allow copying files to jre/lib/ext.
Danilo Ansaloni <danilo.ansaloni@oracle.com>
parents:
16729
diff
changeset
|
589 else: |
9f5e33cf8d52
Factored out the '_copyToJdk' function and allow copying files to jre/lib/ext.
Danilo Ansaloni <danilo.ansaloni@oracle.com>
parents:
16729
diff
changeset
|
590 # do a copy and then a move to get atomic updating (on Unix) |
9f5e33cf8d52
Factored out the '_copyToJdk' function and allow copying files to jre/lib/ext.
Danilo Ansaloni <danilo.ansaloni@oracle.com>
parents:
16729
diff
changeset
|
591 fd, tmp = tempfile.mkstemp(suffix='', prefix=name, dir=dst) |
9f5e33cf8d52
Factored out the '_copyToJdk' function and allow copying files to jre/lib/ext.
Danilo Ansaloni <danilo.ansaloni@oracle.com>
parents:
16729
diff
changeset
|
592 shutil.copyfile(src, tmp) |
9f5e33cf8d52
Factored out the '_copyToJdk' function and allow copying files to jre/lib/ext.
Danilo Ansaloni <danilo.ansaloni@oracle.com>
parents:
16729
diff
changeset
|
593 os.close(fd) |
9f5e33cf8d52
Factored out the '_copyToJdk' function and allow copying files to jre/lib/ext.
Danilo Ansaloni <danilo.ansaloni@oracle.com>
parents:
16729
diff
changeset
|
594 shutil.move(tmp, dstLib) |
16863
0d2e3399acfe
mx: add argument for permissions to copyToJdk()
Danilo Ansaloni <danilo.ansaloni@oracle.com>
parents:
16862
diff
changeset
|
595 os.chmod(dstLib, permissions) |
16782
9f5e33cf8d52
Factored out the '_copyToJdk' function and allow copying files to jre/lib/ext.
Danilo Ansaloni <danilo.ansaloni@oracle.com>
parents:
16729
diff
changeset
|
596 |
21104
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
597 def _eraseGenerics(className): |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
598 if '<' in className: |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
599 return className[:className.index('<')] |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
600 return className |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
601 |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
602 def _classifyGraalServices(classNames, graalJars): |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
603 classification = {} |
21118
ae4941602cfa
mx: fix crash when there are no services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21105
diff
changeset
|
604 if not classNames: |
ae4941602cfa
mx: fix crash when there are no services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21105
diff
changeset
|
605 return classification |
21104
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
606 for className in classNames: |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
607 classification[className] = None |
21098
5d09e1eda922
Only extract service files for Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21070
diff
changeset
|
608 javap = mx.java().javap |
21104
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
609 output = subprocess.check_output([javap, '-cp', os.pathsep.join(graalJars)] + classNames, stderr=subprocess.STDOUT) |
21098
5d09e1eda922
Only extract service files for Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21070
diff
changeset
|
610 lines = output.split(os.linesep) |
5d09e1eda922
Only extract service files for Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21070
diff
changeset
|
611 for line in lines: |
21104
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
612 if line.startswith('public interface '): |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
613 declLine = line[len('public interface '):].strip() |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
614 for className in classNames: |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
615 if declLine.startswith(className): |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
616 assert classification[className] is None |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
617 afterName = declLine[len(className):] |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
618 if not afterName.startswith(' extends '): |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
619 classification[className] = False |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
620 break |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
621 superInterfaces = afterName[len(' extends '):-len(' {')].split(',') |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
622 if 'com.oracle.graal.api.runtime.Service' in superInterfaces: |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
623 classification[className] = True |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
624 break |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
625 maybe = [_eraseGenerics(superInterface) for superInterface in superInterfaces] |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
626 classification[className] = maybe |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
627 break |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
628 for className, v in classification.items(): |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
629 if v is None: |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
630 mx.abort('Could not find interface for service ' + className + ':\n' + output) |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
631 return classification |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
632 |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
633 def _extractMaybes(classification): |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
634 maybes = [] |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
635 for v in classification.values(): |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
636 if isinstance(v, list): |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
637 maybes.extend(v) |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
638 return maybes |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
639 |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
640 def _mergeClassification(classification, newClassification): |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
641 for className, value in classification.items(): |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
642 if isinstance(value, list): |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
643 classification[className] = None |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
644 for superInterface in value: |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
645 if newClassification[superInterface] is True: |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
646 classification[className] = True |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
647 break |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
648 elif newClassification[superInterface] is False: |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
649 if classification[className] is None: |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
650 classification[className] = False |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
651 else: |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
652 if not classification[className]: |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
653 classification[className] = [] |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
654 classification[className].extend(newClassification[superInterface]) |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
655 |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
656 def _filterGraalService(classNames, graalJars): |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
657 classification = _classifyGraalServices(classNames, graalJars) |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
658 needClassification = _extractMaybes(classification) |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
659 while needClassification: |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
660 _mergeClassification(classification, _classifyGraalServices(needClassification, graalJars)) |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
661 needClassification = _extractMaybes(classification) |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
662 filtered = [] |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
663 for className in classNames: |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
664 if classification[className] is True: |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
665 filtered.append(className) |
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
666 return filtered |
21098
5d09e1eda922
Only extract service files for Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21070
diff
changeset
|
667 |
21099
3f51d02e536f
Make should export graal service files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21098
diff
changeset
|
668 def _extractGraalServiceFiles(graalJars, destination, cleanDestination=True): |
3f51d02e536f
Make should export graal service files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21098
diff
changeset
|
669 if cleanDestination: |
3f51d02e536f
Make should export graal service files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21098
diff
changeset
|
670 if exists(destination): |
3f51d02e536f
Make should export graal service files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21098
diff
changeset
|
671 shutil.rmtree(destination) |
3f51d02e536f
Make should export graal service files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21098
diff
changeset
|
672 os.makedirs(destination) |
21105
db2de6c2bf95
mx create each service file atomically
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21104
diff
changeset
|
673 servicesMap = {} |
21070
2ee48d02afe3
mx: Merge graal service files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21059
diff
changeset
|
674 for jar in graalJars: |
2ee48d02afe3
mx: Merge graal service files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21059
diff
changeset
|
675 if os.path.isfile(jar): |
2ee48d02afe3
mx: Merge graal service files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21059
diff
changeset
|
676 with zipfile.ZipFile(jar) as zf: |
2ee48d02afe3
mx: Merge graal service files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21059
diff
changeset
|
677 for member in zf.namelist(): |
2ee48d02afe3
mx: Merge graal service files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21059
diff
changeset
|
678 if not member.startswith('META-INF/services'): |
2ee48d02afe3
mx: Merge graal service files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21059
diff
changeset
|
679 continue |
2ee48d02afe3
mx: Merge graal service files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21059
diff
changeset
|
680 serviceName = basename(member) |
2ee48d02afe3
mx: Merge graal service files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21059
diff
changeset
|
681 # we don't handle directories |
21098
5d09e1eda922
Only extract service files for Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21070
diff
changeset
|
682 assert serviceName and member == 'META-INF/services/' + serviceName |
21070
2ee48d02afe3
mx: Merge graal service files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21059
diff
changeset
|
683 with zf.open(member) as serviceFile: |
21105
db2de6c2bf95
mx create each service file atomically
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21104
diff
changeset
|
684 serviceImpls = servicesMap.setdefault(serviceName, []) |
21122
7f78f999512a
mx: services: make sure we don't produce empty lines
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21118
diff
changeset
|
685 for line in serviceFile.readlines(): |
7f78f999512a
mx: services: make sure we don't produce empty lines
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21118
diff
changeset
|
686 line = line.strip() |
7f78f999512a
mx: services: make sure we don't produce empty lines
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21118
diff
changeset
|
687 if line: |
7f78f999512a
mx: services: make sure we don't produce empty lines
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21118
diff
changeset
|
688 serviceImpls.append(line) |
21105
db2de6c2bf95
mx create each service file atomically
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21104
diff
changeset
|
689 graalServices = _filterGraalService(servicesMap.keys(), graalJars) |
db2de6c2bf95
mx create each service file atomically
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21104
diff
changeset
|
690 for serviceName in graalServices: |
db2de6c2bf95
mx create each service file atomically
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21104
diff
changeset
|
691 serviceImpls = servicesMap[serviceName] |
db2de6c2bf95
mx create each service file atomically
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21104
diff
changeset
|
692 fd, tmp = tempfile.mkstemp(prefix=serviceName) |
db2de6c2bf95
mx create each service file atomically
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21104
diff
changeset
|
693 f = os.fdopen(fd, 'w+') |
db2de6c2bf95
mx create each service file atomically
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21104
diff
changeset
|
694 for serviceImpl in serviceImpls: |
21122
7f78f999512a
mx: services: make sure we don't produce empty lines
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21118
diff
changeset
|
695 f.write(serviceImpl + os.linesep) |
21105
db2de6c2bf95
mx create each service file atomically
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21104
diff
changeset
|
696 target = join(destination, serviceName) |
db2de6c2bf95
mx create each service file atomically
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21104
diff
changeset
|
697 f.close() |
db2de6c2bf95
mx create each service file atomically
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21104
diff
changeset
|
698 shutil.move(tmp, target) |
db2de6c2bf95
mx create each service file atomically
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21104
diff
changeset
|
699 if mx.get_os() != 'windows': |
db2de6c2bf95
mx create each service file atomically
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21104
diff
changeset
|
700 os.chmod(target, JDK_UNIX_PERMISSIONS_FILE) |
21104
9690597d7a29
Group javap queries to discover Graal services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21099
diff
changeset
|
701 return graalServices |
21099
3f51d02e536f
Make should export graal service files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21098
diff
changeset
|
702 |
3f51d02e536f
Make should export graal service files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21098
diff
changeset
|
703 def _updateGraalServiceFiles(jdkDir): |
3f51d02e536f
Make should export graal service files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21098
diff
changeset
|
704 jreGraalDir = join(jdkDir, 'jre', 'lib', 'graal') |
3f51d02e536f
Make should export graal service files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21098
diff
changeset
|
705 graalJars = [join(jreGraalDir, e) for e in os.listdir(jreGraalDir) if e.startswith('graal') and e.endswith('.jar')] |
3f51d02e536f
Make should export graal service files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21098
diff
changeset
|
706 jreGraalServicesDir = join(jreGraalDir, 'services') |
3f51d02e536f
Make should export graal service files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21098
diff
changeset
|
707 _extractGraalServiceFiles(graalJars, jreGraalServicesDir) |
21070
2ee48d02afe3
mx: Merge graal service files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21059
diff
changeset
|
708 |
2ee48d02afe3
mx: Merge graal service files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21059
diff
changeset
|
709 |
2ee48d02afe3
mx: Merge graal service files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21059
diff
changeset
|
710 |
21031
e1c063565b3c
Graal Services: use services files in jre/lib/graal/services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
20996
diff
changeset
|
711 def _installDistInJdks(deployableDist): |
16623
addc0564e5b5
split com.oracle.graal.truffle.* projects into a separate graal-truffle.jar and added truffle.jar to the boot class path
Doug Simon <doug.simon@oracle.com>
parents:
16622
diff
changeset
|
712 """ |
addc0564e5b5
split com.oracle.graal.truffle.* projects into a separate graal-truffle.jar and added truffle.jar to the boot class path
Doug Simon <doug.simon@oracle.com>
parents:
16622
diff
changeset
|
713 Installs the jar(s) for a given Distribution into all existing Graal JDKs |
addc0564e5b5
split com.oracle.graal.truffle.* projects into a separate graal-truffle.jar and added truffle.jar to the boot class path
Doug Simon <doug.simon@oracle.com>
parents:
16622
diff
changeset
|
714 """ |
addc0564e5b5
split com.oracle.graal.truffle.* projects into a separate graal-truffle.jar and added truffle.jar to the boot class path
Doug Simon <doug.simon@oracle.com>
parents:
16622
diff
changeset
|
715 |
21031
e1c063565b3c
Graal Services: use services files in jre/lib/graal/services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
20996
diff
changeset
|
716 dist = mx.distribution(deployableDist.name) |
e1c063565b3c
Graal Services: use services files in jre/lib/graal/services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
20996
diff
changeset
|
717 |
16623
addc0564e5b5
split com.oracle.graal.truffle.* projects into a separate graal-truffle.jar and added truffle.jar to the boot class path
Doug Simon <doug.simon@oracle.com>
parents:
16622
diff
changeset
|
718 if dist.name == 'GRAAL_TRUFFLE': |
18709
ae5033a78f1d
improved documentation around the mechanism for generating graalRuntime.inline.hpp
Doug Simon <doug.simon@oracle.com>
parents:
18637
diff
changeset
|
719 # The content in graalRuntime.inline.hpp is generated from Graal |
ae5033a78f1d
improved documentation around the mechanism for generating graalRuntime.inline.hpp
Doug Simon <doug.simon@oracle.com>
parents:
18637
diff
changeset
|
720 # classes that implement com.oracle.graal.api.runtime.Service |
ae5033a78f1d
improved documentation around the mechanism for generating graalRuntime.inline.hpp
Doug Simon <doug.simon@oracle.com>
parents:
18637
diff
changeset
|
721 # or contain com.oracle.graal.options.Option annotated fields. |
ae5033a78f1d
improved documentation around the mechanism for generating graalRuntime.inline.hpp
Doug Simon <doug.simon@oracle.com>
parents:
18637
diff
changeset
|
722 # Since GRAAL_TRUFFLE is the leaf most distribution containing |
ae5033a78f1d
improved documentation around the mechanism for generating graalRuntime.inline.hpp
Doug Simon <doug.simon@oracle.com>
parents:
18637
diff
changeset
|
723 # such classes, the generation is triggered when GRAAL_TRUFFLE |
ae5033a78f1d
improved documentation around the mechanism for generating graalRuntime.inline.hpp
Doug Simon <doug.simon@oracle.com>
parents:
18637
diff
changeset
|
724 # is (re)built. |
16628
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16627
diff
changeset
|
725 _update_graalRuntime_inline_hpp(dist) |
10574
0cad5096735e
commands.py: Make sure _jdk returns an absolute path. Use _jdk and _jdksDir where necessary
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
10570
diff
changeset
|
726 jdks = _jdksDir() |
14930
5c7718ae8c86
install graal.jar into local Maven repo if MAVEN_INSTALL_GRAAL_JAR environment variable is "true"
Doug Simon <doug.simon@oracle.com>
parents:
14918
diff
changeset
|
727 |
8134
6e3ebc6fd5a4
graal.jar is installed in all JDKs every time it is updated (GRAAL-136)
Doug Simon <doug.simon@oracle.com>
parents:
8132
diff
changeset
|
728 if exists(jdks): |
6e3ebc6fd5a4
graal.jar is installed in all JDKs every time it is updated (GRAAL-136)
Doug Simon <doug.simon@oracle.com>
parents:
8132
diff
changeset
|
729 for e in os.listdir(jdks): |
21070
2ee48d02afe3
mx: Merge graal service files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21059
diff
changeset
|
730 jdkDir = join(jdks, e) |
2ee48d02afe3
mx: Merge graal service files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21059
diff
changeset
|
731 jreLibDir = join(jdkDir, 'jre', 'lib') |
8134
6e3ebc6fd5a4
graal.jar is installed in all JDKs every time it is updated (GRAAL-136)
Doug Simon <doug.simon@oracle.com>
parents:
8132
diff
changeset
|
732 if exists(jreLibDir): |
21040
12e94cba3696
Graal Loader: load all jars matching lib/graal/graal*.jar
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21032
diff
changeset
|
733 if deployableDist.isExtension: |
12e94cba3696
Graal Loader: load all jars matching lib/graal/graal*.jar
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21032
diff
changeset
|
734 targetDir = join(jreLibDir, 'ext') |
12e94cba3696
Graal Loader: load all jars matching lib/graal/graal*.jar
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21032
diff
changeset
|
735 elif deployableDist.isGraalClassLoader: |
12e94cba3696
Graal Loader: load all jars matching lib/graal/graal*.jar
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21032
diff
changeset
|
736 targetDir = join(jreLibDir, 'graal') |
12e94cba3696
Graal Loader: load all jars matching lib/graal/graal*.jar
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21032
diff
changeset
|
737 else: |
12e94cba3696
Graal Loader: load all jars matching lib/graal/graal*.jar
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21032
diff
changeset
|
738 targetDir = jreLibDir |
12e94cba3696
Graal Loader: load all jars matching lib/graal/graal*.jar
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21032
diff
changeset
|
739 if not exists(targetDir): |
12e94cba3696
Graal Loader: load all jars matching lib/graal/graal*.jar
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21032
diff
changeset
|
740 os.makedirs(targetDir) |
12e94cba3696
Graal Loader: load all jars matching lib/graal/graal*.jar
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21032
diff
changeset
|
741 _copyToJdk(dist.path, targetDir) |
16623
addc0564e5b5
split com.oracle.graal.truffle.* projects into a separate graal-truffle.jar and added truffle.jar to the boot class path
Doug Simon <doug.simon@oracle.com>
parents:
16622
diff
changeset
|
742 if dist.sourcesPath: |
21070
2ee48d02afe3
mx: Merge graal service files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21059
diff
changeset
|
743 _copyToJdk(dist.sourcesPath, jdkDir) |
21031
e1c063565b3c
Graal Services: use services files in jre/lib/graal/services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
20996
diff
changeset
|
744 if deployableDist.isGraalClassLoader: |
21070
2ee48d02afe3
mx: Merge graal service files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21059
diff
changeset
|
745 # deploy service files |
2ee48d02afe3
mx: Merge graal service files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21059
diff
changeset
|
746 _updateGraalServiceFiles(jdkDir) |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
747 |
4177
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
748 # run a command in the windows SDK Debug Shell |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
749 def _runInDebugShell(cmd, workingDir, logFile=None, findInOutput=None, respondTo=None): |
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
750 if respondTo is None: |
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
751 respondTo = {} |
4177
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
752 newLine = os.linesep |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
753 startToken = 'RUNINDEBUGSHELL_STARTSEQUENCE' |
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
754 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
|
755 |
4252
67e88b7624d5
Removed need for GRAAL environment variable on Windows.
Doug Simon <doug.simon@oracle.com>
parents:
4247
diff
changeset
|
756 winSDK = mx.get_env('WIN_SDK', 'C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\') |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
757 |
17262
b641450c19ce
mx: rename helper functions for cygwin support and update comments
Bernhard Urban <bernhard.urban@jku.at>
parents:
17233
diff
changeset
|
758 if not exists(mx._cygpathW2U(winSDK)): |
6306
2a819543cc45
Warnings for windows build if there is no SDK
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6294
diff
changeset
|
759 mx.abort("Could not find Windows SDK : '" + winSDK + "' does not exist") |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
760 |
17262
b641450c19ce
mx: rename helper functions for cygwin support and update comments
Bernhard Urban <bernhard.urban@jku.at>
parents:
17233
diff
changeset
|
761 winSDKSetEnv = mx._cygpathW2U(join(winSDK, 'Bin', 'SetEnv.cmd')) |
17233
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
762 if not exists(winSDKSetEnv): |
6306
2a819543cc45
Warnings for windows build if there is no SDK
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6294
diff
changeset
|
763 mx.abort("Invalid Windows SDK path (" + winSDK + ") : could not find Bin/SetEnv.cmd (you can use the WIN_SDK environment variable to specify an other path)") |
4252
67e88b7624d5
Removed need for GRAAL environment variable on Windows.
Doug Simon <doug.simon@oracle.com>
parents:
4247
diff
changeset
|
764 |
17262
b641450c19ce
mx: rename helper functions for cygwin support and update comments
Bernhard Urban <bernhard.urban@jku.at>
parents:
17233
diff
changeset
|
765 wincmd = 'cmd.exe /E:ON /V:ON /K "' + mx._cygpathU2W(winSDKSetEnv) + '"' |
17233
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
766 p = subprocess.Popen(wincmd, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
4269
ffd5ce8fc736
Moved IDE project configuration into mx.py.
Doug Simon <doug.simon@oracle.com>
parents:
4257
diff
changeset
|
767 stdout = p.stdout |
ffd5ce8fc736
Moved IDE project configuration into mx.py.
Doug Simon <doug.simon@oracle.com>
parents:
4257
diff
changeset
|
768 stdin = p.stdin |
4177
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
769 if logFile: |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
770 log = open(logFile, 'w') |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
771 ret = False |
17233
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
772 |
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
773 def _writeProcess(s): |
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
774 stdin.write(s + newLine) |
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
775 |
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
776 _writeProcess("echo " + startToken) |
4177
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
777 while True: |
7291
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
7290
diff
changeset
|
778 # encoding may be None on windows plattforms |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
7290
diff
changeset
|
779 if sys.stdout.encoding is None: |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
7290
diff
changeset
|
780 encoding = 'utf-8' |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
7290
diff
changeset
|
781 else: |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
7290
diff
changeset
|
782 encoding = sys.stdout.encoding |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
783 |
7291
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
7290
diff
changeset
|
784 line = stdout.readline().decode(encoding) |
4177
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
785 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
|
786 log.write(line.encode('utf-8')) |
4177
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
787 line = line.strip() |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
788 mx.log(line) |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
789 if line == startToken: |
17233
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
790 _writeProcess('cd /D ' + workingDir + ' & ' + cmd + ' & echo ' + endToken) |
4177
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
791 for regex in respondTo.keys(): |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
792 match = regex.search(line) |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
793 if match: |
17233
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
794 _writeProcess(respondTo[regex]) |
4177
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
795 if findInOutput: |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
796 match = findInOutput.search(line) |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
797 if match: |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
798 ret = True |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
799 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
|
800 if not findInOutput: |
17233
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
801 _writeProcess('echo ERRXXX%errorlevel%') |
5680
87fc13b59258
Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5649
diff
changeset
|
802 else: |
87fc13b59258
Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5649
diff
changeset
|
803 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
|
804 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
|
805 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
|
806 ret = True |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
807 break |
17233
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
808 _writeProcess("exit") |
4177
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
809 if logFile: |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
810 log.close() |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
811 return ret |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
812 |
11605
3676540f71cf
Allow mxtool suites to be in separate repositories (CR-1367)
Mick Jordan <mick.jordan@oracle.com>
parents:
11534
diff
changeset
|
813 def jdkhome(vm=None): |
3676540f71cf
Allow mxtool suites to be in separate repositories (CR-1367)
Mick Jordan <mick.jordan@oracle.com>
parents:
11534
diff
changeset
|
814 """return the JDK directory selected for the 'vm' command""" |
17055
3e4d3be0b6bf
mx: fix default handling of vm config and build type
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
17052
diff
changeset
|
815 return _jdk(installJars=False) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
816 |
11605
3676540f71cf
Allow mxtool suites to be in separate repositories (CR-1367)
Mick Jordan <mick.jordan@oracle.com>
parents:
11534
diff
changeset
|
817 def print_jdkhome(args, vm=None): |
3676540f71cf
Allow mxtool suites to be in separate repositories (CR-1367)
Mick Jordan <mick.jordan@oracle.com>
parents:
11534
diff
changeset
|
818 """print the JDK directory selected for the 'vm' command""" |
3676540f71cf
Allow mxtool suites to be in separate repositories (CR-1367)
Mick Jordan <mick.jordan@oracle.com>
parents:
11534
diff
changeset
|
819 print jdkhome(vm) |
5103
276e14614531
Added jdkhome command to mx.
Doug Simon <doug.simon@oracle.com>
parents:
5094
diff
changeset
|
820 |
9116
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
821 def buildvars(args): |
11377
0fbc1e418c88
fixed capitalization and tense in documentation of some mx commands
Doug Simon <doug.simon@oracle.com>
parents:
11373
diff
changeset
|
822 """describe the variables that can be set by the -D option to the 'mx build' commmand""" |
9116
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
823 |
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
824 buildVars = { |
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
825 'ALT_BOOTDIR' : 'The location of the bootstrap JDK installation (default: ' + mx.java().jdk + ')', |
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
826 'ALT_OUTPUTDIR' : 'Build directory', |
18876
c446d00f2cdf
mx: added support for Jython 2.7b3 and made ordering in generated files more deterministic\nContributed-by: Igor Ignatyev <igor.ignatyev@oracle.com>
Doug Simon <doug.simon@oracle.com>
parents:
18869
diff
changeset
|
827 'HOTSPOT_BUILD_JOBS' : 'Number of CPUs used by make (default: ' + str(mx.cpu_count()) + ')', |
9116
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
828 'INSTALL' : 'Install the built VM into the JDK? (default: y)', |
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
829 'ZIP_DEBUGINFO_FILES' : 'Install zipped debug symbols file? (default: 0)', |
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
830 } |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
831 |
9116
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
832 mx.log('HotSpot build variables that can be set by the -D option to "mx build":') |
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
833 mx.log('') |
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
834 for n in sorted(buildVars.iterkeys()): |
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
835 mx.log(n) |
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
836 mx.log(textwrap.fill(buildVars[n], initial_indent=' ', subsequent_indent=' ', width=200)) |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
837 |
9120
9f361c0f912b
added note about mx/env to the output of 'mx buildvars'
Doug Simon <doug.simon@oracle.com>
parents:
9119
diff
changeset
|
838 mx.log('') |
9f361c0f912b
added note about mx/env to the output of 'mx buildvars'
Doug Simon <doug.simon@oracle.com>
parents:
9119
diff
changeset
|
839 mx.log('Note that these variables can be given persistent values in the file ' + join(_graal_home, 'mx', 'env') + ' (see \'mx about\').') |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
840 |
16622
faaea970b951
Add an mx install command to install the Truffle jars to the local Maven repository.
Chris Seaton <chris.seaton@oracle.com>
parents:
16621
diff
changeset
|
841 cached_graal_version = None |
faaea970b951
Add an mx install command to install the Truffle jars to the local Maven repository.
Chris Seaton <chris.seaton@oracle.com>
parents:
16621
diff
changeset
|
842 |
faaea970b951
Add an mx install command to install the Truffle jars to the local Maven repository.
Chris Seaton <chris.seaton@oracle.com>
parents:
16621
diff
changeset
|
843 def graal_version(dev_suffix='dev'): |
faaea970b951
Add an mx install command to install the Truffle jars to the local Maven repository.
Chris Seaton <chris.seaton@oracle.com>
parents:
16621
diff
changeset
|
844 global cached_graal_version |
faaea970b951
Add an mx install command to install the Truffle jars to the local Maven repository.
Chris Seaton <chris.seaton@oracle.com>
parents:
16621
diff
changeset
|
845 |
faaea970b951
Add an mx install command to install the Truffle jars to the local Maven repository.
Chris Seaton <chris.seaton@oracle.com>
parents:
16621
diff
changeset
|
846 if not cached_graal_version: |
faaea970b951
Add an mx install command to install the Truffle jars to the local Maven repository.
Chris Seaton <chris.seaton@oracle.com>
parents:
16621
diff
changeset
|
847 # extract latest release tag for graal |
faaea970b951
Add an mx install command to install the Truffle jars to the local Maven repository.
Chris Seaton <chris.seaton@oracle.com>
parents:
16621
diff
changeset
|
848 try: |
faaea970b951
Add an mx install command to install the Truffle jars to the local Maven repository.
Chris Seaton <chris.seaton@oracle.com>
parents:
16621
diff
changeset
|
849 tags = [x.split() for x in subprocess.check_output(['hg', '-R', _graal_home, 'tags']).split('\n') if x.startswith("graal-")] |
16862
bf499b4d86e9
mx: fix release tag detection for -dev suffix
Bernhard Urban <bernhard.urban@jku.at>
parents:
16858
diff
changeset
|
850 current_id = subprocess.check_output(['hg', '-R', _graal_home, 'log', '--template', '{rev}\n', '--rev', 'tip']).strip() |
16622
faaea970b951
Add an mx install command to install the Truffle jars to the local Maven repository.
Chris Seaton <chris.seaton@oracle.com>
parents:
16621
diff
changeset
|
851 except: |
faaea970b951
Add an mx install command to install the Truffle jars to the local Maven repository.
Chris Seaton <chris.seaton@oracle.com>
parents:
16621
diff
changeset
|
852 # not a mercurial repository or hg commands are not available. |
faaea970b951
Add an mx install command to install the Truffle jars to the local Maven repository.
Chris Seaton <chris.seaton@oracle.com>
parents:
16621
diff
changeset
|
853 tags = None |
faaea970b951
Add an mx install command to install the Truffle jars to the local Maven repository.
Chris Seaton <chris.seaton@oracle.com>
parents:
16621
diff
changeset
|
854 |
16862
bf499b4d86e9
mx: fix release tag detection for -dev suffix
Bernhard Urban <bernhard.urban@jku.at>
parents:
16858
diff
changeset
|
855 if tags and current_id: |
16622
faaea970b951
Add an mx install command to install the Truffle jars to the local Maven repository.
Chris Seaton <chris.seaton@oracle.com>
parents:
16621
diff
changeset
|
856 sorted_tags = sorted(tags, key=lambda e: [int(x) for x in e[0][len("graal-"):].split('.')], reverse=True) |
faaea970b951
Add an mx install command to install the Truffle jars to the local Maven repository.
Chris Seaton <chris.seaton@oracle.com>
parents:
16621
diff
changeset
|
857 most_recent_tag_name, most_recent_tag_revision = sorted_tags[0] |
16862
bf499b4d86e9
mx: fix release tag detection for -dev suffix
Bernhard Urban <bernhard.urban@jku.at>
parents:
16858
diff
changeset
|
858 most_recent_tag_id = most_recent_tag_revision[:most_recent_tag_revision.index(":")] |
16622
faaea970b951
Add an mx install command to install the Truffle jars to the local Maven repository.
Chris Seaton <chris.seaton@oracle.com>
parents:
16621
diff
changeset
|
859 most_recent_tag_version = most_recent_tag_name[len("graal-"):] |
faaea970b951
Add an mx install command to install the Truffle jars to the local Maven repository.
Chris Seaton <chris.seaton@oracle.com>
parents:
16621
diff
changeset
|
860 |
16862
bf499b4d86e9
mx: fix release tag detection for -dev suffix
Bernhard Urban <bernhard.urban@jku.at>
parents:
16858
diff
changeset
|
861 # tagged commit is one-off with commit that tags it |
bf499b4d86e9
mx: fix release tag detection for -dev suffix
Bernhard Urban <bernhard.urban@jku.at>
parents:
16858
diff
changeset
|
862 if int(current_id) - int(most_recent_tag_id) <= 1: |
16622
faaea970b951
Add an mx install command to install the Truffle jars to the local Maven repository.
Chris Seaton <chris.seaton@oracle.com>
parents:
16621
diff
changeset
|
863 cached_graal_version = most_recent_tag_version |
faaea970b951
Add an mx install command to install the Truffle jars to the local Maven repository.
Chris Seaton <chris.seaton@oracle.com>
parents:
16621
diff
changeset
|
864 else: |
faaea970b951
Add an mx install command to install the Truffle jars to the local Maven repository.
Chris Seaton <chris.seaton@oracle.com>
parents:
16621
diff
changeset
|
865 major, minor = map(int, most_recent_tag_version.split('.')) |
faaea970b951
Add an mx install command to install the Truffle jars to the local Maven repository.
Chris Seaton <chris.seaton@oracle.com>
parents:
16621
diff
changeset
|
866 cached_graal_version = str(major) + '.' + str(minor + 1) + '-' + dev_suffix |
faaea970b951
Add an mx install command to install the Truffle jars to the local Maven repository.
Chris Seaton <chris.seaton@oracle.com>
parents:
16621
diff
changeset
|
867 else: |
18602
7d8270532cd9
mx: changes towards supporting python 2.6 for call to mx from make/Makefile
Doug Simon <doug.simon@oracle.com>
parents:
18601
diff
changeset
|
868 cached_graal_version = 'unknown-{0}-{1}'.format(platform.node(), time.strftime('%Y-%m-%d_%H-%M-%S_%Z')) |
16622
faaea970b951
Add an mx install command to install the Truffle jars to the local Maven repository.
Chris Seaton <chris.seaton@oracle.com>
parents:
16621
diff
changeset
|
869 |
faaea970b951
Add an mx install command to install the Truffle jars to the local Maven repository.
Chris Seaton <chris.seaton@oracle.com>
parents:
16621
diff
changeset
|
870 return cached_graal_version |
faaea970b951
Add an mx install command to install the Truffle jars to the local Maven repository.
Chris Seaton <chris.seaton@oracle.com>
parents:
16621
diff
changeset
|
871 |
4577
bc8b58c11768
Added debug build of HotSpot Client to the gate.
Doug Simon <doug.simon@oracle.com>
parents:
4575
diff
changeset
|
872 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
|
873 """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
|
874 |
11392
66251d9f62ab
fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents:
11377
diff
changeset
|
875 The global '--vm' and '--vmbuild' options select which VM type and build target to build.""" |
66251d9f62ab
fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents:
11377
diff
changeset
|
876 |
66251d9f62ab
fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents:
11377
diff
changeset
|
877 # Override to fail quickly if extra arguments are given |
66251d9f62ab
fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents:
11377
diff
changeset
|
878 # at the end of the command line. This allows for a more |
66251d9f62ab
fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents:
11377
diff
changeset
|
879 # helpful error message. |
66251d9f62ab
fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents:
11377
diff
changeset
|
880 class AP(ArgumentParser): |
66251d9f62ab
fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents:
11377
diff
changeset
|
881 def __init__(self): |
66251d9f62ab
fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents:
11377
diff
changeset
|
882 ArgumentParser.__init__(self, prog='mx build') |
66251d9f62ab
fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents:
11377
diff
changeset
|
883 def parse_args(self, args): |
66251d9f62ab
fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents:
11377
diff
changeset
|
884 result = ArgumentParser.parse_args(self, args) |
66251d9f62ab
fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents:
11377
diff
changeset
|
885 if len(result.remainder) != 0: |
66251d9f62ab
fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents:
11377
diff
changeset
|
886 firstBuildTarget = result.remainder[0] |
66251d9f62ab
fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents:
11377
diff
changeset
|
887 mx.abort('To specify the ' + firstBuildTarget + ' VM build target, you need to use the global "--vmbuild" option. For example:\n' + |
66251d9f62ab
fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents:
11377
diff
changeset
|
888 ' mx --vmbuild ' + firstBuildTarget + ' build') |
66251d9f62ab
fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents:
11377
diff
changeset
|
889 return result |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
890 |
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
891 # Call mx.build to compile the Java sources |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
892 parser = AP() |
10083
8dc4cdde75fb
remove build-graal.xml and have make directly call mx to generate graal.jar
Doug Simon <doug.simon@oracle.com>
parents:
10067
diff
changeset
|
893 parser.add_argument('--export-dir', help='directory to which graal.jar and graal.options will be copied', metavar='<path>') |
9116
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
894 parser.add_argument('-D', action='append', help='set a HotSpot build variable (run \'mx buildvars\' to list variables)', metavar='name=value') |
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
895 opts2 = mx.build(['--source', '1.7'] + args, parser=parser) |
11392
66251d9f62ab
fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents:
11377
diff
changeset
|
896 assert len(opts2.remainder) == 0 |
4145
9aee7df31417
Removed 'tests' command.
Doug Simon <doug.simon@oracle.com>
parents:
4144
diff
changeset
|
897 |
10083
8dc4cdde75fb
remove build-graal.xml and have make directly call mx to generate graal.jar
Doug Simon <doug.simon@oracle.com>
parents:
10067
diff
changeset
|
898 if opts2.export_dir is not None: |
8dc4cdde75fb
remove build-graal.xml and have make directly call mx to generate graal.jar
Doug Simon <doug.simon@oracle.com>
parents:
10067
diff
changeset
|
899 if not exists(opts2.export_dir): |
8dc4cdde75fb
remove build-graal.xml and have make directly call mx to generate graal.jar
Doug Simon <doug.simon@oracle.com>
parents:
10067
diff
changeset
|
900 os.makedirs(opts2.export_dir) |
8dc4cdde75fb
remove build-graal.xml and have make directly call mx to generate graal.jar
Doug Simon <doug.simon@oracle.com>
parents:
10067
diff
changeset
|
901 else: |
18635
a8b46348b79f
mx: converted format strings to be python 2.6 compliant
Doug Simon <doug.simon@oracle.com>
parents:
18613
diff
changeset
|
902 assert os.path.isdir(opts2.export_dir), '{0} is not a directory'.format(opts2.export_dir) |
10083
8dc4cdde75fb
remove build-graal.xml and have make directly call mx to generate graal.jar
Doug Simon <doug.simon@oracle.com>
parents:
10067
diff
changeset
|
903 |
16902
0583d157992a
formalized the set of distribution jars that are installed into the JDK to ensure both mx and the HotSpot make system do the necessary deployment
Doug Simon <doug.simon@oracle.com>
parents:
16877
diff
changeset
|
904 defsPath = join(_graal_home, 'make', 'defs.make') |
0583d157992a
formalized the set of distribution jars that are installed into the JDK to ensure both mx and the HotSpot make system do the necessary deployment
Doug Simon <doug.simon@oracle.com>
parents:
16877
diff
changeset
|
905 with open(defsPath) as fp: |
0583d157992a
formalized the set of distribution jars that are installed into the JDK to ensure both mx and the HotSpot make system do the necessary deployment
Doug Simon <doug.simon@oracle.com>
parents:
16877
diff
changeset
|
906 defs = fp.read() |
21099
3f51d02e536f
Make should export graal service files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21098
diff
changeset
|
907 graalJars = [] |
16902
0583d157992a
formalized the set of distribution jars that are installed into the JDK to ensure both mx and the HotSpot make system do the necessary deployment
Doug Simon <doug.simon@oracle.com>
parents:
16877
diff
changeset
|
908 for jdkDist in _jdkDeployedDists: |
0583d157992a
formalized the set of distribution jars that are installed into the JDK to ensure both mx and the HotSpot make system do the necessary deployment
Doug Simon <doug.simon@oracle.com>
parents:
16877
diff
changeset
|
909 dist = mx.distribution(jdkDist.name) |
0583d157992a
formalized the set of distribution jars that are installed into the JDK to ensure both mx and the HotSpot make system do the necessary deployment
Doug Simon <doug.simon@oracle.com>
parents:
16877
diff
changeset
|
910 defLine = 'EXPORT_LIST += $(EXPORT_JRE_LIB_DIR)/' + basename(dist.path) |
16918
b03a16cc5245
add support for installing distribution jars into jre/lib/ext directory
Doug Simon <doug.simon@oracle.com>
parents:
16902
diff
changeset
|
911 if jdkDist.isExtension: |
b03a16cc5245
add support for installing distribution jars into jre/lib/ext directory
Doug Simon <doug.simon@oracle.com>
parents:
16902
diff
changeset
|
912 defLine = 'EXPORT_LIST += $(EXPORT_JRE_LIB_EXT_DIR)/' + basename(dist.path) |
21040
12e94cba3696
Graal Loader: load all jars matching lib/graal/graal*.jar
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21032
diff
changeset
|
913 elif jdkDist.isGraalClassLoader: |
12e94cba3696
Graal Loader: load all jars matching lib/graal/graal*.jar
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21032
diff
changeset
|
914 defLine = 'EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_DIR)/' + basename(dist.path) |
21099
3f51d02e536f
Make should export graal service files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21098
diff
changeset
|
915 graalJars.append(dist.path) |
16918
b03a16cc5245
add support for installing distribution jars into jre/lib/ext directory
Doug Simon <doug.simon@oracle.com>
parents:
16902
diff
changeset
|
916 else: |
b03a16cc5245
add support for installing distribution jars into jre/lib/ext directory
Doug Simon <doug.simon@oracle.com>
parents:
16902
diff
changeset
|
917 defLine = 'EXPORT_LIST += $(EXPORT_JRE_LIB_DIR)/' + basename(dist.path) |
16902
0583d157992a
formalized the set of distribution jars that are installed into the JDK to ensure both mx and the HotSpot make system do the necessary deployment
Doug Simon <doug.simon@oracle.com>
parents:
16877
diff
changeset
|
918 if defLine not in defs: |
0583d157992a
formalized the set of distribution jars that are installed into the JDK to ensure both mx and the HotSpot make system do the necessary deployment
Doug Simon <doug.simon@oracle.com>
parents:
16877
diff
changeset
|
919 mx.abort('Missing following line in ' + defsPath + '\n' + defLine) |
0583d157992a
formalized the set of distribution jars that are installed into the JDK to ensure both mx and the HotSpot make system do the necessary deployment
Doug Simon <doug.simon@oracle.com>
parents:
16877
diff
changeset
|
920 shutil.copy(dist.path, opts2.export_dir) |
21099
3f51d02e536f
Make should export graal service files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21098
diff
changeset
|
921 services = _extractGraalServiceFiles(graalJars, join(opts2.export_dir, 'services')) |
3f51d02e536f
Make should export graal service files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21098
diff
changeset
|
922 for service in services: |
3f51d02e536f
Make should export graal service files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21098
diff
changeset
|
923 defLine = 'EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_SERVICES_DIR)/' + service |
3f51d02e536f
Make should export graal service files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21098
diff
changeset
|
924 if defLine not in defs: |
3f51d02e536f
Make should export graal service files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21098
diff
changeset
|
925 mx.abort('Missing following line in ' + defsPath + ' for service from ' + dist.name + '\n' + defLine) |
10083
8dc4cdde75fb
remove build-graal.xml and have make directly call mx to generate graal.jar
Doug Simon <doug.simon@oracle.com>
parents:
10067
diff
changeset
|
926 graalOptions = join(_graal_home, 'graal.options') |
8dc4cdde75fb
remove build-graal.xml and have make directly call mx to generate graal.jar
Doug Simon <doug.simon@oracle.com>
parents:
10067
diff
changeset
|
927 if exists(graalOptions): |
8dc4cdde75fb
remove build-graal.xml and have make directly call mx to generate graal.jar
Doug Simon <doug.simon@oracle.com>
parents:
10067
diff
changeset
|
928 shutil.copy(graalOptions, opts2.export_dir) |
8dc4cdde75fb
remove build-graal.xml and have make directly call mx to generate graal.jar
Doug Simon <doug.simon@oracle.com>
parents:
10067
diff
changeset
|
929 |
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
|
930 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
|
931 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
|
932 |
11371
74414b248381
mx: added --vmbuild global option, removed --product, --fastdebug, --debug options as well as suffix of build command
Doug Simon <doug.simon@oracle.com>
parents:
11368
diff
changeset
|
933 builds = [_vmbuild] |
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
|
934 |
18414
df8d52aba789
fixed support for IDE_BUILD_TARGET
Doug Simon <doug.simon@oracle.com>
parents:
18351
diff
changeset
|
935 if os.environ.get('BUILDING_FROM_IDE', None) == 'true': |
df8d52aba789
fixed support for IDE_BUILD_TARGET
Doug Simon <doug.simon@oracle.com>
parents:
18351
diff
changeset
|
936 build = os.environ.get('IDE_BUILD_TARGET', None) |
df8d52aba789
fixed support for IDE_BUILD_TARGET
Doug Simon <doug.simon@oracle.com>
parents:
18351
diff
changeset
|
937 if build is None or len(build) == 0: |
df8d52aba789
fixed support for IDE_BUILD_TARGET
Doug Simon <doug.simon@oracle.com>
parents:
18351
diff
changeset
|
938 return |
df8d52aba789
fixed support for IDE_BUILD_TARGET
Doug Simon <doug.simon@oracle.com>
parents:
18351
diff
changeset
|
939 if build not in _vmbuildChoices: |
df8d52aba789
fixed support for IDE_BUILD_TARGET
Doug Simon <doug.simon@oracle.com>
parents:
18351
diff
changeset
|
940 mx.abort('VM build "' + build + '" specified by IDE_BUILD_TARGET environment variable is unknown (must be one of ' + |
df8d52aba789
fixed support for IDE_BUILD_TARGET
Doug Simon <doug.simon@oracle.com>
parents:
18351
diff
changeset
|
941 str(_vmbuildChoices) + ')') |
df8d52aba789
fixed support for IDE_BUILD_TARGET
Doug Simon <doug.simon@oracle.com>
parents:
18351
diff
changeset
|
942 builds = [build] |
df8d52aba789
fixed support for IDE_BUILD_TARGET
Doug Simon <doug.simon@oracle.com>
parents:
18351
diff
changeset
|
943 |
4577
bc8b58c11768
Added debug build of HotSpot Client to the gate.
Doug Simon <doug.simon@oracle.com>
parents:
4575
diff
changeset
|
944 if vm is None: |
11296
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
945 vm = _get_vm() |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
946 |
9117
cbfcb1054619
renamed 'boot' VM to 'original' VM
Doug Simon <doug.simon@oracle.com>
parents:
9116
diff
changeset
|
947 if vm == 'original': |
cbfcb1054619
renamed 'boot' VM to 'original' VM
Doug Simon <doug.simon@oracle.com>
parents:
9116
diff
changeset
|
948 pass |
cbfcb1054619
renamed 'boot' VM to 'original' VM
Doug Simon <doug.simon@oracle.com>
parents:
9116
diff
changeset
|
949 elif vm.startswith('server'): |
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
|
950 buildSuffix = '' |
9095
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
951 elif vm.startswith('client'): |
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
|
952 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
|
953 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
|
954 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
|
955 buildSuffix = 'graal' |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
956 |
11530
be9e54fbb699
Use a better warning message for building with --installed-jdks set
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11526
diff
changeset
|
957 if _installed_jdks and _installed_jdks != _graal_home: |
be9e54fbb699
Use a better warning message for building with --installed-jdks set
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11526
diff
changeset
|
958 if not mx.ask_yes_no("Warning: building while --installed-jdks is set (" + _installed_jdks + ") is not recommanded - are you sure you want to continue", 'n'): |
11512
38acec26d535
If _installed_jdk is set, ask confirmation before building
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11511
diff
changeset
|
959 mx.abort(1) |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
960 |
17318
c75bb9cd1994
mx: force installation of distrubtion on windows
Bernhard Urban <bernhard.urban@jku.at>
parents:
17317
diff
changeset
|
961 isWindows = platform.system() == 'Windows' or "CYGWIN" in platform.system() |
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
|
962 for build in builds: |
17318
c75bb9cd1994
mx: force installation of distrubtion on windows
Bernhard Urban <bernhard.urban@jku.at>
parents:
17317
diff
changeset
|
963 installJars = vm != 'original' and (isWindows or not opts2.java) |
c75bb9cd1994
mx: force installation of distrubtion on windows
Bernhard Urban <bernhard.urban@jku.at>
parents:
17317
diff
changeset
|
964 jdk = _jdk(build, create=True, installJars=installJars) |
8647
5f8299106dd9
A server0 "build" needs to create a jdk copy if it does not exist yet
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8646
diff
changeset
|
965 |
9117
cbfcb1054619
renamed 'boot' VM to 'original' VM
Doug Simon <doug.simon@oracle.com>
parents:
9116
diff
changeset
|
966 if vm == 'original': |
9098
d766fd8eede0
VM copy made during initial copy of the JDK is now named 'boot' instead of 'server0' to better reflect that it is the default VM (which may not be 'server') from the boot JDK
Doug Simon <doug.simon@oracle.com>
parents:
9097
diff
changeset
|
967 if build != 'product': |
9117
cbfcb1054619
renamed 'boot' VM to 'original' VM
Doug Simon <doug.simon@oracle.com>
parents:
9116
diff
changeset
|
968 mx.log('only product build of original VM exists') |
9098
d766fd8eede0
VM copy made during initial copy of the JDK is now named 'boot' instead of 'server0' to better reflect that it is the default VM (which may not be 'server') from the boot JDK
Doug Simon <doug.simon@oracle.com>
parents:
9097
diff
changeset
|
969 continue |
14605 | 970 |
14602
591f4a575ebf
issue warning/error where ever relevant if a non-supported VM (e.g., client VM on Mac) is used in mx
Doug Simon <doug.simon@oracle.com>
parents:
14595
diff
changeset
|
971 if not isVMSupported(vm): |
591f4a575ebf
issue warning/error where ever relevant if a non-supported VM (e.g., client VM on Mac) is used in mx
Doug Simon <doug.simon@oracle.com>
parents:
14595
diff
changeset
|
972 mx.log('The ' + vm + ' VM is not supported on this platform - skipping') |
591f4a575ebf
issue warning/error where ever relevant if a non-supported VM (e.g., client VM on Mac) is used in mx
Doug Simon <doug.simon@oracle.com>
parents:
14595
diff
changeset
|
973 continue |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
974 |
4607
ee87cfe2f8f9
Made GraalVM build work on Mac OS X.
Doug Simon <doug.simon@oracle.com>
parents:
4602
diff
changeset
|
975 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
|
976 if not exists(vmDir): |
17233
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
977 chmodRecursive(jdk, JDK_UNIX_PERMISSIONS_DIR) |
14780
aaecb0ca0c7d
fixed hard coded reference to JDK7
Doug Simon <doug.simon@oracle.com>
parents:
14777
diff
changeset
|
978 mx.log('Creating VM directory in JDK: ' + vmDir) |
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
|
979 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
|
980 |
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
|
981 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
|
982 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
|
983 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
|
984 |
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
|
985 # 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
|
986 timestampFile = join(vmDir, '.build-timestamp') |
9098
d766fd8eede0
VM copy made during initial copy of the JDK is now named 'boot' instead of 'server0' to better reflect that it is the default VM (which may not be 'server') from the boot JDK
Doug Simon <doug.simon@oracle.com>
parents:
9097
diff
changeset
|
987 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
|
988 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
|
989 else: |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
990 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
|
991 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
|
992 sources = [] |
15844 | 993 for d in ['src', 'make', join('graal', 'com.oracle.graal.hotspot', 'src_gen', 'hotspot')]: |
5244
55ff4ba8d7b1
ignore src/share/tools directory in native build out-of-date check
Doug Simon <doug.simon@oracle.com>
parents:
5239
diff
changeset
|
994 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
|
995 # 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
|
996 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
|
997 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
|
998 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
|
999 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
|
1000 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
|
1001 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
|
1002 break |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
1003 |
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
|
1004 if not mustBuild: |
10568
070b4a3c56f3
disabled "noisy" log statements unless -v option (i.e. verbose) is specified to mx
Doug Simon <doug.simon@oracle.com>
parents:
10527
diff
changeset
|
1005 mx.logv('[all files in src and make directories are older than ' + timestampFile[len(_graal_home) + 1:] + ' - skipping native build]') |
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
|
1006 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
|
1007 |
17318
c75bb9cd1994
mx: force installation of distrubtion on windows
Bernhard Urban <bernhard.urban@jku.at>
parents:
17317
diff
changeset
|
1008 if isWindows: |
17262
b641450c19ce
mx: rename helper functions for cygwin support and update comments
Bernhard Urban <bernhard.urban@jku.at>
parents:
17233
diff
changeset
|
1009 t_compilelogfile = mx._cygpathU2W(os.path.join(_graal_home, "graalCompile.log")) |
4252
67e88b7624d5
Removed need for GRAAL environment variable on Windows.
Doug Simon <doug.simon@oracle.com>
parents:
4247
diff
changeset
|
1010 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
|
1011 |
4572
76841bdd5f3e
(Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents:
4559
diff
changeset
|
1012 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
|
1013 project_config = variant + '_' + build |
17262
b641450c19ce
mx: rename helper functions for cygwin support and update comments
Bernhard Urban <bernhard.urban@jku.at>
parents:
17233
diff
changeset
|
1014 t_graal_home = mx._cygpathU2W(_graal_home) |
17233
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
1015 _runInDebugShell('msbuild ' + t_graal_home + r'\build\vs-amd64\jvm.vcproj /p:Configuration=' + project_config + ' /target:clean', t_graal_home) |
17262
b641450c19ce
mx: rename helper functions for cygwin support and update comments
Bernhard Urban <bernhard.urban@jku.at>
parents:
17233
diff
changeset
|
1016 winCompileCmd = r'set HotSpotMksHome=' + mksHome + r'& set OUT_DIR=' + mx._cygpathU2W(jdk) + r'& set JAVA_HOME=' + mx._cygpathU2W(jdk) + r'& set path=%JAVA_HOME%\bin;%path%;%HotSpotMksHome%& cd /D "' + t_graal_home + r'\make\windows"& call create.bat ' + t_graal_home |
13967
4cd7c6629841
mx_graal: fix pylint 1.1.0 warnings
Bernhard Urban <bernhard.urban@jku.at>
parents:
13952
diff
changeset
|
1017 print winCompileCmd |
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
|
1018 winCompileSuccess = re.compile(r"^Writing \.vcxproj file:") |
17233
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
1019 if not _runInDebugShell(winCompileCmd, t_graal_home, t_compilelogfile, winCompileSuccess): |
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
|
1020 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
|
1021 return |
17233
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
1022 winBuildCmd = 'msbuild ' + t_graal_home + r'\build\vs-amd64\jvm.vcxproj /p:Configuration=' + project_config + ' /p:Platform=x64' |
a02c295218aa
mx: add support for cygwin
Bernhard Urban <bernhard.urban@jku.at>
parents:
17055
diff
changeset
|
1023 if not _runInDebugShell(winBuildCmd, t_graal_home, t_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
|
1024 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
|
1025 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
|
1026 else: |
18876
c446d00f2cdf
mx: added support for Jython 2.7b3 and made ordering in generated files more deterministic\nContributed-by: Igor Ignatyev <igor.ignatyev@oracle.com>
Doug Simon <doug.simon@oracle.com>
parents:
18869
diff
changeset
|
1027 cpus = mx.cpu_count() |
16022
3f350b0d93c9
pass make variables on the command line instead of in environment variables to simplify running the make on the command line without mx
Doug Simon <doug.simon@oracle.com>
parents:
16002
diff
changeset
|
1028 makeDir = join(_graal_home, 'make') |
3f350b0d93c9
pass make variables on the command line instead of in environment variables to simplify running the make on the command line without mx
Doug Simon <doug.simon@oracle.com>
parents:
16002
diff
changeset
|
1029 runCmd = [mx.gmake_cmd(), '-C', makeDir] |
3f350b0d93c9
pass make variables on the command line instead of in environment variables to simplify running the make on the command line without mx
Doug Simon <doug.simon@oracle.com>
parents:
16002
diff
changeset
|
1030 |
8884
51a8368d0231
Adapt to changes in hotspot makefiles : pass our JAVA_HOME as ALT_BOOTDIR (so that things are built with a 'safe' jdk) and our jdk copy as JAVA_HOME (so that the jvm gets installed there)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8647
diff
changeset
|
1031 env = os.environ.copy() |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
1032 |
16022
3f350b0d93c9
pass make variables on the command line instead of in environment variables to simplify running the make on the command line without mx
Doug Simon <doug.simon@oracle.com>
parents:
16002
diff
changeset
|
1033 # These must be passed as environment variables |
3f350b0d93c9
pass make variables on the command line instead of in environment variables to simplify running the make on the command line without mx
Doug Simon <doug.simon@oracle.com>
parents:
16002
diff
changeset
|
1034 env.setdefault('LANG', 'C') |
3f350b0d93c9
pass make variables on the command line instead of in environment variables to simplify running the make on the command line without mx
Doug Simon <doug.simon@oracle.com>
parents:
16002
diff
changeset
|
1035 env['JAVA_HOME'] = jdk |
3f350b0d93c9
pass make variables on the command line instead of in environment variables to simplify running the make on the command line without mx
Doug Simon <doug.simon@oracle.com>
parents:
16002
diff
changeset
|
1036 |
3f350b0d93c9
pass make variables on the command line instead of in environment variables to simplify running the make on the command line without mx
Doug Simon <doug.simon@oracle.com>
parents:
16002
diff
changeset
|
1037 def setMakeVar(name, default, env=None): |
3f350b0d93c9
pass make variables on the command line instead of in environment variables to simplify running the make on the command line without mx
Doug Simon <doug.simon@oracle.com>
parents:
16002
diff
changeset
|
1038 """Sets a make variable on the command line to the value |
3f350b0d93c9
pass make variables on the command line instead of in environment variables to simplify running the make on the command line without mx
Doug Simon <doug.simon@oracle.com>
parents:
16002
diff
changeset
|
1039 of the variable in 'env' with the same name if defined |
3f350b0d93c9
pass make variables on the command line instead of in environment variables to simplify running the make on the command line without mx
Doug Simon <doug.simon@oracle.com>
parents:
16002
diff
changeset
|
1040 and 'env' is not None otherwise to 'default' |
3f350b0d93c9
pass make variables on the command line instead of in environment variables to simplify running the make on the command line without mx
Doug Simon <doug.simon@oracle.com>
parents:
16002
diff
changeset
|
1041 """ |
3f350b0d93c9
pass make variables on the command line instead of in environment variables to simplify running the make on the command line without mx
Doug Simon <doug.simon@oracle.com>
parents:
16002
diff
changeset
|
1042 runCmd.append(name + '=' + (env.get(name, default) if env else default)) |
3f350b0d93c9
pass make variables on the command line instead of in environment variables to simplify running the make on the command line without mx
Doug Simon <doug.simon@oracle.com>
parents:
16002
diff
changeset
|
1043 |
9116
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
1044 if opts2.D: |
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
1045 for nv in opts2.D: |
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
1046 name, value = nv.split('=', 1) |
16022
3f350b0d93c9
pass make variables on the command line instead of in environment variables to simplify running the make on the command line without mx
Doug Simon <doug.simon@oracle.com>
parents:
16002
diff
changeset
|
1047 setMakeVar(name.strip(), value) |
13846
1e72cd05b77e
hs build: add graal tag to hotspot build version
Bernhard Urban <bernhard.urban@jku.at>
parents:
13761
diff
changeset
|
1048 |
16022
3f350b0d93c9
pass make variables on the command line instead of in environment variables to simplify running the make on the command line without mx
Doug Simon <doug.simon@oracle.com>
parents:
16002
diff
changeset
|
1049 setMakeVar('ARCH_DATA_MODEL', '64', env=env) |
3f350b0d93c9
pass make variables on the command line instead of in environment variables to simplify running the make on the command line without mx
Doug Simon <doug.simon@oracle.com>
parents:
16002
diff
changeset
|
1050 setMakeVar('HOTSPOT_BUILD_JOBS', str(cpus), env=env) |
3f350b0d93c9
pass make variables on the command line instead of in environment variables to simplify running the make on the command line without mx
Doug Simon <doug.simon@oracle.com>
parents:
16002
diff
changeset
|
1051 setMakeVar('ALT_BOOTDIR', mx.java().jdk, env=env) |
3f350b0d93c9
pass make variables on the command line instead of in environment variables to simplify running the make on the command line without mx
Doug Simon <doug.simon@oracle.com>
parents:
16002
diff
changeset
|
1052 |
3f350b0d93c9
pass make variables on the command line instead of in environment variables to simplify running the make on the command line without mx
Doug Simon <doug.simon@oracle.com>
parents:
16002
diff
changeset
|
1053 setMakeVar('MAKE_VERBOSE', 'y' if mx._opts.verbose else '') |
9095
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
1054 if vm.endswith('nograal'): |
16022
3f350b0d93c9
pass make variables on the command line instead of in environment variables to simplify running the make on the command line without mx
Doug Simon <doug.simon@oracle.com>
parents:
16002
diff
changeset
|
1055 setMakeVar('INCLUDE_GRAAL', 'false') |
3f350b0d93c9
pass make variables on the command line instead of in environment variables to simplify running the make on the command line without mx
Doug Simon <doug.simon@oracle.com>
parents:
16002
diff
changeset
|
1056 setMakeVar('ALT_OUTPUTDIR', join(_graal_home, 'build-nograal', mx.get_os()), env=env) |
9095
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
1057 else: |
16622
faaea970b951
Add an mx install command to install the Truffle jars to the local Maven repository.
Chris Seaton <chris.seaton@oracle.com>
parents:
16621
diff
changeset
|
1058 version = graal_version() |
faaea970b951
Add an mx install command to install the Truffle jars to the local Maven repository.
Chris Seaton <chris.seaton@oracle.com>
parents:
16621
diff
changeset
|
1059 setMakeVar('USER_RELEASE_SUFFIX', 'graal-' + version) |
faaea970b951
Add an mx install command to install the Truffle jars to the local Maven repository.
Chris Seaton <chris.seaton@oracle.com>
parents:
16621
diff
changeset
|
1060 setMakeVar('GRAAL_VERSION', version) |
16022
3f350b0d93c9
pass make variables on the command line instead of in environment variables to simplify running the make on the command line without mx
Doug Simon <doug.simon@oracle.com>
parents:
16002
diff
changeset
|
1061 setMakeVar('INCLUDE_GRAAL', 'true') |
3f350b0d93c9
pass make variables on the command line instead of in environment variables to simplify running the make on the command line without mx
Doug Simon <doug.simon@oracle.com>
parents:
16002
diff
changeset
|
1062 setMakeVar('INSTALL', 'y', env=env) |
17307
f0364a8ec40e
force USE_CLANG when building on MacOS
Doug Simon <doug.simon@oracle.com>
parents:
17262
diff
changeset
|
1063 if mx.get_os() == 'darwin' and platform.mac_ver()[0] != '': |
f0364a8ec40e
force USE_CLANG when building on MacOS
Doug Simon <doug.simon@oracle.com>
parents:
17262
diff
changeset
|
1064 # Force use of clang on MacOS |
f0364a8ec40e
force USE_CLANG when building on MacOS
Doug Simon <doug.simon@oracle.com>
parents:
17262
diff
changeset
|
1065 setMakeVar('USE_CLANG', 'true') |
13967
4cd7c6629841
mx_graal: fix pylint 1.1.0 warnings
Bernhard Urban <bernhard.urban@jku.at>
parents:
13952
diff
changeset
|
1066 if mx.get_os() == 'solaris': |
6702
602ee4d1db61
added setup of ENFORCE_COMPILER_REV and ENFORCE_CC_COMPILER_REV when using sunstudio compilers on Solaris to avoid build complaint from HotSpot makefiles.
Laurent Daynes <Laurent.Daynes@oracle.com>
parents:
6701
diff
changeset
|
1067 # If using sparcWorks, setup flags to avoid make complaining about CC version |
602ee4d1db61
added setup of ENFORCE_COMPILER_REV and ENFORCE_CC_COMPILER_REV when using sunstudio compilers on Solaris to avoid build complaint from HotSpot makefiles.
Laurent Daynes <Laurent.Daynes@oracle.com>
parents:
6701
diff
changeset
|
1068 cCompilerVersion = subprocess.Popen('CC -V', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True).stderr.readlines()[0] |
13967
4cd7c6629841
mx_graal: fix pylint 1.1.0 warnings
Bernhard Urban <bernhard.urban@jku.at>
parents:
13952
diff
changeset
|
1069 if cCompilerVersion.startswith('CC: Sun C++'): |
6702
602ee4d1db61
added setup of ENFORCE_COMPILER_REV and ENFORCE_CC_COMPILER_REV when using sunstudio compilers on Solaris to avoid build complaint from HotSpot makefiles.
Laurent Daynes <Laurent.Daynes@oracle.com>
parents:
6701
diff
changeset
|
1070 compilerRev = cCompilerVersion.split(' ')[3] |
16022
3f350b0d93c9
pass make variables on the command line instead of in environment variables to simplify running the make on the command line without mx
Doug Simon <doug.simon@oracle.com>
parents:
16002
diff
changeset
|
1071 setMakeVar('ENFORCE_COMPILER_REV', compilerRev, env=env) |
3f350b0d93c9
pass make variables on the command line instead of in environment variables to simplify running the make on the command line without mx
Doug Simon <doug.simon@oracle.com>
parents:
16002
diff
changeset
|
1072 setMakeVar('ENFORCE_CC_COMPILER_REV', compilerRev, env=env) |
6718
cce59a7ee92c
Avoids stripping libjvm.so when building debug on Solaris (.debuginfo files don't work well with Oracle Solaris Studio 12.3's solaris).
Laurent Daynes <Laurent.Daynes@oracle.com>
parents:
6705
diff
changeset
|
1073 if build == 'jvmg': |
16022
3f350b0d93c9
pass make variables on the command line instead of in environment variables to simplify running the make on the command line without mx
Doug Simon <doug.simon@oracle.com>
parents:
16002
diff
changeset
|
1074 # We want ALL the symbols when debugging on Solaris |
3f350b0d93c9
pass make variables on the command line instead of in environment variables to simplify running the make on the command line without mx
Doug Simon <doug.simon@oracle.com>
parents:
16002
diff
changeset
|
1075 setMakeVar('STRIP_POLICY', 'no_strip') |
6276
03c4c25ae726
disabled zipping of lib*.debuginfo files to simplify debugging with gdb
Doug Simon <doug.simon@oracle.com>
parents:
5881
diff
changeset
|
1076 # This removes the need to unzip the *.diz files before debugging in gdb |
16022
3f350b0d93c9
pass make variables on the command line instead of in environment variables to simplify running the make on the command line without mx
Doug Simon <doug.simon@oracle.com>
parents:
16002
diff
changeset
|
1077 setMakeVar('ZIP_DEBUGINFO_FILES', '0', env=env) |
6276
03c4c25ae726
disabled zipping of lib*.debuginfo files to simplify debugging with gdb
Doug Simon <doug.simon@oracle.com>
parents:
5881
diff
changeset
|
1078 |
19733
3f7cd3c36734
mx_graal: do not clear LD_LIBRARY_PATH before invoking make
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
19691
diff
changeset
|
1079 # Clear this variable as having it set can cause very confusing build problems |
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
|
1080 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
|
1081 |
16031
cd2209d3af46
mx: show the environment variables defined and make command line issued when doing a HotSpot build
Doug Simon <doug.simon@oracle.com>
parents:
16022
diff
changeset
|
1082 # Issue an env prefix that can be used to run the make on the command line |
cd2209d3af46
mx: show the environment variables defined and make command line issued when doing a HotSpot build
Doug Simon <doug.simon@oracle.com>
parents:
16022
diff
changeset
|
1083 if not mx._opts.verbose: |
cd2209d3af46
mx: show the environment variables defined and make command line issued when doing a HotSpot build
Doug Simon <doug.simon@oracle.com>
parents:
16022
diff
changeset
|
1084 mx.log('--------------- make command line ----------------------') |
cd2209d3af46
mx: show the environment variables defined and make command line issued when doing a HotSpot build
Doug Simon <doug.simon@oracle.com>
parents:
16022
diff
changeset
|
1085 |
cd2209d3af46
mx: show the environment variables defined and make command line issued when doing a HotSpot build
Doug Simon <doug.simon@oracle.com>
parents:
16022
diff
changeset
|
1086 envPrefix = ' '.join([key + '=' + env[key] for key in env.iterkeys() if not os.environ.has_key(key) or env[key] != os.environ[key]]) |
cd2209d3af46
mx: show the environment variables defined and make command line issued when doing a HotSpot build
Doug Simon <doug.simon@oracle.com>
parents:
16022
diff
changeset
|
1087 if len(envPrefix): |
cd2209d3af46
mx: show the environment variables defined and make command line issued when doing a HotSpot build
Doug Simon <doug.simon@oracle.com>
parents:
16022
diff
changeset
|
1088 mx.log('env ' + envPrefix + ' \\') |
16022
3f350b0d93c9
pass make variables on the command line instead of in environment variables to simplify running the make on the command line without mx
Doug Simon <doug.simon@oracle.com>
parents:
16002
diff
changeset
|
1089 |
3f350b0d93c9
pass make variables on the command line instead of in environment variables to simplify running the make on the command line without mx
Doug Simon <doug.simon@oracle.com>
parents:
16002
diff
changeset
|
1090 runCmd.append(build + buildSuffix) |
16031
cd2209d3af46
mx: show the environment variables defined and make command line issued when doing a HotSpot build
Doug Simon <doug.simon@oracle.com>
parents:
16022
diff
changeset
|
1091 |
cd2209d3af46
mx: show the environment variables defined and make command line issued when doing a HotSpot build
Doug Simon <doug.simon@oracle.com>
parents:
16022
diff
changeset
|
1092 if not mx._opts.verbose: |
cd2209d3af46
mx: show the environment variables defined and make command line issued when doing a HotSpot build
Doug Simon <doug.simon@oracle.com>
parents:
16022
diff
changeset
|
1093 mx.log(' '.join(runCmd)) |
cd2209d3af46
mx: show the environment variables defined and make command line issued when doing a HotSpot build
Doug Simon <doug.simon@oracle.com>
parents:
16022
diff
changeset
|
1094 mx.log('--------------------------------------------------------') |
16022
3f350b0d93c9
pass make variables on the command line instead of in environment variables to simplify running the make on the command line without mx
Doug Simon <doug.simon@oracle.com>
parents:
16002
diff
changeset
|
1095 mx.run(runCmd, err=filterXusage, env=env) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
1096 |
5680
87fc13b59258
Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5649
diff
changeset
|
1097 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
|
1098 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
|
1099 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
|
1100 |
8901
8ddaac81cb21
Be more careful while updating jvm.cfg (fixes a bug where the -server configuration would overwrite the -server0 one)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8900
diff
changeset
|
1101 prefix = '-' + vm + ' ' |
8ddaac81cb21
Be more careful while updating jvm.cfg (fixes a bug where the -server configuration would overwrite the -server0 one)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8900
diff
changeset
|
1102 vmKnown = prefix + 'KNOWN\n' |
8889
c669e8e621a1
Update the -client line in jvm.cfg when it already exists (ie IGNORE)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8887
diff
changeset
|
1103 lines = [] |
c669e8e621a1
Update the -client line in jvm.cfg when it already exists (ie IGNORE)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8887
diff
changeset
|
1104 found = False |
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
|
1105 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
|
1106 for line in f: |
8889
c669e8e621a1
Update the -client line in jvm.cfg when it already exists (ie IGNORE)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8887
diff
changeset
|
1107 if line.strip() == vmKnown.strip(): |
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
|
1108 found = True |
8889
c669e8e621a1
Update the -client line in jvm.cfg when it already exists (ie IGNORE)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8887
diff
changeset
|
1109 lines.append(line) |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
1110 |
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
|
1111 if not found: |
8901
8ddaac81cb21
Be more careful while updating jvm.cfg (fixes a bug where the -server configuration would overwrite the -server0 one)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8900
diff
changeset
|
1112 mx.log('Appending "' + prefix + 'KNOWN" to ' + jvmCfg) |
6688
806821a1c0a8
Make sure files in copy of JDK has write-protection unset before modifying it.
Laurent Daynes <Laurent.Daynes@oracle.com>
parents:
6687
diff
changeset
|
1113 if mx.get_os() != 'windows': |
16627
68deb37eed70
mx: fix permissions of copied bootstrap JDK files (don't make everything executable)
Bernhard Urban <bernhard.urban@jku.at>
parents:
16623
diff
changeset
|
1114 os.chmod(jvmCfg, JDK_UNIX_PERMISSIONS_FILE) |
8889
c669e8e621a1
Update the -client line in jvm.cfg when it already exists (ie IGNORE)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8887
diff
changeset
|
1115 with open(jvmCfg, 'w') as f: |
c669e8e621a1
Update the -client line in jvm.cfg when it already exists (ie IGNORE)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8887
diff
changeset
|
1116 for line in lines: |
c669e8e621a1
Update the -client line in jvm.cfg when it already exists (ie IGNORE)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8887
diff
changeset
|
1117 if line.startswith(prefix): |
c669e8e621a1
Update the -client line in jvm.cfg when it already exists (ie IGNORE)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8887
diff
changeset
|
1118 line = vmKnown |
c669e8e621a1
Update the -client line in jvm.cfg when it already exists (ie IGNORE)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8887
diff
changeset
|
1119 found = True |
c669e8e621a1
Update the -client line in jvm.cfg when it already exists (ie IGNORE)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8887
diff
changeset
|
1120 f.write(line) |
c669e8e621a1
Update the -client line in jvm.cfg when it already exists (ie IGNORE)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8887
diff
changeset
|
1121 if not found: |
c669e8e621a1
Update the -client line in jvm.cfg when it already exists (ie IGNORE)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8887
diff
changeset
|
1122 f.write(vmKnown) |
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
|
1123 |
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
|
1124 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
|
1125 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
|
1126 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
|
1127 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
|
1128 |
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
|
1129 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
|
1130 """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
|
1131 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
|
1132 |
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
|
1133 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
|
1134 """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
|
1135 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
|
1136 |
13951
392b6ac8da36
Allow using run_java without the arguments from -J -Ja -Jp. Factor out the argument processing of mx_graal.vm and use it to pass tested-vm args down through the jmh harness
Bernhard Urban <bernhard.urban@jku.at>
parents:
13949
diff
changeset
|
1137 def _parseVmArgs(args, vm=None, cwd=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
|
1138 """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
|
1139 |
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
|
1140 if vm is None: |
11296
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
1141 vm = _get_vm() |
14162 | 1142 |
14602
591f4a575ebf
issue warning/error where ever relevant if a non-supported VM (e.g., client VM on Mac) is used in mx
Doug Simon <doug.simon@oracle.com>
parents:
14595
diff
changeset
|
1143 if not isVMSupported(vm): |
591f4a575ebf
issue warning/error where ever relevant if a non-supported VM (e.g., client VM on Mac) is used in mx
Doug Simon <doug.simon@oracle.com>
parents:
14595
diff
changeset
|
1144 mx.abort('The ' + vm + ' is not supported on this platform') |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
1145 |
10454
590b0c26877f
mx: add --workdir argument
Bernhard Urban <bernhard.urban@jku.at>
parents:
10417
diff
changeset
|
1146 if cwd is None: |
11401
2d228d304247
minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents:
11395
diff
changeset
|
1147 cwd = _vm_cwd |
11424
ece40b452e65
mx: Fix commands.vm when an explicit cwd is passed and no --vmcwd is given
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11415
diff
changeset
|
1148 elif _vm_cwd is not None and _vm_cwd != cwd: |
11401
2d228d304247
minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents:
11395
diff
changeset
|
1149 mx.abort("conflicting working directories: do not set --vmcwd for this command") |
10454
590b0c26877f
mx: add --workdir argument
Bernhard Urban <bernhard.urban@jku.at>
parents:
10417
diff
changeset
|
1150 |
17055
3e4d3be0b6bf
mx: fix default handling of vm config and build type
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
17052
diff
changeset
|
1151 build = vmbuild if vmbuild else _vmbuild if _vmSourcesAvailable else 'product' |
16623
addc0564e5b5
split com.oracle.graal.truffle.* projects into a separate graal-truffle.jar and added truffle.jar to the boot class path
Doug Simon <doug.simon@oracle.com>
parents:
16622
diff
changeset
|
1152 jdk = _jdk(build, vmToCheck=vm, installJars=False) |
11936
4cdf7623fbe6
ensure graal.options in the JDK is deployed/updated/deleted each time the VM is run
Doug Simon <doug.simon@oracle.com>
parents:
11867
diff
changeset
|
1153 _updateInstalledGraalOptionsFile(jdk) |
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
|
1154 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
|
1155 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
|
1156 mx.make_eclipse_launch(args, 'graal-' + build, name=None, deps=mx.project('com.oracle.graal.hotspot').all_deps([], True)) |
5024
7ccdae96e98a
Allow JaCoCon to append to the execution file
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5016
diff
changeset
|
1157 if _jacoco == 'on' or _jacoco == 'append': |
4684
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
1158 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
|
1159 # Exclude all compiler tests and snippets |
17363
4f9633b83a24
mx: reduce size of exculde command line argument and fold it into package-star expressions
Bernhard Urban <bernhard.urban@jku.at>
parents:
17356
diff
changeset
|
1160 |
18894
31960077ea9d
Specify jacoco project includes/excludes in suite.py
Paul Woegerer <paul.woegerer@oracle.com>
parents:
18893
diff
changeset
|
1161 includes = ['com.oracle.graal.*'] |
31960077ea9d
Specify jacoco project includes/excludes in suite.py
Paul Woegerer <paul.woegerer@oracle.com>
parents:
18893
diff
changeset
|
1162 baseExcludes = [] |
31960077ea9d
Specify jacoco project includes/excludes in suite.py
Paul Woegerer <paul.woegerer@oracle.com>
parents:
18893
diff
changeset
|
1163 for p in mx.projects(): |
31960077ea9d
Specify jacoco project includes/excludes in suite.py
Paul Woegerer <paul.woegerer@oracle.com>
parents:
18893
diff
changeset
|
1164 projsetting = getattr(p, 'jacoco', '') |
31960077ea9d
Specify jacoco project includes/excludes in suite.py
Paul Woegerer <paul.woegerer@oracle.com>
parents:
18893
diff
changeset
|
1165 if projsetting == 'exclude': |
31960077ea9d
Specify jacoco project includes/excludes in suite.py
Paul Woegerer <paul.woegerer@oracle.com>
parents:
18893
diff
changeset
|
1166 baseExcludes.append(p.name) |
31960077ea9d
Specify jacoco project includes/excludes in suite.py
Paul Woegerer <paul.woegerer@oracle.com>
parents:
18893
diff
changeset
|
1167 if projsetting == 'include': |
31960077ea9d
Specify jacoco project includes/excludes in suite.py
Paul Woegerer <paul.woegerer@oracle.com>
parents:
18893
diff
changeset
|
1168 includes.append(p.name + '.*') |
31960077ea9d
Specify jacoco project includes/excludes in suite.py
Paul Woegerer <paul.woegerer@oracle.com>
parents:
18893
diff
changeset
|
1169 |
17363
4f9633b83a24
mx: reduce size of exculde command line argument and fold it into package-star expressions
Bernhard Urban <bernhard.urban@jku.at>
parents:
17356
diff
changeset
|
1170 def _filter(l): |
4f9633b83a24
mx: reduce size of exculde command line argument and fold it into package-star expressions
Bernhard Urban <bernhard.urban@jku.at>
parents:
17356
diff
changeset
|
1171 # filter out specific classes which are already covered by a baseExclude package |
4f9633b83a24
mx: reduce size of exculde command line argument and fold it into package-star expressions
Bernhard Urban <bernhard.urban@jku.at>
parents:
17356
diff
changeset
|
1172 return [clazz for clazz in l if not any([clazz.startswith(package) for package in baseExcludes])] |
4f9633b83a24
mx: reduce size of exculde command line argument and fold it into package-star expressions
Bernhard Urban <bernhard.urban@jku.at>
parents:
17356
diff
changeset
|
1173 excludes = [] |
5366
67e63e8dcbd2
build JaCoCo exclude list by scanning for snippets
Doug Simon <doug.simon@oracle.com>
parents:
5295
diff
changeset
|
1174 for p in mx.projects(): |
17363
4f9633b83a24
mx: reduce size of exculde command line argument and fold it into package-star expressions
Bernhard Urban <bernhard.urban@jku.at>
parents:
17356
diff
changeset
|
1175 excludes += _filter(_find_classes_with_annotations(p, None, ['@Snippet', '@ClassSubstitution', '@Test'], includeInnerClasses=True).keys()) |
4f9633b83a24
mx: reduce size of exculde command line argument and fold it into package-star expressions
Bernhard Urban <bernhard.urban@jku.at>
parents:
17356
diff
changeset
|
1176 excludes += _filter(p.find_classes_with_matching_source_line(None, lambda line: 'JaCoCo Exclude' in line, includeInnerClasses=True).keys()) |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
1177 |
17363
4f9633b83a24
mx: reduce size of exculde command line argument and fold it into package-star expressions
Bernhard Urban <bernhard.urban@jku.at>
parents:
17356
diff
changeset
|
1178 excludes += [package + '.*' for package in baseExcludes] |
4684
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
1179 agentOptions = { |
5024
7ccdae96e98a
Allow JaCoCon to append to the execution file
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5016
diff
changeset
|
1180 'append' : 'true' if _jacoco == 'append' else 'false', |
4684
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
1181 'bootclasspath' : 'true', |
5881
472a648769e4
better JaCoCo : only include com.oracle.graal.* and com.oracle.max.*, exclude com.oracle.graal.jtt.*
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5878
diff
changeset
|
1182 'includes' : ':'.join(includes), |
5878
191e08da4de4
Apply jacoco coverage to all gate tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5877
diff
changeset
|
1183 'excludes' : ':'.join(excludes), |
191e08da4de4
Apply jacoco coverage to all gate tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5877
diff
changeset
|
1184 'destfile' : 'jacoco.exec' |
4684
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
1185 } |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
1186 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
|
1187 exe = join(jdk, 'bin', mx.exe_suffix('java')) |
11401
2d228d304247
minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents:
11395
diff
changeset
|
1188 pfx = _vm_prefix.split() if _vm_prefix is not None else [] |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
1189 |
9667
1ef7b26e9177
mx/commands.py: warn about arguments after '-version' when launching the vm
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9639
diff
changeset
|
1190 if '-version' in args: |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
1191 ignoredArgs = args[args.index('-version') + 1:] |
9667
1ef7b26e9177
mx/commands.py: warn about arguments after '-version' when launching the vm
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9639
diff
changeset
|
1192 if len(ignoredArgs) > 0: |
1ef7b26e9177
mx/commands.py: warn about arguments after '-version' when launching the vm
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9639
diff
changeset
|
1193 mx.log("Warning: The following options will be ignored by the vm because they come after the '-version' argument: " + ' '.join(ignoredArgs)) |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
1194 |
16877
6adb14d2320c
truffle.jar should always be on the bootclasspath regardless of the 'graal' status of the vm.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16875
diff
changeset
|
1195 if vm == 'original': |
6adb14d2320c
truffle.jar should always be on the bootclasspath regardless of the 'graal' status of the vm.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16875
diff
changeset
|
1196 truffle_jar = mx.archive(['@TRUFFLE'])[0] |
6adb14d2320c
truffle.jar should always be on the bootclasspath regardless of the 'graal' status of the vm.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16875
diff
changeset
|
1197 args = ['-Xbootclasspath/p:' + truffle_jar] + args |
6adb14d2320c
truffle.jar should always be on the bootclasspath regardless of the 'graal' status of the vm.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16875
diff
changeset
|
1198 |
13952
b076b5c13c3f
mx: factor out JavaConfig.processArgs and use it in mx vm. remove default -J arguments.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13951
diff
changeset
|
1199 args = mx.java().processArgs(args) |
13951
392b6ac8da36
Allow using run_java without the arguments from -J -Ja -Jp. Factor out the argument processing of mx_graal.vm and use it to pass tested-vm args down through the jmh harness
Bernhard Urban <bernhard.urban@jku.at>
parents:
13949
diff
changeset
|
1200 return (pfx, exe, vm, args, cwd) |
392b6ac8da36
Allow using run_java without the arguments from -J -Ja -Jp. Factor out the argument processing of mx_graal.vm and use it to pass tested-vm args down through the jmh harness
Bernhard Urban <bernhard.urban@jku.at>
parents:
13949
diff
changeset
|
1201 |
392b6ac8da36
Allow using run_java without the arguments from -J -Ja -Jp. Factor out the argument processing of mx_graal.vm and use it to pass tested-vm args down through the jmh harness
Bernhard Urban <bernhard.urban@jku.at>
parents:
13949
diff
changeset
|
1202 def vm(args, vm=None, nonZeroIsFatal=True, out=None, err=None, cwd=None, timeout=None, vmbuild=None): |
392b6ac8da36
Allow using run_java without the arguments from -J -Ja -Jp. Factor out the argument processing of mx_graal.vm and use it to pass tested-vm args down through the jmh harness
Bernhard Urban <bernhard.urban@jku.at>
parents:
13949
diff
changeset
|
1203 (pfx_, exe_, vm_, args_, cwd) = _parseVmArgs(args, vm, cwd, vmbuild) |
392b6ac8da36
Allow using run_java without the arguments from -J -Ja -Jp. Factor out the argument processing of mx_graal.vm and use it to pass tested-vm args down through the jmh harness
Bernhard Urban <bernhard.urban@jku.at>
parents:
13949
diff
changeset
|
1204 return mx.run(pfx_ + [exe_, '-' + vm_] + args_, nonZeroIsFatal=nonZeroIsFatal, out=out, err=err, cwd=cwd, timeout=timeout) |
3718 | 1205 |
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
|
1206 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
|
1207 """ |
5482
9f4783c0269e
folded -G:+CheckcastCounters functionality into checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
5438
diff
changeset
|
1208 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
|
1209 (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
|
1210 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
|
1211 """ |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
1212 |
13967
4cd7c6629841
mx_graal: fix pylint 1.1.0 warnings
Bernhard Urban <bernhard.urban@jku.at>
parents:
13952
diff
changeset
|
1213 matches = lambda line: len([a for a in annotations if line == a or line.startswith(a + '(')]) != 0 |
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
|
1214 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
|
1215 |
14744
bf51a92a1bdd
Add new optional method parameter
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14720
diff
changeset
|
1216 def _extract_VM_args(args, allowClasspath=False, useDoubleDash=False, defaultAllVMArgs=True): |
11359
51b0b1104114
changed unittest command to remove use of '@' character. The format is now: mx unittest [VM options] [test filters...]
Doug Simon <doug.simon@oracle.com>
parents:
11302
diff
changeset
|
1217 """ |
51b0b1104114
changed unittest command to remove use of '@' character. The format is now: mx unittest [VM options] [test filters...]
Doug Simon <doug.simon@oracle.com>
parents:
11302
diff
changeset
|
1218 Partitions a command line into a leading sequence of HotSpot VM options and the rest. |
51b0b1104114
changed unittest command to remove use of '@' character. The format is now: mx unittest [VM options] [test filters...]
Doug Simon <doug.simon@oracle.com>
parents:
11302
diff
changeset
|
1219 """ |
51b0b1104114
changed unittest command to remove use of '@' character. The format is now: mx unittest [VM options] [test filters...]
Doug Simon <doug.simon@oracle.com>
parents:
11302
diff
changeset
|
1220 for i in range(0, len(args)): |
11367
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
1221 if useDoubleDash: |
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
1222 if args[i] == '--': |
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
1223 vmArgs = args[:i] |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
1224 remainder = args[i + 1:] |
11367
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
1225 return vmArgs, remainder |
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
1226 else: |
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
1227 if not args[i].startswith('-'): |
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
1228 if i != 0 and (args[i - 1] == '-cp' or args[i - 1] == '-classpath'): |
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
1229 if not allowClasspath: |
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
1230 mx.abort('Cannot supply explicit class path option') |
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
1231 else: |
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
1232 continue |
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
1233 vmArgs = args[:i] |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
1234 remainder = args[i:] |
11367
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
1235 return vmArgs, remainder |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
1236 |
14744
bf51a92a1bdd
Add new optional method parameter
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14720
diff
changeset
|
1237 if defaultAllVMArgs: |
bf51a92a1bdd
Add new optional method parameter
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14720
diff
changeset
|
1238 return args, [] |
bf51a92a1bdd
Add new optional method parameter
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14720
diff
changeset
|
1239 else: |
bf51a92a1bdd
Add new optional method parameter
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14720
diff
changeset
|
1240 return [], args |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
1241 |
16983
e9ff3e7055e5
mx: add unittest --blacklist.
Josef Eisl <josef.eisl@jku.at>
parents:
16976
diff
changeset
|
1242 def _run_tests(args, harness, annotations, testfile, blacklist, whitelist, regex): |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
1243 |
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
1244 |
11359
51b0b1104114
changed unittest command to remove use of '@' character. The format is now: mx unittest [VM options] [test filters...]
Doug Simon <doug.simon@oracle.com>
parents:
11302
diff
changeset
|
1245 vmArgs, tests = _extract_VM_args(args) |
51b0b1104114
changed unittest command to remove use of '@' character. The format is now: mx unittest [VM options] [test filters...]
Doug Simon <doug.simon@oracle.com>
parents:
11302
diff
changeset
|
1246 for t in tests: |
51b0b1104114
changed unittest command to remove use of '@' character. The format is now: mx unittest [VM options] [test filters...]
Doug Simon <doug.simon@oracle.com>
parents:
11302
diff
changeset
|
1247 if t.startswith('-'): |
11403 | 1248 mx.abort('VM option ' + t + ' must precede ' + tests[0]) |
4159
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
1249 |
13695
b688e7da4c69
refined class path used by unittest to only include dependencies of the tests that will be run
Doug Simon <doug.simon@oracle.com>
parents:
13526
diff
changeset
|
1250 candidates = {} |
11777
f3e5cbd1efae
move pylint to mxtool
Mick Jordan <mick.jordan@oracle.com>
parents:
11758
diff
changeset
|
1251 for p in mx.projects_opt_limit_to_suites(): |
9639
fde5ccbab3a3
made unittest command take Java compliance of a project into account
Doug Simon <doug.simon@oracle.com>
parents:
9598
diff
changeset
|
1252 if mx.java().javaCompliance < p.javaCompliance: |
fde5ccbab3a3
made unittest command take Java compliance of a project into account
Doug Simon <doug.simon@oracle.com>
parents:
9598
diff
changeset
|
1253 continue |
13695
b688e7da4c69
refined class path used by unittest to only include dependencies of the tests that will be run
Doug Simon <doug.simon@oracle.com>
parents:
13526
diff
changeset
|
1254 for c in _find_classes_with_annotations(p, None, annotations).keys(): |
b688e7da4c69
refined class path used by unittest to only include dependencies of the tests that will be run
Doug Simon <doug.simon@oracle.com>
parents:
13526
diff
changeset
|
1255 candidates[c] = p |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
1256 |
10606
a6c0ae38e05e
more robust command line checking for unittest (at cost of removing support for negative filters)
Doug Simon <doug.simon@oracle.com>
parents:
10574
diff
changeset
|
1257 classes = [] |
10608
eeb80dcd60d8
fixed regression in unittest command when no tests are specified
Doug Simon <doug.simon@oracle.com>
parents:
10606
diff
changeset
|
1258 if len(tests) == 0: |
13695
b688e7da4c69
refined class path used by unittest to only include dependencies of the tests that will be run
Doug Simon <doug.simon@oracle.com>
parents:
13526
diff
changeset
|
1259 classes = candidates.keys() |
16393
380290b81eb0
mx: converted class path variables to camel case for better readability
Doug Simon <doug.simon@oracle.com>
parents:
16388
diff
changeset
|
1260 projectsCp = mx.classpath([pcp.name for pcp in mx.projects_opt_limit_to_suites() if pcp.javaCompliance <= mx.java().javaCompliance]) |
10608
eeb80dcd60d8
fixed regression in unittest command when no tests are specified
Doug Simon <doug.simon@oracle.com>
parents:
10606
diff
changeset
|
1261 else: |
13695
b688e7da4c69
refined class path used by unittest to only include dependencies of the tests that will be run
Doug Simon <doug.simon@oracle.com>
parents:
13526
diff
changeset
|
1262 projs = set() |
18237
6924bb0badc9
mx: set initial value for flag
Bernhard Urban <bernhard.urban@jku.at>
parents:
18224
diff
changeset
|
1263 found = False |
16388
31e242cad4d1
Allow mx unittest to run single test method from a class
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16381
diff
changeset
|
1264 if len(tests) == 1 and '#' in tests[0]: |
31e242cad4d1
Allow mx unittest to run single test method from a class
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16381
diff
changeset
|
1265 words = tests[0].split('#') |
31e242cad4d1
Allow mx unittest to run single test method from a class
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16381
diff
changeset
|
1266 if len(words) != 2: |
31e242cad4d1
Allow mx unittest to run single test method from a class
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16381
diff
changeset
|
1267 mx.abort("Method specification is class#method: " + tests[0]) |
31e242cad4d1
Allow mx unittest to run single test method from a class
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16381
diff
changeset
|
1268 t, method = words |
18237
6924bb0badc9
mx: set initial value for flag
Bernhard Urban <bernhard.urban@jku.at>
parents:
18224
diff
changeset
|
1269 |
13695
b688e7da4c69
refined class path used by unittest to only include dependencies of the tests that will be run
Doug Simon <doug.simon@oracle.com>
parents:
13526
diff
changeset
|
1270 for c, p in candidates.iteritems(): |
18714
b56e88144e0a
prefer exact class matches when searching for unit tests with method name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18711
diff
changeset
|
1271 # prefer exact matches first |
b56e88144e0a
prefer exact class matches when searching for unit tests with method name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18711
diff
changeset
|
1272 if t == c: |
10608
eeb80dcd60d8
fixed regression in unittest command when no tests are specified
Doug Simon <doug.simon@oracle.com>
parents:
10606
diff
changeset
|
1273 found = True |
18714
b56e88144e0a
prefer exact class matches when searching for unit tests with method name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18711
diff
changeset
|
1274 classes.append(c) |
13695
b688e7da4c69
refined class path used by unittest to only include dependencies of the tests that will be run
Doug Simon <doug.simon@oracle.com>
parents:
13526
diff
changeset
|
1275 projs.add(p.name) |
10608
eeb80dcd60d8
fixed regression in unittest command when no tests are specified
Doug Simon <doug.simon@oracle.com>
parents:
10606
diff
changeset
|
1276 if not found: |
18714
b56e88144e0a
prefer exact class matches when searching for unit tests with method name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18711
diff
changeset
|
1277 for c, p in candidates.iteritems(): |
b56e88144e0a
prefer exact class matches when searching for unit tests with method name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18711
diff
changeset
|
1278 if t in c: |
b56e88144e0a
prefer exact class matches when searching for unit tests with method name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18711
diff
changeset
|
1279 found = True |
b56e88144e0a
prefer exact class matches when searching for unit tests with method name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18711
diff
changeset
|
1280 classes.append(c) |
b56e88144e0a
prefer exact class matches when searching for unit tests with method name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18711
diff
changeset
|
1281 projs.add(p.name) |
b56e88144e0a
prefer exact class matches when searching for unit tests with method name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18711
diff
changeset
|
1282 if not found: |
10608
eeb80dcd60d8
fixed regression in unittest command when no tests are specified
Doug Simon <doug.simon@oracle.com>
parents:
10606
diff
changeset
|
1283 mx.log('warning: no tests matched by substring "' + t) |
18714
b56e88144e0a
prefer exact class matches when searching for unit tests with method name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18711
diff
changeset
|
1284 elif len(classes) != 1: |
b56e88144e0a
prefer exact class matches when searching for unit tests with method name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18711
diff
changeset
|
1285 mx.abort('More than one test matches substring {0} {1}'.format(t, classes)) |
b56e88144e0a
prefer exact class matches when searching for unit tests with method name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18711
diff
changeset
|
1286 |
b56e88144e0a
prefer exact class matches when searching for unit tests with method name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18711
diff
changeset
|
1287 classes = [c + "#" + method for c in classes] |
16388
31e242cad4d1
Allow mx unittest to run single test method from a class
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16381
diff
changeset
|
1288 else: |
31e242cad4d1
Allow mx unittest to run single test method from a class
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16381
diff
changeset
|
1289 for t in tests: |
31e242cad4d1
Allow mx unittest to run single test method from a class
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16381
diff
changeset
|
1290 if '#' in t: |
31e242cad4d1
Allow mx unittest to run single test method from a class
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16381
diff
changeset
|
1291 mx.abort('Method specifications can only be used in a single test: ' + t) |
31e242cad4d1
Allow mx unittest to run single test method from a class
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16381
diff
changeset
|
1292 for c, p in candidates.iteritems(): |
31e242cad4d1
Allow mx unittest to run single test method from a class
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16381
diff
changeset
|
1293 if t in c: |
31e242cad4d1
Allow mx unittest to run single test method from a class
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16381
diff
changeset
|
1294 found = True |
31e242cad4d1
Allow mx unittest to run single test method from a class
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16381
diff
changeset
|
1295 classes.append(c) |
31e242cad4d1
Allow mx unittest to run single test method from a class
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16381
diff
changeset
|
1296 projs.add(p.name) |
31e242cad4d1
Allow mx unittest to run single test method from a class
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16381
diff
changeset
|
1297 if not found: |
31e242cad4d1
Allow mx unittest to run single test method from a class
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16381
diff
changeset
|
1298 mx.log('warning: no tests matched by substring "' + t) |
16393
380290b81eb0
mx: converted class path variables to camel case for better readability
Doug Simon <doug.simon@oracle.com>
parents:
16388
diff
changeset
|
1299 projectsCp = mx.classpath(projs) |
8343
a3c30d467f96
unittest: just do a single JVM call
Bernhard Urban <bernhard.urban@jku.at>
parents:
8340
diff
changeset
|
1300 |
16983
e9ff3e7055e5
mx: add unittest --blacklist.
Josef Eisl <josef.eisl@jku.at>
parents:
16976
diff
changeset
|
1301 if blacklist: |
e9ff3e7055e5
mx: add unittest --blacklist.
Josef Eisl <josef.eisl@jku.at>
parents:
16976
diff
changeset
|
1302 classes = [c for c in classes if not any((glob.match(c) for glob in blacklist))] |
e9ff3e7055e5
mx: add unittest --blacklist.
Josef Eisl <josef.eisl@jku.at>
parents:
16976
diff
changeset
|
1303 |
15114
2082889fc8f6
mx: add unittest option --baseline-whitelist.
Josef Eisl <josef.eisl@jku.at>
parents:
15113
diff
changeset
|
1304 if whitelist: |
15328
d89ed48ae349
mx: use generators
Bernhard Urban <bernhard.urban@jku.at>
parents:
15327
diff
changeset
|
1305 classes = [c for c in classes if any((glob.match(c) for glob in whitelist))] |
15114
2082889fc8f6
mx: add unittest option --baseline-whitelist.
Josef Eisl <josef.eisl@jku.at>
parents:
15113
diff
changeset
|
1306 |
15555
8c19ffc672fd
mx unittest: add support for regular expressions.
Josef Eisl <josef.eisl@jku.at>
parents:
15506
diff
changeset
|
1307 if regex: |
8c19ffc672fd
mx unittest: add support for regular expressions.
Josef Eisl <josef.eisl@jku.at>
parents:
15506
diff
changeset
|
1308 classes = [c for c in classes if re.search(regex, c)] |
8c19ffc672fd
mx unittest: add support for regular expressions.
Josef Eisl <josef.eisl@jku.at>
parents:
15506
diff
changeset
|
1309 |
8343
a3c30d467f96
unittest: just do a single JVM call
Bernhard Urban <bernhard.urban@jku.at>
parents:
8340
diff
changeset
|
1310 if len(classes) != 0: |
8406
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
8343
diff
changeset
|
1311 f_testfile = open(testfile, 'w') |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
8343
diff
changeset
|
1312 for c in classes: |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
8343
diff
changeset
|
1313 f_testfile.write(c + '\n') |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
8343
diff
changeset
|
1314 f_testfile.close() |
16393
380290b81eb0
mx: converted class path variables to camel case for better readability
Doug Simon <doug.simon@oracle.com>
parents:
16388
diff
changeset
|
1315 harness(projectsCp, vmArgs) |
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
|
1316 |
18326
840257b6cdc5
mx: added --fail-fast option to unittest that stops Junit after first input class causing a test failure
Doug Simon <doug.simon@oracle.com>
parents:
18237
diff
changeset
|
1317 def _unittest(args, annotations, prefixCp="", blacklist=None, whitelist=None, verbose=False, fail_fast=False, enable_timing=False, regex=None, color=False, eager_stacktrace=False, gc_after_test=False): |
9010
08a16c26907f
MX_TESTFILE environment variable can be used to specify (and preserve) the test list file used by 'mx unittest'.
Doug Simon <doug.simon@oracle.com>
parents:
8901
diff
changeset
|
1318 testfile = os.environ.get('MX_TESTFILE', None) |
08a16c26907f
MX_TESTFILE environment variable can be used to specify (and preserve) the test list file used by 'mx unittest'.
Doug Simon <doug.simon@oracle.com>
parents:
8901
diff
changeset
|
1319 if testfile is None: |
08a16c26907f
MX_TESTFILE environment variable can be used to specify (and preserve) the test list file used by 'mx unittest'.
Doug Simon <doug.simon@oracle.com>
parents:
8901
diff
changeset
|
1320 (_, testfile) = tempfile.mkstemp(".testclasses", "graal") |
9236
ec607ddaa99b
windows-specific mx fix for executing unit tests selectively
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9177
diff
changeset
|
1321 os.close(_) |
18351 | 1322 |
18346
ddd7829c45b1
made HotSpotCodeCacheProvider attempt to load and use the hcfdis tool
Doug Simon <doug.simon@oracle.com>
parents:
18327
diff
changeset
|
1323 coreCp = mx.classpath(['com.oracle.graal.test', 'HCFDIS']) |
15575
cb2f3c49deb2
mx unittest: compile junitwrapper with right classpath
Bernhard Urban <bernhard.urban@jku.at>
parents:
15555
diff
changeset
|
1324 |
15503 | 1325 coreArgs = [] |
1326 if verbose: | |
1327 coreArgs.append('-JUnitVerbose') | |
18326
840257b6cdc5
mx: added --fail-fast option to unittest that stops Junit after first input class causing a test failure
Doug Simon <doug.simon@oracle.com>
parents:
18237
diff
changeset
|
1328 if fail_fast: |
840257b6cdc5
mx: added --fail-fast option to unittest that stops Junit after first input class causing a test failure
Doug Simon <doug.simon@oracle.com>
parents:
18237
diff
changeset
|
1329 coreArgs.append('-JUnitFailFast') |
15503 | 1330 if enable_timing: |
1331 coreArgs.append('-JUnitEnableTiming') | |
15655
ec29b2d3bdb4
mx unittest: add color support.
Josef Eisl <josef.eisl@jku.at>
parents:
15638
diff
changeset
|
1332 if color: |
ec29b2d3bdb4
mx unittest: add color support.
Josef Eisl <josef.eisl@jku.at>
parents:
15638
diff
changeset
|
1333 coreArgs.append('-JUnitColor') |
15656
fcf6e5683082
mx unittest: add --eager-stacktrace.
Josef Eisl <josef.eisl@jku.at>
parents:
15655
diff
changeset
|
1334 if eager_stacktrace: |
fcf6e5683082
mx unittest: add --eager-stacktrace.
Josef Eisl <josef.eisl@jku.at>
parents:
15655
diff
changeset
|
1335 coreArgs.append('-JUnitEagerStackTrace') |
15907
7d1690e145ae
mx: option to force a GC after each unit test
Roland Schatz <roland.schatz@oracle.com>
parents:
15896
diff
changeset
|
1336 if gc_after_test: |
7d1690e145ae
mx: option to force a GC after each unit test
Roland Schatz <roland.schatz@oracle.com>
parents:
15896
diff
changeset
|
1337 coreArgs.append('-JUnitGCAfterTest') |
8406
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
8343
diff
changeset
|
1338 |
15575
cb2f3c49deb2
mx unittest: compile junitwrapper with right classpath
Bernhard Urban <bernhard.urban@jku.at>
parents:
15555
diff
changeset
|
1339 |
16393
380290b81eb0
mx: converted class path variables to camel case for better readability
Doug Simon <doug.simon@oracle.com>
parents:
16388
diff
changeset
|
1340 def harness(projectsCp, vmArgs): |
12647
b038b643a3a4
restricted BootstrapGraal option to GRAALVM builds only
Doug Simon <doug.simon@oracle.com>
parents:
12605
diff
changeset
|
1341 if _get_vm() != 'graal': |
8440
2d0160c35f8f
Fix unittest on server0.
Roland Schatz <roland.schatz@oracle.com>
parents:
8433
diff
changeset
|
1342 prefixArgs = ['-esa', '-ea'] |
2d0160c35f8f
Fix unittest on server0.
Roland Schatz <roland.schatz@oracle.com>
parents:
8433
diff
changeset
|
1343 else: |
2d0160c35f8f
Fix unittest on server0.
Roland Schatz <roland.schatz@oracle.com>
parents:
8433
diff
changeset
|
1344 prefixArgs = ['-XX:-BootstrapGraal', '-esa', '-ea'] |
16002
c60362c5150f
mx: Use -XX:-DisableExplicitGC when running unit tests with --gc-after-test.
Roland Schatz <roland.schatz@oracle.com>
parents:
15940
diff
changeset
|
1345 if gc_after_test: |
c60362c5150f
mx: Use -XX:-DisableExplicitGC when running unit tests with --gc-after-test.
Roland Schatz <roland.schatz@oracle.com>
parents:
15940
diff
changeset
|
1346 prefixArgs.append('-XX:-DisableExplicitGC') |
11227
bd0e589a9a65
avoid use of JUnitWrapper when exactly one test is being executed
Doug Simon <doug.simon@oracle.com>
parents:
11179
diff
changeset
|
1347 with open(testfile) as fp: |
bd0e589a9a65
avoid use of JUnitWrapper when exactly one test is being executed
Doug Simon <doug.simon@oracle.com>
parents:
11179
diff
changeset
|
1348 testclasses = [l.rstrip() for l in fp.readlines()] |
16395
ad431bf0de07
added support to load classes from graal.jar with a separate class loader
Doug Simon <doug.simon@oracle.com>
parents:
16394
diff
changeset
|
1349 |
ad431bf0de07
added support to load classes from graal.jar with a separate class loader
Doug Simon <doug.simon@oracle.com>
parents:
16394
diff
changeset
|
1350 # Remove entries from class path that are in graal.jar and |
ad431bf0de07
added support to load classes from graal.jar with a separate class loader
Doug Simon <doug.simon@oracle.com>
parents:
16394
diff
changeset
|
1351 # run the VM in a mode where application/test classes can |
ad431bf0de07
added support to load classes from graal.jar with a separate class loader
Doug Simon <doug.simon@oracle.com>
parents:
16394
diff
changeset
|
1352 # access core Graal classes. |
16394
0dd27c6472d7
mx: remove entries from unittest class path that are in graal.jar when running with a Graal enabled VM
Doug Simon <doug.simon@oracle.com>
parents:
16393
diff
changeset
|
1353 cp = prefixCp + coreCp + os.pathsep + projectsCp |
0dd27c6472d7
mx: remove entries from unittest class path that are in graal.jar when running with a Graal enabled VM
Doug Simon <doug.simon@oracle.com>
parents:
16393
diff
changeset
|
1354 if isGraalEnabled(_get_vm()): |
16902
0583d157992a
formalized the set of distribution jars that are installed into the JDK to ensure both mx and the HotSpot make system do the necessary deployment
Doug Simon <doug.simon@oracle.com>
parents:
16877
diff
changeset
|
1355 excluded = set() |
0583d157992a
formalized the set of distribution jars that are installed into the JDK to ensure both mx and the HotSpot make system do the necessary deployment
Doug Simon <doug.simon@oracle.com>
parents:
16877
diff
changeset
|
1356 for jdkDist in _jdkDeployedDists: |
0583d157992a
formalized the set of distribution jars that are installed into the JDK to ensure both mx and the HotSpot make system do the necessary deployment
Doug Simon <doug.simon@oracle.com>
parents:
16877
diff
changeset
|
1357 dist = mx.distribution(jdkDist.name) |
0583d157992a
formalized the set of distribution jars that are installed into the JDK to ensure both mx and the HotSpot make system do the necessary deployment
Doug Simon <doug.simon@oracle.com>
parents:
16877
diff
changeset
|
1358 excluded.update([d.output_dir() for d in dist.sorted_deps()]) |
0583d157992a
formalized the set of distribution jars that are installed into the JDK to ensure both mx and the HotSpot make system do the necessary deployment
Doug Simon <doug.simon@oracle.com>
parents:
16877
diff
changeset
|
1359 cp = os.pathsep.join([e for e in cp.split(os.pathsep) if e not in excluded]) |
16610
8cdb9ef96c01
make up-to-date check for generated sources work with --installed-jdks
Doug Simon <doug.simon@oracle.com>
parents:
16605
diff
changeset
|
1360 vmArgs = ['-XX:-UseGraalClassLoader'] + vmArgs |
16395
ad431bf0de07
added support to load classes from graal.jar with a separate class loader
Doug Simon <doug.simon@oracle.com>
parents:
16394
diff
changeset
|
1361 |
18224
bfa20550f0a8
Suppress menubar for GraalJUnitCore on Mac
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18218
diff
changeset
|
1362 # suppress menubar and dock when running on Mac |
bfa20550f0a8
Suppress menubar for GraalJUnitCore on Mac
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18218
diff
changeset
|
1363 vmArgs = ['-Djava.awt.headless=true'] + vmArgs |
bfa20550f0a8
Suppress menubar for GraalJUnitCore on Mac
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18218
diff
changeset
|
1364 |
11227
bd0e589a9a65
avoid use of JUnitWrapper when exactly one test is being executed
Doug Simon <doug.simon@oracle.com>
parents:
11179
diff
changeset
|
1365 if len(testclasses) == 1: |
bd0e589a9a65
avoid use of JUnitWrapper when exactly one test is being executed
Doug Simon <doug.simon@oracle.com>
parents:
11179
diff
changeset
|
1366 # Execute Junit directly when one test is being run. This simplifies |
bd0e589a9a65
avoid use of JUnitWrapper when exactly one test is being executed
Doug Simon <doug.simon@oracle.com>
parents:
11179
diff
changeset
|
1367 # replaying the VM execution in a native debugger (e.g., gdb). |
18116
c4f649042a7b
mx/unittest: fix cygwin path issue
Bernhard Urban <bernhard.urban@jku.at>
parents:
18115
diff
changeset
|
1368 vm(prefixArgs + vmArgs + ['-cp', mx._separatedCygpathU2W(cp), 'com.oracle.graal.test.GraalJUnitCore'] + coreArgs + testclasses) |
11227
bd0e589a9a65
avoid use of JUnitWrapper when exactly one test is being executed
Doug Simon <doug.simon@oracle.com>
parents:
11179
diff
changeset
|
1369 else: |
18116
c4f649042a7b
mx/unittest: fix cygwin path issue
Bernhard Urban <bernhard.urban@jku.at>
parents:
18115
diff
changeset
|
1370 vm(prefixArgs + vmArgs + ['-cp', mx._separatedCygpathU2W(cp), 'com.oracle.graal.test.GraalJUnitCore'] + coreArgs + ['@' + mx._cygpathU2W(testfile)]) |
8406
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
8343
diff
changeset
|
1371 |
8433
87346100d7a5
temporary file is removed when unittests fail
Doug Simon <doug.simon@oracle.com>
parents:
8406
diff
changeset
|
1372 try: |
16983
e9ff3e7055e5
mx: add unittest --blacklist.
Josef Eisl <josef.eisl@jku.at>
parents:
16976
diff
changeset
|
1373 _run_tests(args, harness, annotations, testfile, blacklist, whitelist, regex) |
8433
87346100d7a5
temporary file is removed when unittests fail
Doug Simon <doug.simon@oracle.com>
parents:
8406
diff
changeset
|
1374 finally: |
9010
08a16c26907f
MX_TESTFILE environment variable can be used to specify (and preserve) the test list file used by 'mx unittest'.
Doug Simon <doug.simon@oracle.com>
parents:
8901
diff
changeset
|
1375 if os.environ.get('MX_TESTFILE') is None: |
08a16c26907f
MX_TESTFILE environment variable can be used to specify (and preserve) the test list file used by 'mx unittest'.
Doug Simon <doug.simon@oracle.com>
parents:
8901
diff
changeset
|
1376 os.remove(testfile) |
8340
d9d883aeb96f
unittest: seperate target `longunittest' and `shortunittest'
Bernhard Urban <bernhard.urban@jku.at>
parents:
8317
diff
changeset
|
1377 |
9598
0fc67e300471
better help message for the unittest commands
Doug Simon <doug.simon@oracle.com>
parents:
9343
diff
changeset
|
1378 _unittestHelpSuffix = """ |
15113 | 1379 Unittest options: |
1380 | |
16983
e9ff3e7055e5
mx: add unittest --blacklist.
Josef Eisl <josef.eisl@jku.at>
parents:
16976
diff
changeset
|
1381 --blacklist <file> run all testcases not specified in the blacklist |
15555
8c19ffc672fd
mx unittest: add support for regular expressions.
Josef Eisl <josef.eisl@jku.at>
parents:
15506
diff
changeset
|
1382 --whitelist <file> run only testcases which are included |
15323
6b3bb5a9a889
mx: allow to specify a path for the whitelist in the unittest command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15322
diff
changeset
|
1383 in the given whitelist |
15502
a26be2c9b81b
Add command line support for JUnit.
Josef Eisl <josef.eisl@jku.at>
parents:
15500
diff
changeset
|
1384 --verbose enable verbose JUnit output |
18326
840257b6cdc5
mx: added --fail-fast option to unittest that stops Junit after first input class causing a test failure
Doug Simon <doug.simon@oracle.com>
parents:
18237
diff
changeset
|
1385 --fail-fast stop after first JUnit test class that has a failure |
15503 | 1386 --enable-timing enable JUnit test timing |
15555
8c19ffc672fd
mx unittest: add support for regular expressions.
Josef Eisl <josef.eisl@jku.at>
parents:
15506
diff
changeset
|
1387 --regex <regex> run only testcases matching a regular expression |
15655
ec29b2d3bdb4
mx unittest: add color support.
Josef Eisl <josef.eisl@jku.at>
parents:
15638
diff
changeset
|
1388 --color enable colors output |
15656
fcf6e5683082
mx unittest: add --eager-stacktrace.
Josef Eisl <josef.eisl@jku.at>
parents:
15655
diff
changeset
|
1389 --eager-stacktrace print stacktrace eagerly |
15907
7d1690e145ae
mx: option to force a GC after each unit test
Roland Schatz <roland.schatz@oracle.com>
parents:
15896
diff
changeset
|
1390 --gc-after-test force a GC after each test |
15113 | 1391 |
1392 To avoid conflicts with VM options '--' can be used as delimiter. | |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
1393 |
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
|
1394 If filters are supplied, only tests whose fully qualified name |
10606
a6c0ae38e05e
more robust command line checking for unittest (at cost of removing support for negative filters)
Doug Simon <doug.simon@oracle.com>
parents:
10574
diff
changeset
|
1395 includes a filter as a substring are run. |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
1396 |
9598
0fc67e300471
better help message for the unittest commands
Doug Simon <doug.simon@oracle.com>
parents:
9343
diff
changeset
|
1397 For example, this command line: |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
1398 |
11367
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
1399 mx unittest -G:Dump= -G:MethodFilter=BC_aload.* -G:+PrintCFG BC_aload |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
1400 |
9598
0fc67e300471
better help message for the unittest commands
Doug Simon <doug.simon@oracle.com>
parents:
9343
diff
changeset
|
1401 will run all JUnit test classes that contain 'BC_aload' in their |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
1402 fully qualified name and will pass these options to the VM: |
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
1403 |
9598
0fc67e300471
better help message for the unittest commands
Doug Simon <doug.simon@oracle.com>
parents:
9343
diff
changeset
|
1404 -G:Dump= -G:MethodFilter=BC_aload.* -G:+PrintCFG |
0fc67e300471
better help message for the unittest commands
Doug Simon <doug.simon@oracle.com>
parents:
9343
diff
changeset
|
1405 |
0fc67e300471
better help message for the unittest commands
Doug Simon <doug.simon@oracle.com>
parents:
9343
diff
changeset
|
1406 To get around command line length limitations on some OSes, the |
0fc67e300471
better help message for the unittest commands
Doug Simon <doug.simon@oracle.com>
parents:
9343
diff
changeset
|
1407 JUnit class names to be executed are written to a file that a |
0fc67e300471
better help message for the unittest commands
Doug Simon <doug.simon@oracle.com>
parents:
9343
diff
changeset
|
1408 custom JUnit wrapper reads and passes onto JUnit proper. The |
0fc67e300471
better help message for the unittest commands
Doug Simon <doug.simon@oracle.com>
parents:
9343
diff
changeset
|
1409 MX_TESTFILE environment variable can be set to specify a |
0fc67e300471
better help message for the unittest commands
Doug Simon <doug.simon@oracle.com>
parents:
9343
diff
changeset
|
1410 file which will not be deleted once the unittests are done |
0fc67e300471
better help message for the unittest commands
Doug Simon <doug.simon@oracle.com>
parents:
9343
diff
changeset
|
1411 (unlike the temporary file otherwise used). |
0fc67e300471
better help message for the unittest commands
Doug Simon <doug.simon@oracle.com>
parents:
9343
diff
changeset
|
1412 |
0fc67e300471
better help message for the unittest commands
Doug Simon <doug.simon@oracle.com>
parents:
9343
diff
changeset
|
1413 As with all other commands, using the global '-v' before 'unittest' |
11359
51b0b1104114
changed unittest command to remove use of '@' character. The format is now: mx unittest [VM options] [test filters...]
Doug Simon <doug.simon@oracle.com>
parents:
11302
diff
changeset
|
1414 command will cause mx to show the complete command line |
9598
0fc67e300471
better help message for the unittest commands
Doug Simon <doug.simon@oracle.com>
parents:
9343
diff
changeset
|
1415 it uses to run the VM. |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
1416 """ |
9598
0fc67e300471
better help message for the unittest commands
Doug Simon <doug.simon@oracle.com>
parents:
9343
diff
changeset
|
1417 |
0fc67e300471
better help message for the unittest commands
Doug Simon <doug.simon@oracle.com>
parents:
9343
diff
changeset
|
1418 def unittest(args): |
0fc67e300471
better help message for the unittest commands
Doug Simon <doug.simon@oracle.com>
parents:
9343
diff
changeset
|
1419 """run the JUnit tests (all testcases){0}""" |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
1420 |
15113 | 1421 parser = ArgumentParser(prog='mx unittest', |
1422 description='run the JUnit tests', | |
1423 add_help=False, | |
1424 formatter_class=RawDescriptionHelpFormatter, | |
1425 epilog=_unittestHelpSuffix, | |
1426 ) | |
16983
e9ff3e7055e5
mx: add unittest --blacklist.
Josef Eisl <josef.eisl@jku.at>
parents:
16976
diff
changeset
|
1427 parser.add_argument('--blacklist', help='run all testcases not specified in the blacklist', metavar='<path>') |
15323
6b3bb5a9a889
mx: allow to specify a path for the whitelist in the unittest command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15322
diff
changeset
|
1428 parser.add_argument('--whitelist', help='run testcases specified in whitelist only', metavar='<path>') |
15502
a26be2c9b81b
Add command line support for JUnit.
Josef Eisl <josef.eisl@jku.at>
parents:
15500
diff
changeset
|
1429 parser.add_argument('--verbose', help='enable verbose JUnit output', action='store_true') |
18326
840257b6cdc5
mx: added --fail-fast option to unittest that stops Junit after first input class causing a test failure
Doug Simon <doug.simon@oracle.com>
parents:
18237
diff
changeset
|
1430 parser.add_argument('--fail-fast', help='stop after first JUnit test class that has a failure', action='store_true') |
15503 | 1431 parser.add_argument('--enable-timing', help='enable JUnit test timing', action='store_true') |
15555
8c19ffc672fd
mx unittest: add support for regular expressions.
Josef Eisl <josef.eisl@jku.at>
parents:
15506
diff
changeset
|
1432 parser.add_argument('--regex', help='run only testcases matching a regular expression', metavar='<regex>') |
15655
ec29b2d3bdb4
mx unittest: add color support.
Josef Eisl <josef.eisl@jku.at>
parents:
15638
diff
changeset
|
1433 parser.add_argument('--color', help='enable color output', action='store_true') |
15656
fcf6e5683082
mx unittest: add --eager-stacktrace.
Josef Eisl <josef.eisl@jku.at>
parents:
15655
diff
changeset
|
1434 parser.add_argument('--eager-stacktrace', help='print stacktrace eagerly', action='store_true') |
15907
7d1690e145ae
mx: option to force a GC after each unit test
Roland Schatz <roland.schatz@oracle.com>
parents:
15896
diff
changeset
|
1435 parser.add_argument('--gc-after-test', help='force a GC after each test', action='store_true') |
15113 | 1436 |
1437 ut_args = [] | |
1438 delimiter = False | |
1439 # check for delimiter | |
1440 while len(args) > 0: | |
1441 arg = args.pop(0) | |
1442 if arg == '--': | |
1443 delimiter = True | |
1444 break | |
1445 ut_args.append(arg) | |
1446 | |
1447 if delimiter: | |
1448 # all arguments before '--' must be recognized | |
1449 parsed_args = parser.parse_args(ut_args) | |
1450 else: | |
1451 # parse all know arguments | |
15197
06bfcf5f941d
mx: improve unittest options parsing.
Josef Eisl <josef.eisl@jku.at>
parents:
15178
diff
changeset
|
1452 parsed_args, args = parser.parse_known_args(ut_args) |
15113 | 1453 |
15323
6b3bb5a9a889
mx: allow to specify a path for the whitelist in the unittest command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15322
diff
changeset
|
1454 if parsed_args.whitelist: |
15114
2082889fc8f6
mx: add unittest option --baseline-whitelist.
Josef Eisl <josef.eisl@jku.at>
parents:
15113
diff
changeset
|
1455 try: |
15323
6b3bb5a9a889
mx: allow to specify a path for the whitelist in the unittest command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15322
diff
changeset
|
1456 with open(join(_graal_home, parsed_args.whitelist)) as fp: |
15657
50740bac9679
mx unittest: simplify argument passing.
Josef Eisl <josef.eisl@jku.at>
parents:
15656
diff
changeset
|
1457 parsed_args.whitelist = [re.compile(fnmatch.translate(l.rstrip())) for l in fp.readlines() if not l.startswith('#')] |
15114
2082889fc8f6
mx: add unittest option --baseline-whitelist.
Josef Eisl <josef.eisl@jku.at>
parents:
15113
diff
changeset
|
1458 except IOError: |
15323
6b3bb5a9a889
mx: allow to specify a path for the whitelist in the unittest command
Bernhard Urban <bernhard.urban@jku.at>
parents:
15322
diff
changeset
|
1459 mx.log('warning: could not read whitelist: ' + parsed_args.whitelist) |
16983
e9ff3e7055e5
mx: add unittest --blacklist.
Josef Eisl <josef.eisl@jku.at>
parents:
16976
diff
changeset
|
1460 if parsed_args.blacklist: |
e9ff3e7055e5
mx: add unittest --blacklist.
Josef Eisl <josef.eisl@jku.at>
parents:
16976
diff
changeset
|
1461 try: |
e9ff3e7055e5
mx: add unittest --blacklist.
Josef Eisl <josef.eisl@jku.at>
parents:
16976
diff
changeset
|
1462 with open(join(_graal_home, parsed_args.blacklist)) as fp: |
e9ff3e7055e5
mx: add unittest --blacklist.
Josef Eisl <josef.eisl@jku.at>
parents:
16976
diff
changeset
|
1463 parsed_args.blacklist = [re.compile(fnmatch.translate(l.rstrip())) for l in fp.readlines() if not l.startswith('#')] |
e9ff3e7055e5
mx: add unittest --blacklist.
Josef Eisl <josef.eisl@jku.at>
parents:
16976
diff
changeset
|
1464 except IOError: |
e9ff3e7055e5
mx: add unittest --blacklist.
Josef Eisl <josef.eisl@jku.at>
parents:
16976
diff
changeset
|
1465 mx.log('warning: could not read blacklist: ' + parsed_args.blacklist) |
15114
2082889fc8f6
mx: add unittest option --baseline-whitelist.
Josef Eisl <josef.eisl@jku.at>
parents:
15113
diff
changeset
|
1466 |
15657
50740bac9679
mx unittest: simplify argument passing.
Josef Eisl <josef.eisl@jku.at>
parents:
15656
diff
changeset
|
1467 _unittest(args, ['@Test', '@Parameters'], **parsed_args.__dict__) |
8340
d9d883aeb96f
unittest: seperate target `longunittest' and `shortunittest'
Bernhard Urban <bernhard.urban@jku.at>
parents:
8317
diff
changeset
|
1468 |
d9d883aeb96f
unittest: seperate target `longunittest' and `shortunittest'
Bernhard Urban <bernhard.urban@jku.at>
parents:
8317
diff
changeset
|
1469 def shortunittest(args): |
15324
5b5f47104c0d
mx: add whitelist for shortunittest
Bernhard Urban <bernhard.urban@jku.at>
parents:
15323
diff
changeset
|
1470 """alias for 'unittest --whitelist test/whitelist_shortunittest.txt'{0}""" |
8340
d9d883aeb96f
unittest: seperate target `longunittest' and `shortunittest'
Bernhard Urban <bernhard.urban@jku.at>
parents:
8317
diff
changeset
|
1471 |
15324
5b5f47104c0d
mx: add whitelist for shortunittest
Bernhard Urban <bernhard.urban@jku.at>
parents:
15323
diff
changeset
|
1472 args = ['--whitelist', 'test/whitelist_shortunittest.txt'] + args |
15113 | 1473 unittest(args) |
8340
d9d883aeb96f
unittest: seperate target `longunittest' and `shortunittest'
Bernhard Urban <bernhard.urban@jku.at>
parents:
8317
diff
changeset
|
1474 |
18897
9afee75cee46
mx: add microbench command to run JMH benchmarks
Roland Schatz <roland.schatz@oracle.com>
parents:
18894
diff
changeset
|
1475 def microbench(args): |
9afee75cee46
mx: add microbench command to run JMH benchmarks
Roland Schatz <roland.schatz@oracle.com>
parents:
18894
diff
changeset
|
1476 """run JMH microbenchmark projects""" |
9afee75cee46
mx: add microbench command to run JMH benchmarks
Roland Schatz <roland.schatz@oracle.com>
parents:
18894
diff
changeset
|
1477 vmArgs, jmhArgs = _extract_VM_args(args, useDoubleDash=True) |
9afee75cee46
mx: add microbench command to run JMH benchmarks
Roland Schatz <roland.schatz@oracle.com>
parents:
18894
diff
changeset
|
1478 |
9afee75cee46
mx: add microbench command to run JMH benchmarks
Roland Schatz <roland.schatz@oracle.com>
parents:
18894
diff
changeset
|
1479 # look for -f in JMH arguments |
9afee75cee46
mx: add microbench command to run JMH benchmarks
Roland Schatz <roland.schatz@oracle.com>
parents:
18894
diff
changeset
|
1480 containsF = False |
9afee75cee46
mx: add microbench command to run JMH benchmarks
Roland Schatz <roland.schatz@oracle.com>
parents:
18894
diff
changeset
|
1481 forking = True |
9afee75cee46
mx: add microbench command to run JMH benchmarks
Roland Schatz <roland.schatz@oracle.com>
parents:
18894
diff
changeset
|
1482 for i in range(len(jmhArgs)): |
9afee75cee46
mx: add microbench command to run JMH benchmarks
Roland Schatz <roland.schatz@oracle.com>
parents:
18894
diff
changeset
|
1483 arg = jmhArgs[i] |
9afee75cee46
mx: add microbench command to run JMH benchmarks
Roland Schatz <roland.schatz@oracle.com>
parents:
18894
diff
changeset
|
1484 if arg.startswith('-f'): |
9afee75cee46
mx: add microbench command to run JMH benchmarks
Roland Schatz <roland.schatz@oracle.com>
parents:
18894
diff
changeset
|
1485 containsF = True |
9afee75cee46
mx: add microbench command to run JMH benchmarks
Roland Schatz <roland.schatz@oracle.com>
parents:
18894
diff
changeset
|
1486 if arg == '-f' and (i+1) < len(jmhArgs): |
9afee75cee46
mx: add microbench command to run JMH benchmarks
Roland Schatz <roland.schatz@oracle.com>
parents:
18894
diff
changeset
|
1487 arg += jmhArgs[i+1] |
9afee75cee46
mx: add microbench command to run JMH benchmarks
Roland Schatz <roland.schatz@oracle.com>
parents:
18894
diff
changeset
|
1488 try: |
9afee75cee46
mx: add microbench command to run JMH benchmarks
Roland Schatz <roland.schatz@oracle.com>
parents:
18894
diff
changeset
|
1489 if int(arg[2:]) == 0: |
9afee75cee46
mx: add microbench command to run JMH benchmarks
Roland Schatz <roland.schatz@oracle.com>
parents:
18894
diff
changeset
|
1490 forking = False |
9afee75cee46
mx: add microbench command to run JMH benchmarks
Roland Schatz <roland.schatz@oracle.com>
parents:
18894
diff
changeset
|
1491 except ValueError: |
9afee75cee46
mx: add microbench command to run JMH benchmarks
Roland Schatz <roland.schatz@oracle.com>
parents:
18894
diff
changeset
|
1492 pass |
9afee75cee46
mx: add microbench command to run JMH benchmarks
Roland Schatz <roland.schatz@oracle.com>
parents:
18894
diff
changeset
|
1493 |
9afee75cee46
mx: add microbench command to run JMH benchmarks
Roland Schatz <roland.schatz@oracle.com>
parents:
18894
diff
changeset
|
1494 # default to -f1 if not specified otherwise |
9afee75cee46
mx: add microbench command to run JMH benchmarks
Roland Schatz <roland.schatz@oracle.com>
parents:
18894
diff
changeset
|
1495 if not containsF: |
9afee75cee46
mx: add microbench command to run JMH benchmarks
Roland Schatz <roland.schatz@oracle.com>
parents:
18894
diff
changeset
|
1496 jmhArgs += ['-f1'] |
9afee75cee46
mx: add microbench command to run JMH benchmarks
Roland Schatz <roland.schatz@oracle.com>
parents:
18894
diff
changeset
|
1497 |
19044 | 1498 # find all projects with a direct JMH dependency |
18897
9afee75cee46
mx: add microbench command to run JMH benchmarks
Roland Schatz <roland.schatz@oracle.com>
parents:
18894
diff
changeset
|
1499 jmhProjects = [] |
9afee75cee46
mx: add microbench command to run JMH benchmarks
Roland Schatz <roland.schatz@oracle.com>
parents:
18894
diff
changeset
|
1500 for p in mx.projects(): |
9afee75cee46
mx: add microbench command to run JMH benchmarks
Roland Schatz <roland.schatz@oracle.com>
parents:
18894
diff
changeset
|
1501 if 'JMH' in p.deps: |
9afee75cee46
mx: add microbench command to run JMH benchmarks
Roland Schatz <roland.schatz@oracle.com>
parents:
18894
diff
changeset
|
1502 jmhProjects.append(p.name) |
9afee75cee46
mx: add microbench command to run JMH benchmarks
Roland Schatz <roland.schatz@oracle.com>
parents:
18894
diff
changeset
|
1503 cp = mx.classpath(jmhProjects) |
9afee75cee46
mx: add microbench command to run JMH benchmarks
Roland Schatz <roland.schatz@oracle.com>
parents:
18894
diff
changeset
|
1504 |
9afee75cee46
mx: add microbench command to run JMH benchmarks
Roland Schatz <roland.schatz@oracle.com>
parents:
18894
diff
changeset
|
1505 # execute JMH runner |
9afee75cee46
mx: add microbench command to run JMH benchmarks
Roland Schatz <roland.schatz@oracle.com>
parents:
18894
diff
changeset
|
1506 args = ['-cp', cp] |
9afee75cee46
mx: add microbench command to run JMH benchmarks
Roland Schatz <roland.schatz@oracle.com>
parents:
18894
diff
changeset
|
1507 if not forking: |
18931
926488f5d345
mx: fix duplicate arguments for microbench
Roland Schatz <roland.schatz@oracle.com>
parents:
18897
diff
changeset
|
1508 args += vmArgs |
18897
9afee75cee46
mx: add microbench command to run JMH benchmarks
Roland Schatz <roland.schatz@oracle.com>
parents:
18894
diff
changeset
|
1509 args += ['org.openjdk.jmh.Main'] |
9afee75cee46
mx: add microbench command to run JMH benchmarks
Roland Schatz <roland.schatz@oracle.com>
parents:
18894
diff
changeset
|
1510 if forking: |
18931
926488f5d345
mx: fix duplicate arguments for microbench
Roland Schatz <roland.schatz@oracle.com>
parents:
18897
diff
changeset
|
1511 (_, _, jvm, _, _) = _parseVmArgs(vmArgs) |
926488f5d345
mx: fix duplicate arguments for microbench
Roland Schatz <roland.schatz@oracle.com>
parents:
18897
diff
changeset
|
1512 args += ['--jvmArgsPrepend', ' '.join(['-' + jvm] + vmArgs)] |
18897
9afee75cee46
mx: add microbench command to run JMH benchmarks
Roland Schatz <roland.schatz@oracle.com>
parents:
18894
diff
changeset
|
1513 vm(args + jmhArgs) |
9afee75cee46
mx: add microbench command to run JMH benchmarks
Roland Schatz <roland.schatz@oracle.com>
parents:
18894
diff
changeset
|
1514 |
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
|
1515 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
|
1516 """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
|
1517 |
11296
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
1518 vmsDefault = ','.join(_vmChoices.keys()) |
9095
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
1519 vmbuildsDefault = ','.join(_vmbuildChoices) |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
1520 |
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
1521 parser = ArgumentParser(prog='mx buildvms') |
9095
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
1522 parser.add_argument('--vms', help='a comma separated list of VMs to build (default: ' + vmsDefault + ')', metavar='<args>', default=vmsDefault) |
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
1523 parser.add_argument('--builds', help='a comma separated list of build types (default: ' + vmbuildsDefault + ')', metavar='<args>', default=vmbuildsDefault) |
21043
5ea65fe64368
Check distributions overlap in gate
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21040
diff
changeset
|
1524 parser.add_argument('--check-distributions', action='store_true', dest='check_distributions', help='check built distributions for overlap') |
9096
d4b868ed9cfb
buildvms command now runs "java -version" for each VM built unless -n option is specified
Doug Simon <doug.simon@oracle.com>
parents:
9095
diff
changeset
|
1525 parser.add_argument('-n', '--no-check', action='store_true', help='omit running "java -version" after each build') |
9097
a0ab945fb95f
build output during buildvms command is sent to console (instead of log files) if -c option is given
Doug Simon <doug.simon@oracle.com>
parents:
9096
diff
changeset
|
1526 parser.add_argument('-c', '--console', action='store_true', help='send build output to console instead of log file') |
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
|
1527 |
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
|
1528 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
|
1529 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
|
1530 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
|
1531 |
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
|
1532 allStart = time.time() |
21043
5ea65fe64368
Check distributions overlap in gate
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21040
diff
changeset
|
1533 check_dists_args = ['--check-distributions'] if args.check_distributions else [] |
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
|
1534 for v in vms: |
14602
591f4a575ebf
issue warning/error where ever relevant if a non-supported VM (e.g., client VM on Mac) is used in mx
Doug Simon <doug.simon@oracle.com>
parents:
14595
diff
changeset
|
1535 if not isVMSupported(v): |
591f4a575ebf
issue warning/error where ever relevant if a non-supported VM (e.g., client VM on Mac) is used in mx
Doug Simon <doug.simon@oracle.com>
parents:
14595
diff
changeset
|
1536 mx.log('The ' + v + ' VM is not supported on this platform - skipping') |
591f4a575ebf
issue warning/error where ever relevant if a non-supported VM (e.g., client VM on Mac) is used in mx
Doug Simon <doug.simon@oracle.com>
parents:
14595
diff
changeset
|
1537 continue |
591f4a575ebf
issue warning/error where ever relevant if a non-supported VM (e.g., client VM on Mac) is used in mx
Doug Simon <doug.simon@oracle.com>
parents:
14595
diff
changeset
|
1538 |
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
|
1539 for vmbuild in builds: |
9117
cbfcb1054619
renamed 'boot' VM to 'original' VM
Doug Simon <doug.simon@oracle.com>
parents:
9116
diff
changeset
|
1540 if v == 'original' and vmbuild != 'product': |
9095
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
1541 continue |
9097
a0ab945fb95f
build output during buildvms command is sent to console (instead of log files) if -c option is given
Doug Simon <doug.simon@oracle.com>
parents:
9096
diff
changeset
|
1542 if not args.console: |
a0ab945fb95f
build output during buildvms command is sent to console (instead of log files) if -c option is given
Doug Simon <doug.simon@oracle.com>
parents:
9096
diff
changeset
|
1543 logFile = join(v + '-' + vmbuild + '.log') |
a0ab945fb95f
build output during buildvms command is sent to console (instead of log files) if -c option is given
Doug Simon <doug.simon@oracle.com>
parents:
9096
diff
changeset
|
1544 log = open(join(_graal_home, logFile), 'wb') |
a0ab945fb95f
build output during buildvms command is sent to console (instead of log files) if -c option is given
Doug Simon <doug.simon@oracle.com>
parents:
9096
diff
changeset
|
1545 start = time.time() |
a0ab945fb95f
build output during buildvms command is sent to console (instead of log files) if -c option is given
Doug Simon <doug.simon@oracle.com>
parents:
9096
diff
changeset
|
1546 mx.log('BEGIN: ' + v + '-' + vmbuild + '\t(see: ' + logFile + ')') |
17317
f434913f9cba
mx: buildvms should inherit verbosity
Bernhard Urban <bernhard.urban@jku.at>
parents:
17307
diff
changeset
|
1547 verbose = ['-v'] if mx._opts.verbose else [] |
9097
a0ab945fb95f
build output during buildvms command is sent to console (instead of log files) if -c option is given
Doug Simon <doug.simon@oracle.com>
parents:
9096
diff
changeset
|
1548 # Run as subprocess so that output can be directed to a file |
21043
5ea65fe64368
Check distributions overlap in gate
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21040
diff
changeset
|
1549 cmd = [sys.executable, '-u', join('mxtool', 'mx.py')] + verbose + ['--vm', v, '--vmbuild', vmbuild, 'build'] + check_dists_args |
17317
f434913f9cba
mx: buildvms should inherit verbosity
Bernhard Urban <bernhard.urban@jku.at>
parents:
17307
diff
changeset
|
1550 mx.logv("executing command: " + str(cmd)) |
f434913f9cba
mx: buildvms should inherit verbosity
Bernhard Urban <bernhard.urban@jku.at>
parents:
17307
diff
changeset
|
1551 subprocess.check_call(cmd, cwd=_graal_home, stdout=log, stderr=subprocess.STDOUT) |
9097
a0ab945fb95f
build output during buildvms command is sent to console (instead of log files) if -c option is given
Doug Simon <doug.simon@oracle.com>
parents:
9096
diff
changeset
|
1552 duration = datetime.timedelta(seconds=time.time() - start) |
a0ab945fb95f
build output during buildvms command is sent to console (instead of log files) if -c option is given
Doug Simon <doug.simon@oracle.com>
parents:
9096
diff
changeset
|
1553 mx.log('END: ' + v + '-' + vmbuild + '\t[' + str(duration) + ']') |
a0ab945fb95f
build output during buildvms command is sent to console (instead of log files) if -c option is given
Doug Simon <doug.simon@oracle.com>
parents:
9096
diff
changeset
|
1554 else: |
11371
74414b248381
mx: added --vmbuild global option, removed --product, --fastdebug, --debug options as well as suffix of build command
Doug Simon <doug.simon@oracle.com>
parents:
11368
diff
changeset
|
1555 with VM(v, vmbuild): |
21043
5ea65fe64368
Check distributions overlap in gate
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21040
diff
changeset
|
1556 build(check_dists_args) |
9096
d4b868ed9cfb
buildvms command now runs "java -version" for each VM built unless -n option is specified
Doug Simon <doug.simon@oracle.com>
parents:
9095
diff
changeset
|
1557 if not args.no_check: |
d4b868ed9cfb
buildvms command now runs "java -version" for each VM built unless -n option is specified
Doug Simon <doug.simon@oracle.com>
parents:
9095
diff
changeset
|
1558 vmargs = ['-version'] |
d4b868ed9cfb
buildvms command now runs "java -version" for each VM built unless -n option is specified
Doug Simon <doug.simon@oracle.com>
parents:
9095
diff
changeset
|
1559 if v == 'graal': |
d4b868ed9cfb
buildvms command now runs "java -version" for each VM built unless -n option is specified
Doug Simon <doug.simon@oracle.com>
parents:
9095
diff
changeset
|
1560 vmargs.insert(0, '-XX:-BootstrapGraal') |
d4b868ed9cfb
buildvms command now runs "java -version" for each VM built unless -n option is specified
Doug Simon <doug.simon@oracle.com>
parents:
9095
diff
changeset
|
1561 vm(vmargs, vm=v, vmbuild=vmbuild) |
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
|
1562 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
|
1563 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
|
1564 |
11756
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1565 class Task: |
20000
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1566 # None or a list of strings. If not None, only tasks whose title |
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1567 # matches at least one of the substrings in this list will return |
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1568 # a non-None value from __enter__. The body of a 'with Task(...) as t' |
20002 | 1569 # statement should check 't' and exit immediately if it is None. |
20000
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1570 filters = None |
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1571 |
17438
b8d89559915d
mx: implement with support for Task()
Bernhard Urban <bernhard.urban@jku.at>
parents:
17437
diff
changeset
|
1572 def __init__(self, title, tasks=None): |
20000
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1573 self.tasks = tasks |
11756
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1574 self.title = title |
20012
9a3c19db3015
Fix time reporting for mx gate -t foo
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20002
diff
changeset
|
1575 self.skipped = tasks is not None and Task.filters is not None and not any([f in title for f in Task.filters]) |
20000
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1576 if not self.skipped: |
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1577 self.start = time.time() |
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1578 self.end = None |
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1579 self.duration = None |
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1580 mx.log(time.strftime('gate: %d %b %Y %H:%M:%S: BEGIN: ') + title) |
17438
b8d89559915d
mx: implement with support for Task()
Bernhard Urban <bernhard.urban@jku.at>
parents:
17437
diff
changeset
|
1581 def __enter__(self): |
b8d89559915d
mx: implement with support for Task()
Bernhard Urban <bernhard.urban@jku.at>
parents:
17437
diff
changeset
|
1582 assert self.tasks is not None, "using Task with 'with' statement requires to pass the tasks list in the constructor" |
20000
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1583 if self.skipped: |
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1584 return None |
17438
b8d89559915d
mx: implement with support for Task()
Bernhard Urban <bernhard.urban@jku.at>
parents:
17437
diff
changeset
|
1585 return self |
b8d89559915d
mx: implement with support for Task()
Bernhard Urban <bernhard.urban@jku.at>
parents:
17437
diff
changeset
|
1586 def __exit__(self, exc_type, exc_value, traceback): |
20000
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1587 if not self.skipped: |
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1588 self.tasks.append(self.stop()) |
11756
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1589 def stop(self): |
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1590 self.end = time.time() |
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1591 self.duration = datetime.timedelta(seconds=self.end - self.start) |
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1592 mx.log(time.strftime('gate: %d %b %Y %H:%M:%S: END: ') + self.title + ' [' + str(self.duration) + ']') |
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1593 return self |
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1594 def abort(self, codeOrMessage): |
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1595 self.end = time.time() |
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1596 self.duration = datetime.timedelta(seconds=self.end - self.start) |
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1597 mx.log(time.strftime('gate: %d %b %Y %H:%M:%S: ABORT: ') + self.title + ' [' + str(self.duration) + ']') |
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1598 mx.abort(codeOrMessage) |
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1599 return self |
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1600 |
17052
35fda668ed6e
mx: added ctw command to simplify executing CompileTheWorld
Doug Simon <doug.simon@oracle.com>
parents:
17015
diff
changeset
|
1601 def ctw(args): |
35fda668ed6e
mx: added ctw command to simplify executing CompileTheWorld
Doug Simon <doug.simon@oracle.com>
parents:
17015
diff
changeset
|
1602 """run CompileTheWorld""" |
17372
d42e11af980d
mx: simplified ctw command
Doug Simon <doug.simon@oracle.com>
parents:
17363
diff
changeset
|
1603 |
18106
7a771b48e392
mx: improved ctw command usage message and made the default value for --ctwopts be "-Inline"
Doug Simon <doug.simon@oracle.com>
parents:
17438
diff
changeset
|
1604 defaultCtwopts = '-Inline' |
7a771b48e392
mx: improved ctw command usage message and made the default value for --ctwopts be "-Inline"
Doug Simon <doug.simon@oracle.com>
parents:
17438
diff
changeset
|
1605 |
17372
d42e11af980d
mx: simplified ctw command
Doug Simon <doug.simon@oracle.com>
parents:
17363
diff
changeset
|
1606 parser = ArgumentParser(prog='mx ctw') |
18106
7a771b48e392
mx: improved ctw command usage message and made the default value for --ctwopts be "-Inline"
Doug Simon <doug.simon@oracle.com>
parents:
17438
diff
changeset
|
1607 parser.add_argument('--ctwopts', action='store', help='space separated Graal options used for CTW compilations (default: --ctwopts="' + defaultCtwopts + '")', default=defaultCtwopts, metavar='<options>') |
7a771b48e392
mx: improved ctw command usage message and made the default value for --ctwopts be "-Inline"
Doug Simon <doug.simon@oracle.com>
parents:
17438
diff
changeset
|
1608 parser.add_argument('--jar', action='store', help='jar of classes to compiled instead of rt.jar', metavar='<path>') |
17372
d42e11af980d
mx: simplified ctw command
Doug Simon <doug.simon@oracle.com>
parents:
17363
diff
changeset
|
1609 parser.add_argument('vmargs', nargs=REMAINDER, metavar='VM options...') |
d42e11af980d
mx: simplified ctw command
Doug Simon <doug.simon@oracle.com>
parents:
17363
diff
changeset
|
1610 |
d42e11af980d
mx: simplified ctw command
Doug Simon <doug.simon@oracle.com>
parents:
17363
diff
changeset
|
1611 args, vmargs = parser.parse_known_args(args) |
17052
35fda668ed6e
mx: added ctw command to simplify executing CompileTheWorld
Doug Simon <doug.simon@oracle.com>
parents:
17015
diff
changeset
|
1612 |
17372
d42e11af980d
mx: simplified ctw command
Doug Simon <doug.simon@oracle.com>
parents:
17363
diff
changeset
|
1613 if args.ctwopts: |
d42e11af980d
mx: simplified ctw command
Doug Simon <doug.simon@oracle.com>
parents:
17363
diff
changeset
|
1614 vmargs.append('-G:CompileTheWorldConfig=' + args.ctwopts) |
17052
35fda668ed6e
mx: added ctw command to simplify executing CompileTheWorld
Doug Simon <doug.simon@oracle.com>
parents:
17015
diff
changeset
|
1615 |
17372
d42e11af980d
mx: simplified ctw command
Doug Simon <doug.simon@oracle.com>
parents:
17363
diff
changeset
|
1616 if args.jar: |
17392
9c241dc74cfc
mx: specify jar of classes differently depending on whether Graal is hosted or not
Doug Simon <doug.simon@oracle.com>
parents:
17388
diff
changeset
|
1617 jar = os.path.abspath(args.jar) |
17372
d42e11af980d
mx: simplified ctw command
Doug Simon <doug.simon@oracle.com>
parents:
17363
diff
changeset
|
1618 else: |
d42e11af980d
mx: simplified ctw command
Doug Simon <doug.simon@oracle.com>
parents:
17363
diff
changeset
|
1619 jar = join(_jdk(installJars=False), 'jre', 'lib', 'rt.jar') |
20967
f61ff7f01bc2
Add CompileTheWorldExcludeMethodFilter to CTW and remove sun.awt.X11 classes from default ctw mx target.
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
20922
diff
changeset
|
1620 vmargs.append('-G:CompileTheWorldExcludeMethodFilter=sun.awt.X11.*.*') |
17372
d42e11af980d
mx: simplified ctw command
Doug Simon <doug.simon@oracle.com>
parents:
17363
diff
changeset
|
1621 |
17392
9c241dc74cfc
mx: specify jar of classes differently depending on whether Graal is hosted or not
Doug Simon <doug.simon@oracle.com>
parents:
17388
diff
changeset
|
1622 vmargs += ['-XX:+CompileTheWorld'] |
17411
6d82c240d83e
use -G:CompileTheWorldClasspath instead of -Xbootclasspath/p when doing Graal CTW on a Graal enabled VM
Doug Simon <doug.simon@oracle.com>
parents:
17392
diff
changeset
|
1623 vm_ = _get_vm() |
6d82c240d83e
use -G:CompileTheWorldClasspath instead of -Xbootclasspath/p when doing Graal CTW on a Graal enabled VM
Doug Simon <doug.simon@oracle.com>
parents:
17392
diff
changeset
|
1624 if isGraalEnabled(vm_): |
6d82c240d83e
use -G:CompileTheWorldClasspath instead of -Xbootclasspath/p when doing Graal CTW on a Graal enabled VM
Doug Simon <doug.simon@oracle.com>
parents:
17392
diff
changeset
|
1625 if vm_ == 'graal': |
6d82c240d83e
use -G:CompileTheWorldClasspath instead of -Xbootclasspath/p when doing Graal CTW on a Graal enabled VM
Doug Simon <doug.simon@oracle.com>
parents:
17392
diff
changeset
|
1626 vmargs += ['-XX:+BootstrapGraal'] |
6d82c240d83e
use -G:CompileTheWorldClasspath instead of -Xbootclasspath/p when doing Graal CTW on a Graal enabled VM
Doug Simon <doug.simon@oracle.com>
parents:
17392
diff
changeset
|
1627 vmargs += ['-G:CompileTheWorldClasspath=' + jar] |
17392
9c241dc74cfc
mx: specify jar of classes differently depending on whether Graal is hosted or not
Doug Simon <doug.simon@oracle.com>
parents:
17388
diff
changeset
|
1628 else: |
9c241dc74cfc
mx: specify jar of classes differently depending on whether Graal is hosted or not
Doug Simon <doug.simon@oracle.com>
parents:
17388
diff
changeset
|
1629 vmargs += ['-Xbootclasspath/p:' + jar] |
20020
af1e4c16b00f
suppress menubar and dock when running ctw on Mac
Doug Simon <doug.simon@oracle.com>
parents:
20012
diff
changeset
|
1630 |
20967
f61ff7f01bc2
Add CompileTheWorldExcludeMethodFilter to CTW and remove sun.awt.X11 classes from default ctw mx target.
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
20922
diff
changeset
|
1631 # suppress menubar and dock when running on Mac; exclude x11 classes as they may cause vm crashes (on Solaris) |
20020
af1e4c16b00f
suppress menubar and dock when running ctw on Mac
Doug Simon <doug.simon@oracle.com>
parents:
20012
diff
changeset
|
1632 vmargs = ['-Djava.awt.headless=true'] + vmargs |
af1e4c16b00f
suppress menubar and dock when running ctw on Mac
Doug Simon <doug.simon@oracle.com>
parents:
20012
diff
changeset
|
1633 |
17372
d42e11af980d
mx: simplified ctw command
Doug Simon <doug.simon@oracle.com>
parents:
17363
diff
changeset
|
1634 vm(vmargs) |
17052
35fda668ed6e
mx: added ctw command to simplify executing CompileTheWorld
Doug Simon <doug.simon@oracle.com>
parents:
17015
diff
changeset
|
1635 |
11756
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1636 def _basic_gate_body(args, tasks): |
19162
32c7a5a88523
Run unit tests even earlier during gate
Doug Simon <doug.simon@oracle.com>
parents:
19160
diff
changeset
|
1637 # Build server-hosted-graal now so we can run the unit tests |
20000
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1638 with Task('BuildHotSpotGraalHosted: product', tasks) as t: |
21043
5ea65fe64368
Check distributions overlap in gate
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21040
diff
changeset
|
1639 if t: buildvms(['--vms', 'server', '--builds', 'product', '--check-distributions']) |
11756
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1640 |
19162
32c7a5a88523
Run unit tests even earlier during gate
Doug Simon <doug.simon@oracle.com>
parents:
19160
diff
changeset
|
1641 # Run unit tests on server-hosted-graal |
32c7a5a88523
Run unit tests even earlier during gate
Doug Simon <doug.simon@oracle.com>
parents:
19160
diff
changeset
|
1642 with VM('server', 'product'): |
20000
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1643 with Task('UnitTests:hosted-product', tasks) as t: |
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1644 if t: unittest(['--enable-timing', '--verbose', '--fail-fast']) |
19160
d4f80cf249d0
Run unittest earlier during gate
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19044
diff
changeset
|
1645 |
20032
4d119424b4ce
Add CTW of rt.jar to gate
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20020
diff
changeset
|
1646 # Run ctw against rt.jar on server-hosted-graal |
4d119424b4ce
Add CTW of rt.jar to gate
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20020
diff
changeset
|
1647 with VM('server', 'product'): |
4d119424b4ce
Add CTW of rt.jar to gate
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20020
diff
changeset
|
1648 with Task('CTW:hosted-product', tasks) as t: |
4d119424b4ce
Add CTW of rt.jar to gate
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20020
diff
changeset
|
1649 if t: ctw(['--ctwopts', '-Inline +ExitVMOnException', '-esa', '-G:+CompileTheWorldMultiThreaded', '-G:-CompileTheWorldVerbose']) |
4d119424b4ce
Add CTW of rt.jar to gate
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20020
diff
changeset
|
1650 |
19162
32c7a5a88523
Run unit tests even earlier during gate
Doug Simon <doug.simon@oracle.com>
parents:
19160
diff
changeset
|
1651 # Build the other VM flavors |
20000
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1652 with Task('BuildHotSpotGraalOthers: fastdebug,product', tasks) as t: |
21043
5ea65fe64368
Check distributions overlap in gate
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21040
diff
changeset
|
1653 if t: buildvms(['--vms', 'graal,server', '--builds', 'fastdebug,product', '--check-distributions']) |
19162
32c7a5a88523
Run unit tests even earlier during gate
Doug Simon <doug.simon@oracle.com>
parents:
19160
diff
changeset
|
1654 |
11756
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1655 with VM('graal', 'fastdebug'): |
20000
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1656 with Task('BootstrapWithSystemAssertions:fastdebug', tasks) as t: |
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1657 if t: vm(['-esa', '-XX:-TieredCompilation', '-version']) |
11756
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1658 |
14123
dc41eab09fe8
gate: add non-tiered bootstrap
Bernhard Urban <bernhard.urban@jku.at>
parents:
14116
diff
changeset
|
1659 with VM('graal', 'fastdebug'): |
20000
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1660 with Task('BootstrapEconomyWithSystemAssertions:fastdebug', tasks) as t: |
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1661 if t: vm(['-esa', '-XX:-TieredCompilation', '-G:CompilerConfiguration=economy', '-version']) |
19776
287f7c223d58
Add compiler configuration "economy".
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19733
diff
changeset
|
1662 |
287f7c223d58
Add compiler configuration "economy".
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19733
diff
changeset
|
1663 with VM('graal', 'fastdebug'): |
20000
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1664 with Task('BootstrapWithSystemAssertionsNoCoop:fastdebug', tasks) as t: |
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1665 if t: vm(['-esa', '-XX:-TieredCompilation', '-XX:-UseCompressedOops', '-version']) |
14123
dc41eab09fe8
gate: add non-tiered bootstrap
Bernhard Urban <bernhard.urban@jku.at>
parents:
14116
diff
changeset
|
1666 |
21059
59632bb8e4ad
Add bootstrap with invoke exception edges to gate.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
21043
diff
changeset
|
1667 with VM('graal', 'fastdebug'): |
59632bb8e4ad
Add bootstrap with invoke exception edges to gate.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
21043
diff
changeset
|
1668 with Task('BootstrapWithExceptionEdges:fastdebug', tasks) as t: |
59632bb8e4ad
Add bootstrap with invoke exception edges to gate.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
21043
diff
changeset
|
1669 if t: vm(['-esa', '-XX:-TieredCompilation', '-G:+StressInvokeWithExceptionNode', '-version']) |
59632bb8e4ad
Add bootstrap with invoke exception edges to gate.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
21043
diff
changeset
|
1670 |
11756
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1671 with VM('graal', 'product'): |
20000
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1672 with Task('BootstrapWithGCVerification:product', tasks) as t: |
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1673 if t: |
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1674 out = mx.DuplicateSuppressingStream(['VerifyAfterGC:', 'VerifyBeforeGC:']).write |
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1675 vm(['-XX:-TieredCompilation', '-XX:+UnlockDiagnosticVMOptions', '-XX:+VerifyBeforeGC', '-XX:+VerifyAfterGC', '-version'], out=out) |
11756
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1676 |
12412
3c11430f62d8
Re-enable G1 verification in gate
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12359
diff
changeset
|
1677 with VM('graal', 'product'): |
20000
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1678 with Task('BootstrapWithG1GCVerification:product', tasks) as t: |
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1679 if t: |
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1680 out = mx.DuplicateSuppressingStream(['VerifyAfterGC:', 'VerifyBeforeGC:']).write |
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1681 vm(['-XX:-TieredCompilation', '-XX:+UnlockDiagnosticVMOptions', '-XX:-UseSerialGC', '-XX:+UseG1GC', '-XX:+VerifyBeforeGC', '-XX:+VerifyAfterGC', '-version'], out=out) |
11756
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1682 |
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1683 with VM('graal', 'product'): |
20000
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1684 with Task('BootstrapWithRegisterPressure:product', tasks) as t: |
20994 | 1685 if t: |
20992
0a4bbeae6e31
[SPARC] Configure registers right for register pressure in gate run
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
20967
diff
changeset
|
1686 registers = 'o0,o1,o2,o3,f8,f9,d32,d34' if platform.processor() == 'sparc' else 'rbx,r11,r10,r14,xmm3,xmm11,xmm14' |
0a4bbeae6e31
[SPARC] Configure registers right for register pressure in gate run
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
20967
diff
changeset
|
1687 vm(['-XX:-TieredCompilation', '-G:RegisterPressure=' + registers, '-esa', '-version']) |
11756
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1688 |
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1689 with VM('graal', 'product'): |
20000
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1690 with Task('BootstrapWithImmutableCode:product', tasks) as t: |
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1691 if t: vm(['-XX:-TieredCompilation', '-G:+ImmutableCode', '-G:+VerifyPhases', '-esa', '-version']) |
11756
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1692 |
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1693 for vmbuild in ['fastdebug', 'product']: |
14877
fdb912b1eb7b
gate: use no tiered to test bootstrap, add scaladacapo-kiama (fastdebug)
Bernhard Urban <bernhard.urban@jku.at>
parents:
14872
diff
changeset
|
1694 for test in sanitycheck.getDacapos(level=sanitycheck.SanityCheckLevel.Gate, gateBuildLevel=vmbuild) + sanitycheck.getScalaDacapos(level=sanitycheck.SanityCheckLevel.Gate, gateBuildLevel=vmbuild): |
17438
b8d89559915d
mx: implement with support for Task()
Bernhard Urban <bernhard.urban@jku.at>
parents:
17437
diff
changeset
|
1695 with Task(str(test) + ':' + vmbuild, tasks) as t: |
20000
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1696 if t and not test.test('graal'): |
17438
b8d89559915d
mx: implement with support for Task()
Bernhard Urban <bernhard.urban@jku.at>
parents:
17437
diff
changeset
|
1697 t.abort(test.name + ' Failed') |
11756
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1698 |
16381
d91fecb90fc0
Check -Xbatch still works in the gate
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16327
diff
changeset
|
1699 # ensure -Xbatch still works |
d91fecb90fc0
Check -Xbatch still works in the gate
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16327
diff
changeset
|
1700 with VM('graal', 'product'): |
20000
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1701 with Task('DaCapo_pmd:BatchMode:product', tasks) as t: |
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1702 if t: dacapo(['-Xbatch', 'pmd']) |
16381
d91fecb90fc0
Check -Xbatch still works in the gate
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16327
diff
changeset
|
1703 |
16437
680f52926754
added test for -Xcomp to the gate
Doug Simon <doug.simon@oracle.com>
parents:
16419
diff
changeset
|
1704 # ensure -Xcomp still works |
680f52926754
added test for -Xcomp to the gate
Doug Simon <doug.simon@oracle.com>
parents:
16419
diff
changeset
|
1705 with VM('graal', 'product'): |
20000
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1706 with Task('XCompMode:product', tasks) as t: |
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1707 if t: vm(['-Xcomp', '-version']) |
16437
680f52926754
added test for -Xcomp to the gate
Doug Simon <doug.simon@oracle.com>
parents:
16419
diff
changeset
|
1708 |
11756
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1709 if args.jacocout is not None: |
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1710 jacocoreport([args.jacocout]) |
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1711 |
11758
4ac92e735a16
pylint fixes (retry)
Mick Jordan <mick.jordan@oracle.com>
parents:
11757
diff
changeset
|
1712 global _jacoco |
11756
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1713 _jacoco = 'off' |
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1714 |
20000
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1715 with Task('CleanAndBuildIdealGraphVisualizer', tasks) as t: |
20996
5e78d067ebbe
Do not build IGV in gate when running on SPARC
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
20994
diff
changeset
|
1716 if t and platform.processor() != 'sparc': |
20000
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1717 buildxml = mx._cygpathU2W(join(_graal_home, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'build.xml')) |
21165
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1718 mx.run(['ant', '-f', buildxml, '-q', 'clean', 'build'], env=_igvBuildEnv()) |
11756
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1719 |
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1720 # Prevent Graal modifications from breaking the standard builds |
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1721 if args.buildNonGraal: |
20000
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1722 with Task('BuildHotSpotVarieties', tasks) as t: |
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1723 if t: |
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1724 buildvms(['--vms', 'client,server', '--builds', 'fastdebug,product']) |
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1725 if mx.get_os() not in ['windows', 'cygwin']: |
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1726 buildvms(['--vms', 'server-nograal', '--builds', 'product,optimized']) |
11756
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1727 |
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1728 for vmbuild in ['product', 'fastdebug']: |
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1729 for theVm in ['client', 'server']: |
14606
f50dece27798
fixed regression in gate command
Doug Simon <doug.simon@oracle.com>
parents:
14605
diff
changeset
|
1730 if not isVMSupported(theVm): |
20922 | 1731 mx.log('The ' + theVm + ' VM is not supported on this platform') |
14602
591f4a575ebf
issue warning/error where ever relevant if a non-supported VM (e.g., client VM on Mac) is used in mx
Doug Simon <doug.simon@oracle.com>
parents:
14595
diff
changeset
|
1732 continue |
11756
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1733 with VM(theVm, vmbuild): |
20000
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1734 with Task('DaCapo_pmd:' + theVm + ':' + vmbuild, tasks) as t: |
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1735 if t: dacapo(['pmd']) |
11756
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1736 |
20000
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1737 with Task('UnitTests:' + theVm + ':' + vmbuild, tasks) as t: |
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1738 if t: unittest(['-XX:CompileCommand=exclude,*::run*', 'graal.api']) |
11756
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1739 |
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1740 |
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1741 def gate(args, gate_body=_basic_gate_body): |
4159
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
1742 """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
|
1743 |
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
|
1744 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
|
1745 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
|
1746 |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
1747 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
|
1748 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
|
1749 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
|
1750 parser.add_argument('-g', '--only-build-graalvm', action='store_false', dest='buildNonGraal', help='only build the Graal VM') |
20000
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1751 parser.add_argument('-t', '--task-filter', help='comma separated list of substrings to select subset of tasks to be run') |
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
|
1752 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
|
1753 |
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
|
1754 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
|
1755 |
5431
0bd1ba69db2a
removed double declaration of _vmbuild global variable in gate command
Doug Simon <doug.simon@oracle.com>
parents:
5430
diff
changeset
|
1756 global _jacoco |
20000
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1757 if args.task_filter: |
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1758 Task.filters = args.task_filter.split(',') |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
1759 |
21165
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1760 # Force |
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1761 if not mx._opts.strict_compliance: |
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1762 mx.log("[gate] foring strict compliance") |
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1763 mx._opts.strict_compliance = True |
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1764 |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
1765 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
|
1766 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
|
1767 try: |
20000
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1768 with Task('Pylint', tasks) as t: |
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1769 if t: mx.pylint([]) |
11526 | 1770 |
13928
c4e5a685c6a1
gate: compile java with ECJ if available
Bernhard Urban <bernhard.urban@jku.at>
parents:
13919
diff
changeset
|
1771 def _clean(name='Clean'): |
20000
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1772 with Task(name, tasks) as t: |
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1773 if t: |
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1774 cleanArgs = [] |
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1775 if not args.cleanNative: |
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1776 cleanArgs.append('--no-native') |
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1777 if not args.cleanJava: |
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1778 cleanArgs.append('--no-java') |
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1779 clean(cleanArgs) |
13928
c4e5a685c6a1
gate: compile java with ECJ if available
Bernhard Urban <bernhard.urban@jku.at>
parents:
13919
diff
changeset
|
1780 _clean() |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
1781 |
17438
b8d89559915d
mx: implement with support for Task()
Bernhard Urban <bernhard.urban@jku.at>
parents:
17437
diff
changeset
|
1782 with Task('IDEConfigCheck', tasks): |
20000
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1783 if t: |
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1784 mx.ideclean([]) |
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1785 mx.ideinit([]) |
9824
6fa4b4933892
added check to gate that generated IDE configurations don't break the build
Doug Simon <doug.simon@oracle.com>
parents:
9803
diff
changeset
|
1786 |
13928
c4e5a685c6a1
gate: compile java with ECJ if available
Bernhard Urban <bernhard.urban@jku.at>
parents:
13919
diff
changeset
|
1787 eclipse_exe = mx.get_env('ECLIPSE_EXE') |
7533
29b0768b7ba6
added eclipseformat to the gate
Doug Simon <doug.simon@oracle.com>
parents:
7509
diff
changeset
|
1788 if eclipse_exe is not None: |
17438
b8d89559915d
mx: implement with support for Task()
Bernhard Urban <bernhard.urban@jku.at>
parents:
17437
diff
changeset
|
1789 with Task('CodeFormatCheck', tasks) as t: |
20000
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1790 if t and mx.eclipseformat(['-e', eclipse_exe]) != 0: |
17438
b8d89559915d
mx: implement with support for Task()
Bernhard Urban <bernhard.urban@jku.at>
parents:
17437
diff
changeset
|
1791 t.abort('Formatter modified files - run "mx eclipseformat", check in changes and repush') |
8211
74896b25297a
Test canonicalization and checkstyle early in gate process
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8183
diff
changeset
|
1792 |
17438
b8d89559915d
mx: implement with support for Task()
Bernhard Urban <bernhard.urban@jku.at>
parents:
17437
diff
changeset
|
1793 with Task('Canonicalization Check', tasks) as t: |
20000
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1794 if t: |
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1795 mx.log(time.strftime('%d %b %Y %H:%M:%S - Ensuring mx/projects files are canonicalized...')) |
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1796 if mx.canonicalizeprojects([]) != 0: |
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1797 t.abort('Rerun "mx canonicalizeprojects" and check-in the modified mx/projects files.') |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
1798 |
13928
c4e5a685c6a1
gate: compile java with ECJ if available
Bernhard Urban <bernhard.urban@jku.at>
parents:
13919
diff
changeset
|
1799 if mx.get_env('JDT'): |
17438
b8d89559915d
mx: implement with support for Task()
Bernhard Urban <bernhard.urban@jku.at>
parents:
17437
diff
changeset
|
1800 with Task('BuildJavaWithEcj', tasks): |
20000
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1801 if t: build(['-p', '--no-native', '--jdt-warning-as-error']) |
13928
c4e5a685c6a1
gate: compile java with ECJ if available
Bernhard Urban <bernhard.urban@jku.at>
parents:
13919
diff
changeset
|
1802 _clean('CleanAfterEcjBuild') |
c4e5a685c6a1
gate: compile java with ECJ if available
Bernhard Urban <bernhard.urban@jku.at>
parents:
13919
diff
changeset
|
1803 |
17438
b8d89559915d
mx: implement with support for Task()
Bernhard Urban <bernhard.urban@jku.at>
parents:
17437
diff
changeset
|
1804 with Task('BuildJavaWithJavac', tasks): |
20000
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1805 if t: build(['-p', '--no-native', '--force-javac']) |
9172
bc5c5336008b
Add gate test to check build-graal.xml is up to date.
Roland Schatz <roland.schatz@oracle.com>
parents:
9169
diff
changeset
|
1806 |
18163
c88ab4f1f04a
re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents:
18116
diff
changeset
|
1807 with Task('Checkstyle', tasks) as t: |
20000
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1808 if t and mx.checkstyle([]) != 0: |
18163
c88ab4f1f04a
re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents:
18116
diff
changeset
|
1809 t.abort('Checkstyle warnings were found') |
c88ab4f1f04a
re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents:
18116
diff
changeset
|
1810 |
17438
b8d89559915d
mx: implement with support for Task()
Bernhard Urban <bernhard.urban@jku.at>
parents:
17437
diff
changeset
|
1811 with Task('Checkheaders', tasks) as t: |
20000
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1812 if t and checkheaders([]) != 0: |
17438
b8d89559915d
mx: implement with support for Task()
Bernhard Urban <bernhard.urban@jku.at>
parents:
17437
diff
changeset
|
1813 t.abort('Checkheaders warnings were found') |
14773
78343531acc7
added checkheaders to the gate
Doug Simon <doug.simon@oracle.com>
parents:
14772
diff
changeset
|
1814 |
17438
b8d89559915d
mx: implement with support for Task()
Bernhard Urban <bernhard.urban@jku.at>
parents:
17437
diff
changeset
|
1815 with Task('FindBugs', tasks) as t: |
20000
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1816 if t and findbugs([]) != 0: |
17438
b8d89559915d
mx: implement with support for Task()
Bernhard Urban <bernhard.urban@jku.at>
parents:
17437
diff
changeset
|
1817 t.abort('FindBugs warnings were found') |
14751
015f84f0b375
added findbugs to the gate
Doug Simon <doug.simon@oracle.com>
parents:
14744
diff
changeset
|
1818 |
5878
191e08da4de4
Apply jacoco coverage to all gate tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5877
diff
changeset
|
1819 if exists('jacoco.exec'): |
191e08da4de4
Apply jacoco coverage to all gate tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5877
diff
changeset
|
1820 os.unlink('jacoco.exec') |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
1821 |
5878
191e08da4de4
Apply jacoco coverage to all gate tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5877
diff
changeset
|
1822 if args.jacocout is not None: |
191e08da4de4
Apply jacoco coverage to all gate tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5877
diff
changeset
|
1823 _jacoco = 'append' |
191e08da4de4
Apply jacoco coverage to all gate tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5877
diff
changeset
|
1824 else: |
191e08da4de4
Apply jacoco coverage to all gate tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5877
diff
changeset
|
1825 _jacoco = 'off' |
11757 | 1826 |
11756
78e6109ee411
mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents:
11605
diff
changeset
|
1827 gate_body(args, tasks) |
7155
c356cab093bc
added execution of the Graal API unittest with non-GraalVM HotSpot builds to the gate
Doug Simon <doug.simon@oracle.com>
parents:
7154
diff
changeset
|
1828 |
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
|
1829 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
|
1830 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
|
1831 |
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
|
1832 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
|
1833 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
|
1834 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
|
1835 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
|
1836 |
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
|
1837 total.stop() |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
1838 |
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
|
1839 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
|
1840 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
|
1841 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
|
1842 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
|
1843 mx.log(' ' + str(total.duration)) |
11757 | 1844 |
20000
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1845 if args.task_filter: |
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1846 Task.filters = None |
e8a0a61526b2
added support for refining the tasks run by 'mx gate' (e.g., 'mx gate -t Economy' will only run tasks whose title contains the substring 'Economy')
Doug Simon <doug.simon@oracle.com>
parents:
19796
diff
changeset
|
1847 |
6340
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
1848 def deoptalot(args): |
11377
0fbc1e418c88
fixed capitalization and tense in documentation of some mx commands
Doug Simon <doug.simon@oracle.com>
parents:
11373
diff
changeset
|
1849 """bootstrap a fastdebug Graal VM with DeoptimizeALot and VerifyOops on |
6340
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
1850 |
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
1851 If the first argument is a number, the process will be repeated |
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
1852 this number of times. All other arguments are passed to the VM.""" |
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
1853 count = 1 |
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
1854 if len(args) > 0 and args[0].isdigit(): |
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
1855 count = int(args[0]) |
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
1856 del args[0] |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
1857 |
7509 | 1858 for _ in range(count): |
6340
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
1859 if not vm(['-XX:+DeoptimizeALot', '-XX:+VerifyOops'] + args + ['-version'], vmbuild='fastdebug') == 0: |
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
1860 mx.abort("Failed") |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
1861 |
6340
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
1862 def longtests(args): |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
1863 |
6340
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
1864 deoptalot(['15', '-Xmx48m']) |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
1865 |
6340
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
1866 dacapo(['100', 'eclipse', '-esa']) |
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
|
1867 |
21165
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1868 def _igvJdk(): |
18893
19d99eec8876
Fix mx igv: do not use Java < 1.8, handle the case where no JDKs are supported. Give some hints when the igv ant build fails.
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
18876
diff
changeset
|
1869 v8u20 = mx.VersionSpec("1.8.0_20") |
19d99eec8876
Fix mx igv: do not use Java < 1.8, handle the case where no JDKs are supported. Give some hints when the igv ant build fails.
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
18876
diff
changeset
|
1870 v8u40 = mx.VersionSpec("1.8.0_40") |
19d99eec8876
Fix mx igv: do not use Java < 1.8, handle the case where no JDKs are supported. Give some hints when the igv ant build fails.
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
18876
diff
changeset
|
1871 v8 = mx.VersionSpec("1.8") |
21165
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1872 def _igvJdkVersionCheck(version): |
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1873 return version >= v8 and (version < v8u20 or version >= v8u40) |
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1874 return mx.java_version(_igvJdkVersionCheck, versionDescription='>= 1.8 and < 1.8.0u20 or >= 1.8.0u40').jdk |
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1875 |
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1876 def _igvBuildEnv(): |
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1877 # When the http_proxy environment variable is set, convert it to the proxy settings that ant needs |
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1878 env = dict(os.environ) |
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1879 proxy = os.environ.get('http_proxy') |
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1880 if not (proxy is None) and len(proxy) > 0: |
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1881 if '://' in proxy: |
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1882 # Remove the http:// prefix (or any other protocol prefix) |
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1883 proxy = proxy.split('://', 1)[1] |
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1884 # Separate proxy server name and port number |
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1885 proxyName, proxyPort = proxy.split(':', 1) |
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1886 proxyEnv = '-DproxyHost="' + proxyName + '" -DproxyPort=' + proxyPort |
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1887 env['ANT_OPTS'] = proxyEnv |
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1888 |
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1889 env['JAVA_HOME'] = _igvJdk() |
17388
9e5abd0e7916
mx/igv: fallback mechanism to work around a javac bug in jdk8u20
Bernhard Urban <bernhard.urban@jku.at>
parents:
17372
diff
changeset
|
1890 return env |
9e5abd0e7916
mx/igv: fallback mechanism to work around a javac bug in jdk8u20
Bernhard Urban <bernhard.urban@jku.at>
parents:
17372
diff
changeset
|
1891 |
5089
206e68bb66c6
Made the IdealGraphVisualizer runnable from mx with new 'igv' command.
Doug Simon <doug.simon@oracle.com>
parents:
5064
diff
changeset
|
1892 def igv(args): |
206e68bb66c6
Made the IdealGraphVisualizer runnable from mx with new 'igv' command.
Doug Simon <doug.simon@oracle.com>
parents:
5064
diff
changeset
|
1893 """run the Ideal Graph Visualizer""" |
18893
19d99eec8876
Fix mx igv: do not use Java < 1.8, handle the case where no JDKs are supported. Give some hints when the igv ant build fails.
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
18876
diff
changeset
|
1894 logFile = '.ideal_graph_visualizer.log' |
19d99eec8876
Fix mx igv: do not use Java < 1.8, handle the case where no JDKs are supported. Give some hints when the igv ant build fails.
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
18876
diff
changeset
|
1895 with open(join(_graal_home, logFile), 'w') as fp: |
10568
070b4a3c56f3
disabled "noisy" log statements unless -v option (i.e. verbose) is specified to mx
Doug Simon <doug.simon@oracle.com>
parents:
10527
diff
changeset
|
1896 mx.logv('[Ideal Graph Visualizer log is in ' + fp.name + ']') |
13472
72e2ec923b7b
added support to replace NetBeans platform used by IGV if it is out of date (GRAAL-420)
Doug Simon <doug.simon@oracle.com>
parents:
13471
diff
changeset
|
1897 nbplatform = join(_graal_home, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'nbplatform') |
72e2ec923b7b
added support to replace NetBeans platform used by IGV if it is out of date (GRAAL-420)
Doug Simon <doug.simon@oracle.com>
parents:
13471
diff
changeset
|
1898 |
72e2ec923b7b
added support to replace NetBeans platform used by IGV if it is out of date (GRAAL-420)
Doug Simon <doug.simon@oracle.com>
parents:
13471
diff
changeset
|
1899 # Remove NetBeans platform if it is earlier than the current supported version |
72e2ec923b7b
added support to replace NetBeans platform used by IGV if it is out of date (GRAAL-420)
Doug Simon <doug.simon@oracle.com>
parents:
13471
diff
changeset
|
1900 if exists(nbplatform): |
19430
9f037830060a
Make mx igv more robust against bad nbplatform states
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
19335
diff
changeset
|
1901 updateTrackingFile = join(nbplatform, 'platform', 'update_tracking', 'org-netbeans-core.xml') |
9f037830060a
Make mx igv more robust against bad nbplatform states
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
19335
diff
changeset
|
1902 if not exists(updateTrackingFile): |
9f037830060a
Make mx igv more robust against bad nbplatform states
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
19335
diff
changeset
|
1903 mx.log('Could not find \'' + updateTrackingFile + '\', removing NetBeans platform') |
13472
72e2ec923b7b
added support to replace NetBeans platform used by IGV if it is out of date (GRAAL-420)
Doug Simon <doug.simon@oracle.com>
parents:
13471
diff
changeset
|
1904 shutil.rmtree(nbplatform) |
19430
9f037830060a
Make mx igv more robust against bad nbplatform states
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
19335
diff
changeset
|
1905 else: |
9f037830060a
Make mx igv more robust against bad nbplatform states
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
19335
diff
changeset
|
1906 dom = xml.dom.minidom.parse(updateTrackingFile) |
9f037830060a
Make mx igv more robust against bad nbplatform states
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
19335
diff
changeset
|
1907 currentVersion = mx.VersionSpec(dom.getElementsByTagName('module_version')[0].getAttribute('specification_version')) |
9f037830060a
Make mx igv more robust against bad nbplatform states
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
19335
diff
changeset
|
1908 supportedVersion = mx.VersionSpec('3.43.1') |
9f037830060a
Make mx igv more robust against bad nbplatform states
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
19335
diff
changeset
|
1909 if currentVersion < supportedVersion: |
9f037830060a
Make mx igv more robust against bad nbplatform states
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
19335
diff
changeset
|
1910 mx.log('Replacing NetBeans platform version ' + str(currentVersion) + ' with version ' + str(supportedVersion)) |
9f037830060a
Make mx igv more robust against bad nbplatform states
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
19335
diff
changeset
|
1911 shutil.rmtree(nbplatform) |
9f037830060a
Make mx igv more robust against bad nbplatform states
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
19335
diff
changeset
|
1912 elif supportedVersion < currentVersion: |
9f037830060a
Make mx igv more robust against bad nbplatform states
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
19335
diff
changeset
|
1913 mx.log('Supported NetBeans version in igv command should be updated to ' + str(currentVersion)) |
13472
72e2ec923b7b
added support to replace NetBeans platform used by IGV if it is out of date (GRAAL-420)
Doug Simon <doug.simon@oracle.com>
parents:
13471
diff
changeset
|
1914 |
72e2ec923b7b
added support to replace NetBeans platform used by IGV if it is out of date (GRAAL-420)
Doug Simon <doug.simon@oracle.com>
parents:
13471
diff
changeset
|
1915 if not exists(nbplatform): |
72e2ec923b7b
added support to replace NetBeans platform used by IGV if it is out of date (GRAAL-420)
Doug Simon <doug.simon@oracle.com>
parents:
13471
diff
changeset
|
1916 mx.logv('[This execution may take a while as the NetBeans platform needs to be downloaded]') |
21165
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1917 |
bdeaa5a7b83c
Look for JDKs on demand, add --strict-compliance flag. Allow more precise search for JDK versions (use it for IGV)
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21122
diff
changeset
|
1918 env = _igvBuildEnv() |
18983
43baadc1913a
Automatically install Batik for SVG export in IGV
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18931
diff
changeset
|
1919 # make the jar for Batik 1.7 available. |
43baadc1913a
Automatically install Batik for SVG export in IGV
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18931
diff
changeset
|
1920 env['IGV_BATIK_JAR'] = mx.library('BATIK').get_path(True) |
18893
19d99eec8876
Fix mx igv: do not use Java < 1.8, handle the case where no JDKs are supported. Give some hints when the igv ant build fails.
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
18876
diff
changeset
|
1921 if mx.run(['ant', '-f', mx._cygpathU2W(join(_graal_home, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'build.xml')), '-l', mx._cygpathU2W(fp.name), 'run'], env=env, nonZeroIsFatal=False): |
19d99eec8876
Fix mx igv: do not use Java < 1.8, handle the case where no JDKs are supported. Give some hints when the igv ant build fails.
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
18876
diff
changeset
|
1922 mx.abort("IGV ant build & launch failed. Check '" + logFile + "'. You can also try to delete 'src/share/tools/IdealGraphVisualizer/nbplatform'.") |
14116
be7ebdf41bea
mx: new command to start c1visualizer; support for IGV download when using a proxy server
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14048
diff
changeset
|
1923 |
16693
b002c864e974
Truffle: rename install to maven-install-truffle and update location of Truffle JARs.
Chris Seaton <chris.seaton@oracle.com>
parents:
16676
diff
changeset
|
1924 def maven_install_truffle(args): |
16622
faaea970b951
Add an mx install command to install the Truffle jars to the local Maven repository.
Chris Seaton <chris.seaton@oracle.com>
parents:
16621
diff
changeset
|
1925 """install Truffle into your local Maven repository""" |
16729
3d148f5e90b8
mx: refactor maven_install_truffle such that it uses specified paths from the project file
Bernhard Urban <bernhard.urban@jku.at>
parents:
16699
diff
changeset
|
1926 for name in ['TRUFFLE', 'TRUFFLE-DSL-PROCESSOR']: |
3d148f5e90b8
mx: refactor maven_install_truffle such that it uses specified paths from the project file
Bernhard Urban <bernhard.urban@jku.at>
parents:
16699
diff
changeset
|
1927 mx.archive(["@" + name]) |
3d148f5e90b8
mx: refactor maven_install_truffle such that it uses specified paths from the project file
Bernhard Urban <bernhard.urban@jku.at>
parents:
16699
diff
changeset
|
1928 path = mx._dists[name].path |
3d148f5e90b8
mx: refactor maven_install_truffle such that it uses specified paths from the project file
Bernhard Urban <bernhard.urban@jku.at>
parents:
16699
diff
changeset
|
1929 mx.run(['mvn', 'install:install-file', '-DgroupId=com.oracle', '-DartifactId=' + name.lower(), '-Dversion=' + graal_version('SNAPSHOT'), '-Dpackaging=jar', '-Dfile=' + path]) |
16622
faaea970b951
Add an mx install command to install the Truffle jars to the local Maven repository.
Chris Seaton <chris.seaton@oracle.com>
parents:
16621
diff
changeset
|
1930 |
14116
be7ebdf41bea
mx: new command to start c1visualizer; support for IGV download when using a proxy server
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14048
diff
changeset
|
1931 def c1visualizer(args): |
be7ebdf41bea
mx: new command to start c1visualizer; support for IGV download when using a proxy server
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14048
diff
changeset
|
1932 """run the Cl Compiler Visualizer""" |
be7ebdf41bea
mx: new command to start c1visualizer; support for IGV download when using a proxy server
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14048
diff
changeset
|
1933 libpath = join(_graal_home, 'lib') |
be7ebdf41bea
mx: new command to start c1visualizer; support for IGV download when using a proxy server
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14048
diff
changeset
|
1934 if mx.get_os() == 'windows': |
be7ebdf41bea
mx: new command to start c1visualizer; support for IGV download when using a proxy server
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14048
diff
changeset
|
1935 executable = join(libpath, 'c1visualizer', 'bin', 'c1visualizer.exe') |
be7ebdf41bea
mx: new command to start c1visualizer; support for IGV download when using a proxy server
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14048
diff
changeset
|
1936 else: |
be7ebdf41bea
mx: new command to start c1visualizer; support for IGV download when using a proxy server
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14048
diff
changeset
|
1937 executable = join(libpath, 'c1visualizer', 'bin', 'c1visualizer') |
be7ebdf41bea
mx: new command to start c1visualizer; support for IGV download when using a proxy server
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14048
diff
changeset
|
1938 |
16599
89be7c4db12c
made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
Doug Simon <doug.simon@oracle.com>
parents:
16499
diff
changeset
|
1939 # Check whether the current C1Visualizer installation is the up-to-date |
89be7c4db12c
made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
Doug Simon <doug.simon@oracle.com>
parents:
16499
diff
changeset
|
1940 if exists(executable) and not exists(mx.library('C1VISUALIZER_DIST').get_path(resolve=False)): |
89be7c4db12c
made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
Doug Simon <doug.simon@oracle.com>
parents:
16499
diff
changeset
|
1941 mx.log('Updating C1Visualizer') |
89be7c4db12c
made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
Doug Simon <doug.simon@oracle.com>
parents:
16499
diff
changeset
|
1942 shutil.rmtree(join(libpath, 'c1visualizer')) |
89be7c4db12c
made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
Doug Simon <doug.simon@oracle.com>
parents:
16499
diff
changeset
|
1943 |
89be7c4db12c
made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
Doug Simon <doug.simon@oracle.com>
parents:
16499
diff
changeset
|
1944 archive = mx.library('C1VISUALIZER_DIST').get_path(resolve=True) |
89be7c4db12c
made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
Doug Simon <doug.simon@oracle.com>
parents:
16499
diff
changeset
|
1945 |
89be7c4db12c
made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
Doug Simon <doug.simon@oracle.com>
parents:
16499
diff
changeset
|
1946 if not exists(executable): |
14116
be7ebdf41bea
mx: new command to start c1visualizer; support for IGV download when using a proxy server
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14048
diff
changeset
|
1947 zf = zipfile.ZipFile(archive, 'r') |
be7ebdf41bea
mx: new command to start c1visualizer; support for IGV download when using a proxy server
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14048
diff
changeset
|
1948 zf.extractall(libpath) |
be7ebdf41bea
mx: new command to start c1visualizer; support for IGV download when using a proxy server
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14048
diff
changeset
|
1949 |
be7ebdf41bea
mx: new command to start c1visualizer; support for IGV download when using a proxy server
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14048
diff
changeset
|
1950 if not exists(executable): |
be7ebdf41bea
mx: new command to start c1visualizer; support for IGV download when using a proxy server
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14048
diff
changeset
|
1951 mx.abort('C1Visualizer binary does not exist: ' + executable) |
be7ebdf41bea
mx: new command to start c1visualizer; support for IGV download when using a proxy server
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14048
diff
changeset
|
1952 |
be7ebdf41bea
mx: new command to start c1visualizer; support for IGV download when using a proxy server
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14048
diff
changeset
|
1953 if mx.get_os() != 'windows': |
be7ebdf41bea
mx: new command to start c1visualizer; support for IGV download when using a proxy server
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14048
diff
changeset
|
1954 # Make sure that execution is allowed. The zip file does not always specfiy that correctly |
be7ebdf41bea
mx: new command to start c1visualizer; support for IGV download when using a proxy server
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14048
diff
changeset
|
1955 os.chmod(executable, 0777) |
be7ebdf41bea
mx: new command to start c1visualizer; support for IGV download when using a proxy server
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14048
diff
changeset
|
1956 |
be7ebdf41bea
mx: new command to start c1visualizer; support for IGV download when using a proxy server
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14048
diff
changeset
|
1957 mx.run([executable]) |
5089
206e68bb66c6
Made the IdealGraphVisualizer runnable from mx with new 'igv' command.
Doug Simon <doug.simon@oracle.com>
parents:
5064
diff
changeset
|
1958 |
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
|
1959 def bench(args): |
4324
b0aa4a52b89c
Added support for project specs in classpath.
Doug Simon <doug.simon@oracle.com>
parents:
4294
diff
changeset
|
1960 """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
|
1961 |
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
|
1962 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
|
1963 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
|
1964 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
|
1965 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
|
1966 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
|
1967 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
|
1968 del args[index] |
d4906ea4255b
Handle SIGTERM : killing mx will properly kill subprocesses
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4288
diff
changeset
|
1969 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
|
1970 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
|
1971 mx.abort('-resultfile must be followed by a file name') |
11296
4e943a311d9c
mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents:
11287
diff
changeset
|
1972 vm = _get_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
|
1973 if len(args) is 0: |
7563
3aab15f42934
moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents:
7552
diff
changeset
|
1974 args = ['all'] |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
1975 |
8459
3393f870e6a4
Allow vm arguments in mx bench
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8440
diff
changeset
|
1976 vmArgs = [arg for arg in args if arg.startswith('-')] |
7563
3aab15f42934
moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents:
7552
diff
changeset
|
1977 |
3aab15f42934
moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents:
7552
diff
changeset
|
1978 def benchmarks_in_group(group): |
3aab15f42934
moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents:
7552
diff
changeset
|
1979 prefix = group + ':' |
3aab15f42934
moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents:
7552
diff
changeset
|
1980 return [a[len(prefix):] for a in args if a.startswith(prefix)] |
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
|
1981 |
4219
47f7d91d34cf
Fix javac build issues with classpath
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4216
diff
changeset
|
1982 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
|
1983 benchmarks = [] |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
1984 # DaCapo |
13967
4cd7c6629841
mx_graal: fix pylint 1.1.0 warnings
Bernhard Urban <bernhard.urban@jku.at>
parents:
13952
diff
changeset
|
1985 if 'dacapo' in args or 'all' in args: |
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
|
1986 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
|
1987 else: |
7563
3aab15f42934
moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents:
7552
diff
changeset
|
1988 dacapos = benchmarks_in_group('dacapo') |
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
|
1989 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
|
1990 if dacapo not in sanitycheck.dacapoSanityWarmup.keys(): |
7563
3aab15f42934
moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents:
7552
diff
changeset
|
1991 mx.abort('Unknown DaCapo : ' + dacapo) |
8891
ca82d06ec93a
mx: bench command should not run dacapos with -n 0 when using a specification such as scaladacapo:specs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8890
diff
changeset
|
1992 iterations = sanitycheck.dacapoSanityWarmup[dacapo][sanitycheck.SanityCheckLevel.Benchmark] |
13967
4cd7c6629841
mx_graal: fix pylint 1.1.0 warnings
Bernhard Urban <bernhard.urban@jku.at>
parents:
13952
diff
changeset
|
1993 if iterations > 0: |
8891
ca82d06ec93a
mx: bench command should not run dacapos with -n 0 when using a specification such as scaladacapo:specs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8890
diff
changeset
|
1994 benchmarks += [sanitycheck.getDacapo(dacapo, iterations)] |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
1995 |
13967
4cd7c6629841
mx_graal: fix pylint 1.1.0 warnings
Bernhard Urban <bernhard.urban@jku.at>
parents:
13952
diff
changeset
|
1996 if 'scaladacapo' in args or 'all' in args: |
4480
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
1997 benchmarks += sanitycheck.getScalaDacapos(level=sanitycheck.SanityCheckLevel.Benchmark) |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
1998 else: |
7563
3aab15f42934
moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents:
7552
diff
changeset
|
1999 scaladacapos = benchmarks_in_group('scaladacapo') |
3aab15f42934
moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents:
7552
diff
changeset
|
2000 for scaladacapo in scaladacapos: |
3aab15f42934
moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents:
7552
diff
changeset
|
2001 if scaladacapo not in sanitycheck.dacapoScalaSanityWarmup.keys(): |
3aab15f42934
moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents:
7552
diff
changeset
|
2002 mx.abort('Unknown Scala DaCapo : ' + scaladacapo) |
8891
ca82d06ec93a
mx: bench command should not run dacapos with -n 0 when using a specification such as scaladacapo:specs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8890
diff
changeset
|
2003 iterations = sanitycheck.dacapoScalaSanityWarmup[scaladacapo][sanitycheck.SanityCheckLevel.Benchmark] |
13967
4cd7c6629841
mx_graal: fix pylint 1.1.0 warnings
Bernhard Urban <bernhard.urban@jku.at>
parents:
13952
diff
changeset
|
2004 if iterations > 0: |
11367
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
2005 benchmarks += [sanitycheck.getScalaDacapo(scaladacapo, ['-n', str(iterations)])] |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
2006 |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
2007 # Bootstrap |
13967
4cd7c6629841
mx_graal: fix pylint 1.1.0 warnings
Bernhard Urban <bernhard.urban@jku.at>
parents:
13952
diff
changeset
|
2008 if 'bootstrap' in args or 'all' in args: |
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
|
2009 benchmarks += sanitycheck.getBootstraps() |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
2010 # SPECjvm2008 |
13967
4cd7c6629841
mx_graal: fix pylint 1.1.0 warnings
Bernhard Urban <bernhard.urban@jku.at>
parents:
13952
diff
changeset
|
2011 if 'specjvm2008' in args or 'all' in args: |
11373
6675167d52b6
fixed specjvm2008 regression in bench command
Doug Simon <doug.simon@oracle.com>
parents:
11372
diff
changeset
|
2012 benchmarks += [sanitycheck.getSPECjvm2008(['-ikv', '-wt', '120', '-it', '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
|
2013 else: |
7563
3aab15f42934
moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents:
7552
diff
changeset
|
2014 specjvms = benchmarks_in_group('specjvm2008') |
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
|
2015 for specjvm in specjvms: |
11373
6675167d52b6
fixed specjvm2008 regression in bench command
Doug Simon <doug.simon@oracle.com>
parents:
11372
diff
changeset
|
2016 benchmarks += [sanitycheck.getSPECjvm2008(['-ikv', '-wt', '120', '-it', '120', specjvm])] |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
2017 |
13967
4cd7c6629841
mx_graal: fix pylint 1.1.0 warnings
Bernhard Urban <bernhard.urban@jku.at>
parents:
13952
diff
changeset
|
2018 if 'specjbb2005' in args or 'all' in args: |
5877
0e54d9bb922d
Add SPECjbb2005 to the benchmarks
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5875
diff
changeset
|
2019 benchmarks += [sanitycheck.getSPECjbb2005()] |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
2020 |
13967
4cd7c6629841
mx_graal: fix pylint 1.1.0 warnings
Bernhard Urban <bernhard.urban@jku.at>
parents:
13952
diff
changeset
|
2021 if 'specjbb2013' in args: # or 'all' in args //currently not in default set |
7565 | 2022 benchmarks += [sanitycheck.getSPECjbb2013()] |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
2023 |
13967
4cd7c6629841
mx_graal: fix pylint 1.1.0 warnings
Bernhard Urban <bernhard.urban@jku.at>
parents:
13952
diff
changeset
|
2024 if 'ctw-full' in args: |
9157
a38d748d4130
Add support for the 'optimized' build in mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9130
diff
changeset
|
2025 benchmarks.append(sanitycheck.getCTW(vm, sanitycheck.CTWMode.Full)) |
13967
4cd7c6629841
mx_graal: fix pylint 1.1.0 warnings
Bernhard Urban <bernhard.urban@jku.at>
parents:
13952
diff
changeset
|
2026 if 'ctw-noinline' in args: |
9157
a38d748d4130
Add support for the 'optimized' build in mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9130
diff
changeset
|
2027 benchmarks.append(sanitycheck.getCTW(vm, sanitycheck.CTWMode.NoInline)) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
2028 |
4219
47f7d91d34cf
Fix javac build issues with classpath
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4216
diff
changeset
|
2029 for test in benchmarks: |
11367
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
2030 for (groupName, res) in test.bench(vm, extraVmOpts=vmArgs).items(): |
7563
3aab15f42934
moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents:
7552
diff
changeset
|
2031 group = results.setdefault(groupName, {}) |
3aab15f42934
moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents:
7552
diff
changeset
|
2032 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
|
2033 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
|
2034 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
|
2035 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
|
2036 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
|
2037 |
15250
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2038 def _get_jmh_path(): |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2039 path = mx.get_env('JMH_BENCHMARKS', None) |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2040 if not path: |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2041 probe = join(dirname(_graal_home), 'java-benchmarks') |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2042 if exists(probe): |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2043 path = probe |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2044 |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2045 if not path: |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2046 mx.abort("Please set the JMH_BENCHMARKS environment variable to point to the java-benchmarks workspace") |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2047 if not exists(path): |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2048 mx.abort("The directory denoted by the JMH_BENCHMARKS environment variable does not exist: " + path) |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2049 return path |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2050 |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2051 def makejmhdeps(args): |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2052 """creates and installs Maven dependencies required by the JMH benchmarks |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2053 |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2054 The dependencies are specified by files named pom.mxdeps in the |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2055 JMH directory tree. Each such file contains a list of dependencies |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2056 defined in JSON format. For example: |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2057 |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2058 '[{"artifactId" : "compiler.test", "groupId" : "com.oracle.graal", "deps" : ["com.oracle.graal.compiler.test"]}]' |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2059 |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2060 will result in a dependency being installed in the local Maven repository |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2061 that can be referenced in a pom.xml file as follows: |
15178
0c53453c4d5e
mx: improved jmh command to (a) look for JMH benchmarks in ../java-benchmarks, (b) omit building benchmarks if they are up to date and (c) offer better message with 'mx help jmh'
Doug Simon <doug.simon@oracle.com>
parents:
15114
diff
changeset
|
2062 |
15250
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2063 <dependency> |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2064 <groupId>com.oracle.graal</groupId> |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2065 <artifactId>compiler.test</artifactId> |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2066 <version>1.0-SNAPSHOT</version> |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2067 </dependency>""" |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2068 |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2069 parser = ArgumentParser(prog='mx makejmhdeps') |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2070 parser.add_argument('-s', '--settings', help='alternative path for Maven user settings file', metavar='<path>') |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2071 parser.add_argument('-p', '--permissive', action='store_true', help='issue note instead of error if a Maven dependency cannot be built due to missing projects/libraries') |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2072 args = parser.parse_args(args) |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2073 |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2074 def makejmhdep(artifactId, groupId, deps): |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2075 graalSuite = mx.suite("graal") |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2076 path = artifactId + '.jar' |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2077 if args.permissive: |
17356
115de469a26b
support distributions in pom.mxdeps files
Doug Simon <doug.simon@oracle.com>
parents:
17321
diff
changeset
|
2078 allDeps = [] |
15250
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2079 for name in deps: |
17356
115de469a26b
support distributions in pom.mxdeps files
Doug Simon <doug.simon@oracle.com>
parents:
17321
diff
changeset
|
2080 dist = mx.distribution(name, fatalIfMissing=False) |
115de469a26b
support distributions in pom.mxdeps files
Doug Simon <doug.simon@oracle.com>
parents:
17321
diff
changeset
|
2081 if dist: |
115de469a26b
support distributions in pom.mxdeps files
Doug Simon <doug.simon@oracle.com>
parents:
17321
diff
changeset
|
2082 allDeps = allDeps + [d.name for d in dist.sorted_deps(transitive=True)] |
115de469a26b
support distributions in pom.mxdeps files
Doug Simon <doug.simon@oracle.com>
parents:
17321
diff
changeset
|
2083 else: |
115de469a26b
support distributions in pom.mxdeps files
Doug Simon <doug.simon@oracle.com>
parents:
17321
diff
changeset
|
2084 if not mx.project(name, fatalIfMissing=False): |
115de469a26b
support distributions in pom.mxdeps files
Doug Simon <doug.simon@oracle.com>
parents:
17321
diff
changeset
|
2085 if not mx.library(name, fatalIfMissing=False): |
115de469a26b
support distributions in pom.mxdeps files
Doug Simon <doug.simon@oracle.com>
parents:
17321
diff
changeset
|
2086 mx.log('Skipping dependency ' + groupId + '.' + artifactId + ' as ' + name + ' cannot be resolved') |
115de469a26b
support distributions in pom.mxdeps files
Doug Simon <doug.simon@oracle.com>
parents:
17321
diff
changeset
|
2087 return |
115de469a26b
support distributions in pom.mxdeps files
Doug Simon <doug.simon@oracle.com>
parents:
17321
diff
changeset
|
2088 allDeps.append(name) |
115de469a26b
support distributions in pom.mxdeps files
Doug Simon <doug.simon@oracle.com>
parents:
17321
diff
changeset
|
2089 d = mx.Distribution(graalSuite, name=artifactId, path=path, sourcesPath=path, deps=allDeps, mainClass=None, excludedDependencies=[], distDependencies=[], javaCompliance=None) |
15250
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2090 d.make_archive() |
15253
9ff9f6643986
mx: unconditionally ensure mx injected dependencies are up to date in buildjmh command
Doug Simon <doug.simon@oracle.com>
parents:
15250
diff
changeset
|
2091 cmd = ['mvn', 'install:install-file', '-DgroupId=' + groupId, '-DartifactId=' + artifactId, |
15250
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2092 '-Dversion=1.0-SNAPSHOT', '-Dpackaging=jar', '-Dfile=' + d.path] |
15253
9ff9f6643986
mx: unconditionally ensure mx injected dependencies are up to date in buildjmh command
Doug Simon <doug.simon@oracle.com>
parents:
15250
diff
changeset
|
2093 if not mx._opts.verbose: |
9ff9f6643986
mx: unconditionally ensure mx injected dependencies are up to date in buildjmh command
Doug Simon <doug.simon@oracle.com>
parents:
15250
diff
changeset
|
2094 cmd.append('-q') |
15250
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2095 if args.settings: |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2096 cmd = cmd + ['-s', args.settings] |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2097 mx.run(cmd) |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2098 os.unlink(d.path) |
15178
0c53453c4d5e
mx: improved jmh command to (a) look for JMH benchmarks in ../java-benchmarks, (b) omit building benchmarks if they are up to date and (c) offer better message with 'mx help jmh'
Doug Simon <doug.simon@oracle.com>
parents:
15114
diff
changeset
|
2099 |
15250
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2100 jmhPath = _get_jmh_path() |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2101 for root, _, filenames in os.walk(jmhPath): |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2102 for f in [join(root, n) for n in filenames if n == 'pom.mxdeps']: |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2103 mx.logv('[processing ' + f + ']') |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2104 try: |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2105 with open(f) as fp: |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2106 for d in json.load(fp): |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2107 artifactId = d['artifactId'] |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2108 groupId = d['groupId'] |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2109 deps = d['deps'] |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2110 makejmhdep(artifactId, groupId, deps) |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2111 except ValueError as e: |
18635
a8b46348b79f
mx: converted format strings to be python 2.6 compliant
Doug Simon <doug.simon@oracle.com>
parents:
18613
diff
changeset
|
2112 mx.abort('Error parsing {0}:\n{1}'.format(f, e)) |
15250
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2113 |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2114 def buildjmh(args): |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2115 """build the JMH benchmarks""" |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2116 |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2117 parser = ArgumentParser(prog='mx buildjmh') |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2118 parser.add_argument('-s', '--settings', help='alternative path for Maven user settings file', metavar='<path>') |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2119 parser.add_argument('-c', action='store_true', dest='clean', help='clean before building') |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2120 args = parser.parse_args(args) |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2121 |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2122 jmhPath = _get_jmh_path() |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2123 mx.log('JMH benchmarks: ' + jmhPath) |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2124 |
15253
9ff9f6643986
mx: unconditionally ensure mx injected dependencies are up to date in buildjmh command
Doug Simon <doug.simon@oracle.com>
parents:
15250
diff
changeset
|
2125 # Ensure the mx injected dependencies are up to date |
9ff9f6643986
mx: unconditionally ensure mx injected dependencies are up to date in buildjmh command
Doug Simon <doug.simon@oracle.com>
parents:
15250
diff
changeset
|
2126 makejmhdeps(['-p'] + (['-s', args.settings] if args.settings else [])) |
9ff9f6643986
mx: unconditionally ensure mx injected dependencies are up to date in buildjmh command
Doug Simon <doug.simon@oracle.com>
parents:
15250
diff
changeset
|
2127 |
15250
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2128 timestamp = mx.TimeStampFile(join(_graal_home, 'mx', 'jmh', jmhPath.replace(os.sep, '_') + '.timestamp')) |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2129 mustBuild = args.clean |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2130 if not mustBuild: |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2131 try: |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2132 hgfiles = [join(jmhPath, f) for f in subprocess.check_output(['hg', '-R', jmhPath, 'locate']).split('\n')] |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2133 mustBuild = timestamp.isOlderThan(hgfiles) |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2134 except: |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2135 # not a Mercurial repository or hg commands are not available. |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2136 mustBuild = True |
15178
0c53453c4d5e
mx: improved jmh command to (a) look for JMH benchmarks in ../java-benchmarks, (b) omit building benchmarks if they are up to date and (c) offer better message with 'mx help jmh'
Doug Simon <doug.simon@oracle.com>
parents:
15114
diff
changeset
|
2137 |
15250
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2138 if mustBuild: |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2139 buildOutput = [] |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2140 def _redirect(x): |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2141 if mx._opts.verbose: |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2142 mx.log(x[:-1]) |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2143 else: |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2144 buildOutput.append(x) |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2145 env = os.environ.copy() |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2146 env['JAVA_HOME'] = _jdk(vmToCheck='server') |
17321
95b879bdce67
mx: added -XX:-UseGraalClassLoader to JMH executions
Doug Simon <doug.simon@oracle.com>
parents:
17320
diff
changeset
|
2147 env['MAVEN_OPTS'] = '-server -XX:-UseGraalClassLoader' |
15250
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2148 mx.log("Building benchmarks...") |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2149 cmd = ['mvn'] |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2150 if args.settings: |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2151 cmd = cmd + ['-s', args.settings] |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2152 if args.clean: |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2153 cmd.append('clean') |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2154 cmd.append('package') |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2155 retcode = mx.run(cmd, cwd=jmhPath, out=_redirect, env=env, nonZeroIsFatal=False) |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2156 if retcode != 0: |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2157 mx.log(''.join(buildOutput)) |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2158 mx.abort(retcode) |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2159 timestamp.touch() |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2160 else: |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2161 mx.logv('[all Mercurial controlled files in ' + jmhPath + ' are older than ' + timestamp.path + ' - skipping build]') |
13935
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
2162 |
15250
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2163 def jmh(args): |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2164 """run the JMH benchmarks |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2165 |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2166 This command respects the standard --vm and --vmbuild options |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2167 for choosing which VM to run the benchmarks with.""" |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2168 if '-h' in args: |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2169 mx.help_(['jmh']) |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2170 mx.abort(1) |
15021
9dcd5407a603
added support for overriding/complementing JMH arguments in jmh command with a JSON string
Doug Simon <doug.simon@oracle.com>
parents:
15014
diff
changeset
|
2171 |
9dcd5407a603
added support for overriding/complementing JMH arguments in jmh command with a JSON string
Doug Simon <doug.simon@oracle.com>
parents:
15014
diff
changeset
|
2172 vmArgs, benchmarksAndJsons = _extract_VM_args(args) |
18799
750db34c9fe1
client-nograal is supported on Mac
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18733
diff
changeset
|
2173 if isGraalEnabled(_get_vm()) and '-XX:-UseGraalClassLoader' not in vmArgs: |
17321
95b879bdce67
mx: added -XX:-UseGraalClassLoader to JMH executions
Doug Simon <doug.simon@oracle.com>
parents:
17320
diff
changeset
|
2174 vmArgs = ['-XX:-UseGraalClassLoader'] + vmArgs |
15021
9dcd5407a603
added support for overriding/complementing JMH arguments in jmh command with a JSON string
Doug Simon <doug.simon@oracle.com>
parents:
15014
diff
changeset
|
2175 |
9dcd5407a603
added support for overriding/complementing JMH arguments in jmh command with a JSON string
Doug Simon <doug.simon@oracle.com>
parents:
15014
diff
changeset
|
2176 benchmarks = [b for b in benchmarksAndJsons if not b.startswith('{')] |
9dcd5407a603
added support for overriding/complementing JMH arguments in jmh command with a JSON string
Doug Simon <doug.simon@oracle.com>
parents:
15014
diff
changeset
|
2177 jmhArgJsons = [b for b in benchmarksAndJsons if b.startswith('{')] |
15593
e381346a8223
JMH: do not abort on missing jar file. Create necessary output directory if needed
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15580
diff
changeset
|
2178 jmhOutDir = join(_graal_home, 'mx', 'jmh') |
e381346a8223
JMH: do not abort on missing jar file. Create necessary output directory if needed
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15580
diff
changeset
|
2179 if not exists(jmhOutDir): |
e381346a8223
JMH: do not abort on missing jar file. Create necessary output directory if needed
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15580
diff
changeset
|
2180 os.makedirs(jmhOutDir) |
e381346a8223
JMH: do not abort on missing jar file. Create necessary output directory if needed
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15580
diff
changeset
|
2181 jmhOut = join(jmhOutDir, 'jmh.out') |
e381346a8223
JMH: do not abort on missing jar file. Create necessary output directory if needed
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15580
diff
changeset
|
2182 jmhArgs = {'-rff' : jmhOut, '-v' : 'EXTRA' if mx._opts.verbose else 'NORMAL'} |
15021
9dcd5407a603
added support for overriding/complementing JMH arguments in jmh command with a JSON string
Doug Simon <doug.simon@oracle.com>
parents:
15014
diff
changeset
|
2183 |
9dcd5407a603
added support for overriding/complementing JMH arguments in jmh command with a JSON string
Doug Simon <doug.simon@oracle.com>
parents:
15014
diff
changeset
|
2184 # e.g. '{"-wi" : 20}' |
9dcd5407a603
added support for overriding/complementing JMH arguments in jmh command with a JSON string
Doug Simon <doug.simon@oracle.com>
parents:
15014
diff
changeset
|
2185 for j in jmhArgJsons: |
9dcd5407a603
added support for overriding/complementing JMH arguments in jmh command with a JSON string
Doug Simon <doug.simon@oracle.com>
parents:
15014
diff
changeset
|
2186 try: |
15051
2df054b37edc
add support for removing default JMH args (e.g., '{"-wi" : null, "-i" : null}')
Doug Simon <doug.simon@oracle.com>
parents:
15048
diff
changeset
|
2187 for n, v in json.loads(j).iteritems(): |
2df054b37edc
add support for removing default JMH args (e.g., '{"-wi" : null, "-i" : null}')
Doug Simon <doug.simon@oracle.com>
parents:
15048
diff
changeset
|
2188 if v is None: |
2df054b37edc
add support for removing default JMH args (e.g., '{"-wi" : null, "-i" : null}')
Doug Simon <doug.simon@oracle.com>
parents:
15048
diff
changeset
|
2189 del jmhArgs[n] |
2df054b37edc
add support for removing default JMH args (e.g., '{"-wi" : null, "-i" : null}')
Doug Simon <doug.simon@oracle.com>
parents:
15048
diff
changeset
|
2190 else: |
2df054b37edc
add support for removing default JMH args (e.g., '{"-wi" : null, "-i" : null}')
Doug Simon <doug.simon@oracle.com>
parents:
15048
diff
changeset
|
2191 jmhArgs[n] = v |
15021
9dcd5407a603
added support for overriding/complementing JMH arguments in jmh command with a JSON string
Doug Simon <doug.simon@oracle.com>
parents:
15014
diff
changeset
|
2192 except ValueError as e: |
18635
a8b46348b79f
mx: converted format strings to be python 2.6 compliant
Doug Simon <doug.simon@oracle.com>
parents:
18613
diff
changeset
|
2193 mx.abort('error parsing JSON input: {0}\n{1}'.format(j, e)) |
14965
c64cd1dd4bd1
moved Maven installation of Graal dependency from build to jmh command
Doug Simon <doug.simon@oracle.com>
parents:
14938
diff
changeset
|
2194 |
15250
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2195 jmhPath = _get_jmh_path() |
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2196 mx.log('Using benchmarks in ' + jmhPath) |
13935
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
2197 |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
2198 matchedSuites = set() |
13949
f694daada5bf
mx jmh: display the number of benchmarks that will run
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13948
diff
changeset
|
2199 numBench = [0] |
13935
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
2200 for micros in os.listdir(jmhPath): |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
2201 absoluteMicro = os.path.join(jmhPath, micros) |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
2202 if not os.path.isdir(absoluteMicro): |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
2203 continue |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
2204 if not micros.startswith("micros-"): |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
2205 mx.logv('JMH: ignored ' + absoluteMicro + " because it doesn't start with 'micros-'") |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
2206 continue |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
2207 |
13948
69928d77bc0a
mx jmh: avoid mx crash if JMH_BENCHMARKS is not defined at all and skip suites that do not contain the correct jar
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13935
diff
changeset
|
2208 microJar = os.path.join(absoluteMicro, "target", "microbenchmarks.jar") |
69928d77bc0a
mx jmh: avoid mx crash if JMH_BENCHMARKS is not defined at all and skip suites that do not contain the correct jar
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13935
diff
changeset
|
2209 if not exists(microJar): |
15593
e381346a8223
JMH: do not abort on missing jar file. Create necessary output directory if needed
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15580
diff
changeset
|
2210 mx.log('Missing ' + microJar + ' - please run "mx buildjmh"') |
e381346a8223
JMH: do not abort on missing jar file. Create necessary output directory if needed
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15580
diff
changeset
|
2211 continue |
13935
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
2212 if benchmarks: |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
2213 def _addBenchmark(x): |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
2214 if x.startswith("Benchmark:"): |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
2215 return |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
2216 match = False |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
2217 for b in benchmarks: |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
2218 match = match or (b in x) |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
2219 |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
2220 if match: |
13949
f694daada5bf
mx jmh: display the number of benchmarks that will run
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13948
diff
changeset
|
2221 numBench[0] += 1 |
13935
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
2222 matchedSuites.add(micros) |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
2223 |
13967
4cd7c6629841
mx_graal: fix pylint 1.1.0 warnings
Bernhard Urban <bernhard.urban@jku.at>
parents:
13952
diff
changeset
|
2224 mx.run_java(['-jar', microJar, "-l"], cwd=jmhPath, out=_addBenchmark, addDefaultArgs=False) |
13935
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
2225 else: |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
2226 matchedSuites.add(micros) |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
2227 |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
2228 mx.logv("matchedSuites: " + str(matchedSuites)) |
13949
f694daada5bf
mx jmh: display the number of benchmarks that will run
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13948
diff
changeset
|
2229 plural = 's' if not benchmarks or numBench[0] > 1 else '' |
f694daada5bf
mx jmh: display the number of benchmarks that will run
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13948
diff
changeset
|
2230 number = str(numBench[0]) if benchmarks else "all" |
f694daada5bf
mx jmh: display the number of benchmarks that will run
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13948
diff
changeset
|
2231 mx.log("Running " + number + " benchmark" + plural + '...') |
13935
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
2232 |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
2233 regex = [] |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
2234 if benchmarks: |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
2235 regex.append(r".*(" + "|".join(benchmarks) + ").*") |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
2236 |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
2237 for suite in matchedSuites: |
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
2238 absoluteMicro = os.path.join(jmhPath, suite) |
13951
392b6ac8da36
Allow using run_java without the arguments from -J -Ja -Jp. Factor out the argument processing of mx_graal.vm and use it to pass tested-vm args down through the jmh harness
Bernhard Urban <bernhard.urban@jku.at>
parents:
13949
diff
changeset
|
2239 (pfx, exe, vm, forkedVmArgs, _) = _parseVmArgs(vmArgs) |
392b6ac8da36
Allow using run_java without the arguments from -J -Ja -Jp. Factor out the argument processing of mx_graal.vm and use it to pass tested-vm args down through the jmh harness
Bernhard Urban <bernhard.urban@jku.at>
parents:
13949
diff
changeset
|
2240 if pfx: |
18306 | 2241 mx.log("JMH ignores prefix: \"" + ' '.join(pfx) + "\"") |
15021
9dcd5407a603
added support for overriding/complementing JMH arguments in jmh command with a JSON string
Doug Simon <doug.simon@oracle.com>
parents:
15014
diff
changeset
|
2242 javaArgs = ['-jar', os.path.join(absoluteMicro, "target", "microbenchmarks.jar"), |
9dcd5407a603
added support for overriding/complementing JMH arguments in jmh command with a JSON string
Doug Simon <doug.simon@oracle.com>
parents:
15014
diff
changeset
|
2243 '--jvm', exe, |
9dcd5407a603
added support for overriding/complementing JMH arguments in jmh command with a JSON string
Doug Simon <doug.simon@oracle.com>
parents:
15014
diff
changeset
|
2244 '--jvmArgs', ' '.join(["-" + vm] + forkedVmArgs)] |
9dcd5407a603
added support for overriding/complementing JMH arguments in jmh command with a JSON string
Doug Simon <doug.simon@oracle.com>
parents:
15014
diff
changeset
|
2245 for k, v in jmhArgs.iteritems(): |
9dcd5407a603
added support for overriding/complementing JMH arguments in jmh command with a JSON string
Doug Simon <doug.simon@oracle.com>
parents:
15014
diff
changeset
|
2246 javaArgs.append(k) |
15051
2df054b37edc
add support for removing default JMH args (e.g., '{"-wi" : null, "-i" : null}')
Doug Simon <doug.simon@oracle.com>
parents:
15048
diff
changeset
|
2247 if len(str(v)): |
2df054b37edc
add support for removing default JMH args (e.g., '{"-wi" : null, "-i" : null}')
Doug Simon <doug.simon@oracle.com>
parents:
15048
diff
changeset
|
2248 javaArgs.append(str(v)) |
15021
9dcd5407a603
added support for overriding/complementing JMH arguments in jmh command with a JSON string
Doug Simon <doug.simon@oracle.com>
parents:
15014
diff
changeset
|
2249 mx.run_java(javaArgs + regex, addDefaultArgs=False, cwd=jmhPath) |
13935
ca0e1af320f6
mx: add support for jmh benchmark suites
Bernhard Urban <bernhard.urban@jku.at>
parents:
13928
diff
changeset
|
2250 |
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
|
2251 def specjvm2008(args): |
11367
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
2252 """run one or more SPECjvm2008 benchmarks""" |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
2253 |
11367
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
2254 def launcher(bm, harnessArgs, extraVmOpts): |
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
2255 return sanitycheck.getSPECjvm2008(harnessArgs + [bm]).bench(_get_vm(), extraVmOpts=extraVmOpts) |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
2256 |
11372
76c45fb64191
added support to the specjvm2008 command for specifying a benchmark group
Doug Simon <doug.simon@oracle.com>
parents:
11371
diff
changeset
|
2257 availableBenchmarks = set(sanitycheck.specjvm2008Names) |
76c45fb64191
added support to the specjvm2008 command for specifying a benchmark group
Doug Simon <doug.simon@oracle.com>
parents:
11371
diff
changeset
|
2258 for name in sanitycheck.specjvm2008Names: |
76c45fb64191
added support to the specjvm2008 command for specifying a benchmark group
Doug Simon <doug.simon@oracle.com>
parents:
11371
diff
changeset
|
2259 parts = name.rsplit('.', 1) |
76c45fb64191
added support to the specjvm2008 command for specifying a benchmark group
Doug Simon <doug.simon@oracle.com>
parents:
11371
diff
changeset
|
2260 if len(parts) > 1: |
76c45fb64191
added support to the specjvm2008 command for specifying a benchmark group
Doug Simon <doug.simon@oracle.com>
parents:
11371
diff
changeset
|
2261 assert len(parts) == 2 |
76c45fb64191
added support to the specjvm2008 command for specifying a benchmark group
Doug Simon <doug.simon@oracle.com>
parents:
11371
diff
changeset
|
2262 group = parts[0] |
76c45fb64191
added support to the specjvm2008 command for specifying a benchmark group
Doug Simon <doug.simon@oracle.com>
parents:
11371
diff
changeset
|
2263 availableBenchmarks.add(group) |
76c45fb64191
added support to the specjvm2008 command for specifying a benchmark group
Doug Simon <doug.simon@oracle.com>
parents:
11371
diff
changeset
|
2264 |
76c45fb64191
added support to the specjvm2008 command for specifying a benchmark group
Doug Simon <doug.simon@oracle.com>
parents:
11371
diff
changeset
|
2265 _run_benchmark(args, sorted(availableBenchmarks), launcher) |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
2266 |
8147
9786ac8fff61
Use different vm args for SPECjbb2013
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8135
diff
changeset
|
2267 def specjbb2013(args): |
16782
9f5e33cf8d52
Factored out the '_copyToJdk' function and allow copying files to jre/lib/ext.
Danilo Ansaloni <danilo.ansaloni@oracle.com>
parents:
16729
diff
changeset
|
2268 """run the composite SPECjbb2013 benchmark""" |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
2269 |
11367
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
2270 def launcher(bm, harnessArgs, extraVmOpts): |
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
2271 assert bm is None |
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
2272 return sanitycheck.getSPECjbb2013(harnessArgs).bench(_get_vm(), extraVmOpts=extraVmOpts) |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
2273 |
11367
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
2274 _run_benchmark(args, None, launcher) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
2275 |
8506
c3657d00e343
-Merge with tip
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8406
diff
changeset
|
2276 def specjbb2005(args): |
16782
9f5e33cf8d52
Factored out the '_copyToJdk' function and allow copying files to jre/lib/ext.
Danilo Ansaloni <danilo.ansaloni@oracle.com>
parents:
16729
diff
changeset
|
2277 """run the composite SPECjbb2005 benchmark""" |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
2278 |
11367
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
2279 def launcher(bm, harnessArgs, extraVmOpts): |
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
2280 assert bm is None |
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
2281 return sanitycheck.getSPECjbb2005(harnessArgs).bench(_get_vm(), extraVmOpts=extraVmOpts) |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
2282 |
11367
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
2283 _run_benchmark(args, None, launcher) |
8506
c3657d00e343
-Merge with tip
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8406
diff
changeset
|
2284 |
5596
e4b1bc5e29e0
hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents:
5517
diff
changeset
|
2285 def hsdis(args, copyToDir=None): |
6291
633136426f26
consolidated jtt command into unittest command and removed need for explicit 'testHarness' property in 'projects' file
Doug Simon <doug.simon@oracle.com>
parents:
6278
diff
changeset
|
2286 """download the hsdis library |
4482
7903b6c28f9c
Add hsdis command to mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4480
diff
changeset
|
2287 |
7903b6c28f9c
Add hsdis command to mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4480
diff
changeset
|
2288 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
|
2289 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
|
2290 flavor = 'intel' |
7903b6c28f9c
Add hsdis command to mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4480
diff
changeset
|
2291 if 'att' in args: |
7903b6c28f9c
Add hsdis command to mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4480
diff
changeset
|
2292 flavor = 'att' |
19691
84b85c43633b
[SPARC] Install hsdis-sparcv9.so into the jvm with mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
19430
diff
changeset
|
2293 if mx.get_arch() == "sparcv9": |
84b85c43633b
[SPARC] Install hsdis-sparcv9.so into the jvm with mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
19430
diff
changeset
|
2294 flavor = "sparcv9" |
17012
ad10671d1bbd
mx: move get_arch() to mxtool
Bernhard Urban <bernhard.urban@jku.at>
parents:
16983
diff
changeset
|
2295 lib = mx.add_lib_suffix('hsdis-' + mx.get_arch()) |
5596
e4b1bc5e29e0
hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents:
5517
diff
changeset
|
2296 path = join(_graal_home, 'lib', lib) |
16599
89be7c4db12c
made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
Doug Simon <doug.simon@oracle.com>
parents:
16499
diff
changeset
|
2297 |
89be7c4db12c
made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
Doug Simon <doug.simon@oracle.com>
parents:
16499
diff
changeset
|
2298 sha1s = { |
89be7c4db12c
made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
Doug Simon <doug.simon@oracle.com>
parents:
16499
diff
changeset
|
2299 'att/hsdis-amd64.dll' : 'bcbd535a9568b5075ab41e96205e26a2bac64f72', |
89be7c4db12c
made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
Doug Simon <doug.simon@oracle.com>
parents:
16499
diff
changeset
|
2300 'att/hsdis-amd64.so' : '58919ba085d4ef7a513f25bae75e7e54ee73c049', |
89be7c4db12c
made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
Doug Simon <doug.simon@oracle.com>
parents:
16499
diff
changeset
|
2301 'intel/hsdis-amd64.dll' : '6a388372cdd5fe905c1a26ced614334e405d1f30', |
89be7c4db12c
made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
Doug Simon <doug.simon@oracle.com>
parents:
16499
diff
changeset
|
2302 'intel/hsdis-amd64.so' : '844ed9ffed64fe9599638f29a8450c50140e3192', |
89be7c4db12c
made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
Doug Simon <doug.simon@oracle.com>
parents:
16499
diff
changeset
|
2303 'intel/hsdis-amd64.dylib' : 'fdb13ef0d7d23d93dacaae9c98837bea0d4fc5a2', |
20989
4213d02d95b5
Update hsdis for SPARC to latest binutils version (VIS3 and OSA2011 architecture included)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
20967
diff
changeset
|
2304 'sparcv9/hsdis-sparcv9.so': '970640a9af0bd63641f9063c11275b371a59ee60', |
16599
89be7c4db12c
made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
Doug Simon <doug.simon@oracle.com>
parents:
16499
diff
changeset
|
2305 } |
89be7c4db12c
made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
Doug Simon <doug.simon@oracle.com>
parents:
16499
diff
changeset
|
2306 |
16976
87fc600ec586
mx: skip downloading hsdis if not available.
Josef Eisl <josef.eisl@jku.at>
parents:
16918
diff
changeset
|
2307 flavoredLib = flavor + "/" + lib |
87fc600ec586
mx: skip downloading hsdis if not available.
Josef Eisl <josef.eisl@jku.at>
parents:
16918
diff
changeset
|
2308 if flavoredLib not in sha1s: |
87fc600ec586
mx: skip downloading hsdis if not available.
Josef Eisl <josef.eisl@jku.at>
parents:
16918
diff
changeset
|
2309 mx.logv("hsdis not supported on this plattform or architecture") |
87fc600ec586
mx: skip downloading hsdis if not available.
Josef Eisl <josef.eisl@jku.at>
parents:
16918
diff
changeset
|
2310 return |
87fc600ec586
mx: skip downloading hsdis if not available.
Josef Eisl <josef.eisl@jku.at>
parents:
16918
diff
changeset
|
2311 |
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
|
2312 if not exists(path): |
16599
89be7c4db12c
made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
Doug Simon <doug.simon@oracle.com>
parents:
16499
diff
changeset
|
2313 sha1 = sha1s[flavoredLib] |
89be7c4db12c
made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
Doug Simon <doug.simon@oracle.com>
parents:
16499
diff
changeset
|
2314 sha1path = path + '.sha1' |
89be7c4db12c
made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
Doug Simon <doug.simon@oracle.com>
parents:
16499
diff
changeset
|
2315 mx.download_file_with_sha1('hsdis', path, ['http://lafo.ssw.uni-linz.ac.at/hsdis/' + flavoredLib], sha1, sha1path, True, True, sources=False) |
5596
e4b1bc5e29e0
hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents:
5517
diff
changeset
|
2316 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
|
2317 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
|
2318 |
5245 | 2319 def hcfdis(args): |
6291
633136426f26
consolidated jtt command into unittest command and removed need for explicit 'testHarness' property in 'projects' file
Doug Simon <doug.simon@oracle.com>
parents:
6278
diff
changeset
|
2320 """disassemble HexCodeFiles embedded in text files |
5245 | 2321 |
2322 Run a tool over the input files to convert all embedded HexCodeFiles | |
2323 to a disassembled format.""" | |
6958
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
2324 |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
2325 parser = ArgumentParser(prog='mx hcfdis') |
6958
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
2326 parser.add_argument('-m', '--map', help='address to symbol map applied to disassembler output') |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
2327 parser.add_argument('files', nargs=REMAINDER, metavar='files...') |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
2328 |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
2329 args = parser.parse_args(args) |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
2330 |
16599
89be7c4db12c
made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
Doug Simon <doug.simon@oracle.com>
parents:
16499
diff
changeset
|
2331 path = mx.library('HCFDIS').get_path(resolve=True) |
89be7c4db12c
made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
Doug Simon <doug.simon@oracle.com>
parents:
16499
diff
changeset
|
2332 mx.run_java(['-cp', path, 'com.oracle.max.hcfdis.HexCodeFileDis'] + args.files) |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
2333 |
6958
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
2334 if args.map is not None: |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
2335 addressRE = re.compile(r'0[xX]([A-Fa-f0-9]+)') |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
2336 with open(args.map) as fp: |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
2337 lines = fp.read().splitlines() |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
2338 symbols = dict() |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
2339 for l in lines: |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
2340 addressAndSymbol = l.split(' ', 1) |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
2341 if len(addressAndSymbol) == 2: |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
2342 address, symbol = addressAndSymbol |
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
2343 if address.startswith('0x'): |
6958
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
2344 address = long(address, 16) |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
2345 symbols[address] = symbol |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
2346 for f in args.files: |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
2347 with open(f) as fp: |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
2348 lines = fp.read().splitlines() |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
2349 updated = False |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
2350 for i in range(0, len(lines)): |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
2351 l = lines[i] |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
2352 for m in addressRE.finditer(l): |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
2353 sval = m.group(0) |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
2354 val = long(sval, 16) |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
2355 sym = symbols.get(val) |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
2356 if sym: |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
2357 l = l.replace(sval, sym) |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
2358 updated = True |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
2359 lines[i] = l |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
2360 if updated: |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
2361 mx.log('updating ' + f) |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
2362 with open('new_' + f, "w") as fp: |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
2363 for l in lines: |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
2364 print >> fp, l |
5245 | 2365 |
4684
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
2366 def jacocoreport(args): |
6291
633136426f26
consolidated jtt command into unittest command and removed need for explicit 'testHarness' property in 'projects' file
Doug Simon <doug.simon@oracle.com>
parents:
6278
diff
changeset
|
2367 """create a JaCoCo coverage report |
4684
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
2368 |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
2369 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
|
2370 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
|
2371 jacocoreport = mx.library("JACOCOREPORT", True) |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
2372 out = 'coverage' |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
2373 if len(args) == 1: |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
2374 out = args[0] |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
2375 elif len(args) > 1: |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
2376 mx.abort('jacocoreport takes only one argument : an output directory') |
18894
31960077ea9d
Specify jacoco project includes/excludes in suite.py
Paul Woegerer <paul.woegerer@oracle.com>
parents:
18893
diff
changeset
|
2377 |
31960077ea9d
Specify jacoco project includes/excludes in suite.py
Paul Woegerer <paul.woegerer@oracle.com>
parents:
18893
diff
changeset
|
2378 includes = ['com.oracle.graal'] |
31960077ea9d
Specify jacoco project includes/excludes in suite.py
Paul Woegerer <paul.woegerer@oracle.com>
parents:
18893
diff
changeset
|
2379 for p in mx.projects(): |
31960077ea9d
Specify jacoco project includes/excludes in suite.py
Paul Woegerer <paul.woegerer@oracle.com>
parents:
18893
diff
changeset
|
2380 projsetting = getattr(p, 'jacoco', '') |
31960077ea9d
Specify jacoco project includes/excludes in suite.py
Paul Woegerer <paul.woegerer@oracle.com>
parents:
18893
diff
changeset
|
2381 if projsetting == 'include': |
31960077ea9d
Specify jacoco project includes/excludes in suite.py
Paul Woegerer <paul.woegerer@oracle.com>
parents:
18893
diff
changeset
|
2382 includes.append(p.name) |
31960077ea9d
Specify jacoco project includes/excludes in suite.py
Paul Woegerer <paul.woegerer@oracle.com>
parents:
18893
diff
changeset
|
2383 |
31960077ea9d
Specify jacoco project includes/excludes in suite.py
Paul Woegerer <paul.woegerer@oracle.com>
parents:
18893
diff
changeset
|
2384 includedirs = set() |
31960077ea9d
Specify jacoco project includes/excludes in suite.py
Paul Woegerer <paul.woegerer@oracle.com>
parents:
18893
diff
changeset
|
2385 for p in mx.projects(): |
19796
c70ef0d09be9
use the 'jacoco=exclude' project property when deciding which directories to include in JaCoCo coverage reports
Doug Simon <doug.simon@oracle.com>
parents:
19779
diff
changeset
|
2386 projsetting = getattr(p, 'jacoco', '') |
c70ef0d09be9
use the 'jacoco=exclude' project property when deciding which directories to include in JaCoCo coverage reports
Doug Simon <doug.simon@oracle.com>
parents:
19779
diff
changeset
|
2387 if projsetting == 'exclude': |
c70ef0d09be9
use the 'jacoco=exclude' project property when deciding which directories to include in JaCoCo coverage reports
Doug Simon <doug.simon@oracle.com>
parents:
19779
diff
changeset
|
2388 continue |
18894
31960077ea9d
Specify jacoco project includes/excludes in suite.py
Paul Woegerer <paul.woegerer@oracle.com>
parents:
18893
diff
changeset
|
2389 for include in includes: |
31960077ea9d
Specify jacoco project includes/excludes in suite.py
Paul Woegerer <paul.woegerer@oracle.com>
parents:
18893
diff
changeset
|
2390 if include in p.dir: |
31960077ea9d
Specify jacoco project includes/excludes in suite.py
Paul Woegerer <paul.woegerer@oracle.com>
parents:
18893
diff
changeset
|
2391 includedirs.add(p.dir) |
31960077ea9d
Specify jacoco project includes/excludes in suite.py
Paul Woegerer <paul.woegerer@oracle.com>
parents:
18893
diff
changeset
|
2392 |
31960077ea9d
Specify jacoco project includes/excludes in suite.py
Paul Woegerer <paul.woegerer@oracle.com>
parents:
18893
diff
changeset
|
2393 for i in includedirs: |
31960077ea9d
Specify jacoco project includes/excludes in suite.py
Paul Woegerer <paul.woegerer@oracle.com>
parents:
18893
diff
changeset
|
2394 bindir = i + '/bin' |
31960077ea9d
Specify jacoco project includes/excludes in suite.py
Paul Woegerer <paul.woegerer@oracle.com>
parents:
18893
diff
changeset
|
2395 if not os.path.exists(bindir): |
31960077ea9d
Specify jacoco project includes/excludes in suite.py
Paul Woegerer <paul.woegerer@oracle.com>
parents:
18893
diff
changeset
|
2396 os.makedirs(bindir) |
31960077ea9d
Specify jacoco project includes/excludes in suite.py
Paul Woegerer <paul.woegerer@oracle.com>
parents:
18893
diff
changeset
|
2397 |
31960077ea9d
Specify jacoco project includes/excludes in suite.py
Paul Woegerer <paul.woegerer@oracle.com>
parents:
18893
diff
changeset
|
2398 mx.run_java(['-jar', jacocoreport.get_path(True), '--in', 'jacoco.exec', '--out', out] + sorted(includedirs)) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
2399 |
11867 | 2400 def sl(args): |
12693
c6b833f7935e
mx sl: change vm args syntax
Andreas Woess <andreas.woess@jku.at>
parents:
12647
diff
changeset
|
2401 """run an SL program""" |
c6b833f7935e
mx sl: change vm args syntax
Andreas Woess <andreas.woess@jku.at>
parents:
12647
diff
changeset
|
2402 vmArgs, slArgs = _extract_VM_args(args) |
16417
9fe3cb463079
mx: classpath function now accepts distributions as well (which are prepend to the class path)
Doug Simon <doug.simon@oracle.com>
parents:
16395
diff
changeset
|
2403 vm(vmArgs + ['-cp', mx.classpath(["TRUFFLE", "com.oracle.truffle.sl"]), "com.oracle.truffle.sl.SLMain"] + slArgs) |
11867 | 2404 |
9803
8e33b4ebfef1
add isGraalEnabled(vm) function in commands.py
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9667
diff
changeset
|
2405 def isGraalEnabled(vm): |
8e33b4ebfef1
add isGraalEnabled(vm) function in commands.py
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9667
diff
changeset
|
2406 return vm != 'original' and not vm.endswith('nograal') |
8e33b4ebfef1
add isGraalEnabled(vm) function in commands.py
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9667
diff
changeset
|
2407 |
16167
1f4955abca9b
mx: add jol command for java object layout introspection
Andreas Woess <andreas.woess@jku.at>
parents:
16117
diff
changeset
|
2408 def jol(args): |
1f4955abca9b
mx: add jol command for java object layout introspection
Andreas Woess <andreas.woess@jku.at>
parents:
16117
diff
changeset
|
2409 """Java Object Layout""" |
16599
89be7c4db12c
made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
Doug Simon <doug.simon@oracle.com>
parents:
16499
diff
changeset
|
2410 joljar = mx.library('JOL_INTERNALS').get_path(resolve=True) |
16167
1f4955abca9b
mx: add jol command for java object layout introspection
Andreas Woess <andreas.woess@jku.at>
parents:
16117
diff
changeset
|
2411 candidates = mx.findclass(args, logToConsole=False, matcher=lambda s, classname: s == classname or classname.endswith('.' + s) or classname.endswith('$' + s)) |
18218
8588db09f5e9
mx jol: let user select from found classes, skip duplicates
Andreas Woess <andreas.woess@jku.at>
parents:
18163
diff
changeset
|
2412 |
8588db09f5e9
mx jol: let user select from found classes, skip duplicates
Andreas Woess <andreas.woess@jku.at>
parents:
18163
diff
changeset
|
2413 if len(candidates) > 0: |
18601
676f1800077c
mx: removed unused _read_projects_file function
Doug Simon <doug.simon@oracle.com>
parents:
18414
diff
changeset
|
2414 candidates = mx.select_items(sorted(candidates)) |
18218
8588db09f5e9
mx jol: let user select from found classes, skip duplicates
Andreas Woess <andreas.woess@jku.at>
parents:
18163
diff
changeset
|
2415 else: |
8588db09f5e9
mx jol: let user select from found classes, skip duplicates
Andreas Woess <andreas.woess@jku.at>
parents:
18163
diff
changeset
|
2416 # mx.findclass can be mistaken, don't give up yet |
8588db09f5e9
mx jol: let user select from found classes, skip duplicates
Andreas Woess <andreas.woess@jku.at>
parents:
18163
diff
changeset
|
2417 candidates = args |
16167
1f4955abca9b
mx: add jol command for java object layout introspection
Andreas Woess <andreas.woess@jku.at>
parents:
16117
diff
changeset
|
2418 |
1f4955abca9b
mx: add jol command for java object layout introspection
Andreas Woess <andreas.woess@jku.at>
parents:
16117
diff
changeset
|
2419 vm(['-javaagent:' + joljar, '-cp', os.pathsep.join([mx.classpath(), joljar]), "org.openjdk.jol.MainObjectInternals"] + candidates) |
1f4955abca9b
mx: add jol command for java object layout introspection
Andreas Woess <andreas.woess@jku.at>
parents:
16117
diff
changeset
|
2420 |
5700
12a34d1bcaa2
added site command to generate a javadoc-based website
Doug Simon <doug.simon@oracle.com>
parents:
5688
diff
changeset
|
2421 def site(args): |
6291
633136426f26
consolidated jtt command into unittest command and removed need for explicit 'testHarness' property in 'projects' file
Doug Simon <doug.simon@oracle.com>
parents:
6278
diff
changeset
|
2422 """create 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
|
2423 |
5771
613a3ddb9a71
moved core site functionality into mx.py
Doug Simon <doug.simon@oracle.com>
parents:
5764
diff
changeset
|
2424 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
|
2425 '--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
|
2426 '--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
|
2427 '--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
|
2428 '--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
|
2429 '--jd', '@-tag', '--jd', '@vmoption:X', |
5771
613a3ddb9a71
moved core site functionality into mx.py
Doug Simon <doug.simon@oracle.com>
parents:
5764
diff
changeset
|
2430 '--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
|
2431 '--title', 'Graal OpenJDK Project Documentation', |
6506
305b9166b455
added projects table to the top level javadoc page generated by the site command
Doug Simon <doug.simon@oracle.com>
parents:
6495
diff
changeset
|
2432 '--dot-output-base', 'projects'] + args) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
2433 |
13507
d3ec6003856d
mx: experimental autocompletion generation for zsh (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13486
diff
changeset
|
2434 def generateZshCompletion(args): |
d3ec6003856d
mx: experimental autocompletion generation for zsh (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13486
diff
changeset
|
2435 """generate zsh completion for mx""" |
d3ec6003856d
mx: experimental autocompletion generation for zsh (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13486
diff
changeset
|
2436 try: |
d3ec6003856d
mx: experimental autocompletion generation for zsh (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13486
diff
changeset
|
2437 from genzshcomp import CompletionGenerator |
d3ec6003856d
mx: experimental autocompletion generation for zsh (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13486
diff
changeset
|
2438 except ImportError: |
d3ec6003856d
mx: experimental autocompletion generation for zsh (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13486
diff
changeset
|
2439 mx.abort("install genzshcomp (pip install genzshcomp)") |
d3ec6003856d
mx: experimental autocompletion generation for zsh (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13486
diff
changeset
|
2440 |
d3ec6003856d
mx: experimental autocompletion generation for zsh (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13486
diff
changeset
|
2441 # need to fake module for the custom mx arg parser, otherwise a check in genzshcomp fails |
d3ec6003856d
mx: experimental autocompletion generation for zsh (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13486
diff
changeset
|
2442 originalModule = mx._argParser.__module__ |
d3ec6003856d
mx: experimental autocompletion generation for zsh (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13486
diff
changeset
|
2443 mx._argParser.__module__ = "argparse" |
d3ec6003856d
mx: experimental autocompletion generation for zsh (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13486
diff
changeset
|
2444 generator = CompletionGenerator("mx", mx._argParser) |
d3ec6003856d
mx: experimental autocompletion generation for zsh (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13486
diff
changeset
|
2445 mx._argParser.__module__ = originalModule |
d3ec6003856d
mx: experimental autocompletion generation for zsh (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13486
diff
changeset
|
2446 |
d3ec6003856d
mx: experimental autocompletion generation for zsh (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13486
diff
changeset
|
2447 # strip last line and define local variable "ret" |
d3ec6003856d
mx: experimental autocompletion generation for zsh (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13486
diff
changeset
|
2448 complt = "\n".join(generator.get().split('\n')[0:-1]).replace('context state line', 'context state line ret=1') |
d3ec6003856d
mx: experimental autocompletion generation for zsh (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13486
diff
changeset
|
2449 |
d3ec6003856d
mx: experimental autocompletion generation for zsh (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13486
diff
changeset
|
2450 # add array of possible subcommands (as they are not part of the argument parser) |
d3ec6003856d
mx: experimental autocompletion generation for zsh (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13486
diff
changeset
|
2451 complt += '\n ": :->command" \\\n' |
13508
8a5b39d0bfb5
mx: add completion support for graal options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13507
diff
changeset
|
2452 complt += ' "*::args:->args" && ret=0\n' |
13507
d3ec6003856d
mx: experimental autocompletion generation for zsh (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13486
diff
changeset
|
2453 complt += '\n' |
d3ec6003856d
mx: experimental autocompletion generation for zsh (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13486
diff
changeset
|
2454 complt += 'case $state in\n' |
13508
8a5b39d0bfb5
mx: add completion support for graal options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13507
diff
changeset
|
2455 complt += '\t(command)\n' |
8a5b39d0bfb5
mx: add completion support for graal options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13507
diff
changeset
|
2456 complt += '\t\tlocal -a main_commands\n' |
8a5b39d0bfb5
mx: add completion support for graal options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13507
diff
changeset
|
2457 complt += '\t\tmain_commands=(\n' |
13507
d3ec6003856d
mx: experimental autocompletion generation for zsh (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13486
diff
changeset
|
2458 for cmd in sorted(mx._commands.iterkeys()): |
d3ec6003856d
mx: experimental autocompletion generation for zsh (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13486
diff
changeset
|
2459 c, _ = mx._commands[cmd][:2] |
d3ec6003856d
mx: experimental autocompletion generation for zsh (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13486
diff
changeset
|
2460 doc = c.__doc__ |
13508
8a5b39d0bfb5
mx: add completion support for graal options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13507
diff
changeset
|
2461 complt += '\t\t\t"{0}'.format(cmd) |
13507
d3ec6003856d
mx: experimental autocompletion generation for zsh (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13486
diff
changeset
|
2462 if doc: |
13509
a8831418ff04
mx: add completion support for hotspot options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13508
diff
changeset
|
2463 complt += ':{0}'.format(_fixQuotes(doc.split('\n', 1)[0])) |
13507
d3ec6003856d
mx: experimental autocompletion generation for zsh (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13486
diff
changeset
|
2464 complt += '"\n' |
13508
8a5b39d0bfb5
mx: add completion support for graal options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13507
diff
changeset
|
2465 complt += '\t\t)\n' |
8a5b39d0bfb5
mx: add completion support for graal options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13507
diff
changeset
|
2466 complt += '\t\t_describe -t main_commands command main_commands && ret=0\n' |
8a5b39d0bfb5
mx: add completion support for graal options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13507
diff
changeset
|
2467 complt += '\t\t;;\n' |
8a5b39d0bfb5
mx: add completion support for graal options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13507
diff
changeset
|
2468 |
8a5b39d0bfb5
mx: add completion support for graal options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13507
diff
changeset
|
2469 complt += '\t(args)\n' |
13509
a8831418ff04
mx: add completion support for hotspot options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13508
diff
changeset
|
2470 # TODO: improve matcher: if mx args are given, this doesn't work |
13508
8a5b39d0bfb5
mx: add completion support for graal options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13507
diff
changeset
|
2471 complt += '\t\tcase $line[1] in\n' |
19182
8cd798884d60
generateZshCompletions should include diagnostic VM options and supoprt completion for more mx commands
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19162
diff
changeset
|
2472 complt += '\t\t\t(vm | vmg | vmfg | unittest | jmh | dacapo | scaladacapo | specjvm2008 | specjbb2013 | specjbb2005)\n' |
13508
8a5b39d0bfb5
mx: add completion support for graal options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13507
diff
changeset
|
2473 complt += '\t\t\t\tnoglob \\\n' |
8a5b39d0bfb5
mx: add completion support for graal options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13507
diff
changeset
|
2474 complt += '\t\t\t\t\t_arguments -s -S \\\n' |
13509
a8831418ff04
mx: add completion support for hotspot options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13508
diff
changeset
|
2475 complt += _appendOptions("graal", r"G\:") |
a8831418ff04
mx: add completion support for hotspot options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13508
diff
changeset
|
2476 # TODO: fix -XX:{-,+}Use* flags |
a8831418ff04
mx: add completion support for hotspot options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13508
diff
changeset
|
2477 complt += _appendOptions("hotspot", r"XX\:") |
13508
8a5b39d0bfb5
mx: add completion support for graal options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13507
diff
changeset
|
2478 complt += '\t\t\t\t\t"-version" && ret=0 \n' |
8a5b39d0bfb5
mx: add completion support for graal options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13507
diff
changeset
|
2479 complt += '\t\t\t\t;;\n' |
8a5b39d0bfb5
mx: add completion support for graal options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13507
diff
changeset
|
2480 complt += '\t\tesac\n' |
8a5b39d0bfb5
mx: add completion support for graal options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13507
diff
changeset
|
2481 complt += '\t\t;;\n' |
13507
d3ec6003856d
mx: experimental autocompletion generation for zsh (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13486
diff
changeset
|
2482 complt += 'esac\n' |
d3ec6003856d
mx: experimental autocompletion generation for zsh (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13486
diff
changeset
|
2483 complt += '\n' |
d3ec6003856d
mx: experimental autocompletion generation for zsh (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13486
diff
changeset
|
2484 complt += 'return $ret' |
d3ec6003856d
mx: experimental autocompletion generation for zsh (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13486
diff
changeset
|
2485 print complt |
d3ec6003856d
mx: experimental autocompletion generation for zsh (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13486
diff
changeset
|
2486 |
13509
a8831418ff04
mx: add completion support for hotspot options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13508
diff
changeset
|
2487 def _fixQuotes(arg): |
a8831418ff04
mx: add completion support for hotspot options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13508
diff
changeset
|
2488 return arg.replace('\"', '').replace('\'', '').replace('`', '').replace('{', '\\{').replace('}', '\\}').replace('[', '\\[').replace(']', '\\]') |
a8831418ff04
mx: add completion support for hotspot options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13508
diff
changeset
|
2489 |
a8831418ff04
mx: add completion support for hotspot options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13508
diff
changeset
|
2490 def _appendOptions(optionType, optionPrefix): |
a8831418ff04
mx: add completion support for hotspot options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13508
diff
changeset
|
2491 def isBoolean(vmap, field): |
a8831418ff04
mx: add completion support for hotspot options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13508
diff
changeset
|
2492 return vmap[field] == "Boolean" or vmap[field] == "bool" |
a8831418ff04
mx: add completion support for hotspot options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13508
diff
changeset
|
2493 |
a8831418ff04
mx: add completion support for hotspot options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13508
diff
changeset
|
2494 def hasDescription(vmap): |
a8831418ff04
mx: add completion support for hotspot options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13508
diff
changeset
|
2495 return vmap['optDefault'] or vmap['optDoc'] |
a8831418ff04
mx: add completion support for hotspot options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13508
diff
changeset
|
2496 |
a8831418ff04
mx: add completion support for hotspot options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13508
diff
changeset
|
2497 complt = "" |
a8831418ff04
mx: add completion support for hotspot options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13508
diff
changeset
|
2498 for vmap in _parseVMOptions(optionType): |
a8831418ff04
mx: add completion support for hotspot options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13508
diff
changeset
|
2499 complt += '\t\t\t\t\t-"' |
a8831418ff04
mx: add completion support for hotspot options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13508
diff
changeset
|
2500 complt += optionPrefix |
a8831418ff04
mx: add completion support for hotspot options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13508
diff
changeset
|
2501 if isBoolean(vmap, 'optType'): |
a8831418ff04
mx: add completion support for hotspot options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13508
diff
changeset
|
2502 complt += '"{-,+}"' |
a8831418ff04
mx: add completion support for hotspot options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13508
diff
changeset
|
2503 complt += vmap['optName'] |
a8831418ff04
mx: add completion support for hotspot options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13508
diff
changeset
|
2504 if not isBoolean(vmap, 'optType'): |
a8831418ff04
mx: add completion support for hotspot options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13508
diff
changeset
|
2505 complt += '=' |
a8831418ff04
mx: add completion support for hotspot options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13508
diff
changeset
|
2506 if hasDescription(vmap): |
a8831418ff04
mx: add completion support for hotspot options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13508
diff
changeset
|
2507 complt += "[" |
a8831418ff04
mx: add completion support for hotspot options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13508
diff
changeset
|
2508 if vmap['optDefault']: |
a8831418ff04
mx: add completion support for hotspot options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13508
diff
changeset
|
2509 complt += r"(default\: " + vmap['optDefault'] + ")" |
a8831418ff04
mx: add completion support for hotspot options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13508
diff
changeset
|
2510 if vmap['optDoc']: |
a8831418ff04
mx: add completion support for hotspot options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13508
diff
changeset
|
2511 complt += _fixQuotes(vmap['optDoc']) |
a8831418ff04
mx: add completion support for hotspot options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13508
diff
changeset
|
2512 if hasDescription(vmap): |
a8831418ff04
mx: add completion support for hotspot options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13508
diff
changeset
|
2513 complt += "]" |
a8831418ff04
mx: add completion support for hotspot options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13508
diff
changeset
|
2514 complt += '" \\\n' |
a8831418ff04
mx: add completion support for hotspot options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13508
diff
changeset
|
2515 return complt |
a8831418ff04
mx: add completion support for hotspot options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13508
diff
changeset
|
2516 |
a8831418ff04
mx: add completion support for hotspot options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13508
diff
changeset
|
2517 def _parseVMOptions(optionType): |
13508
8a5b39d0bfb5
mx: add completion support for graal options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13507
diff
changeset
|
2518 parser = OutputParser() |
8a5b39d0bfb5
mx: add completion support for graal options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13507
diff
changeset
|
2519 # TODO: the optDoc part can wrapped accross multiple lines, currently only the first line will be captured |
13509
a8831418ff04
mx: add completion support for hotspot options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13508
diff
changeset
|
2520 # TODO: fix matching for float literals |
13508
8a5b39d0bfb5
mx: add completion support for graal options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13507
diff
changeset
|
2521 jvmOptions = re.compile( |
8a5b39d0bfb5
mx: add completion support for graal options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13507
diff
changeset
|
2522 r"^[ \t]*" |
13509
a8831418ff04
mx: add completion support for hotspot options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13508
diff
changeset
|
2523 r"(?P<optType>(Boolean|Integer|Float|Double|String|bool|intx|uintx|ccstr|double)) " |
a8831418ff04
mx: add completion support for hotspot options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13508
diff
changeset
|
2524 r"(?P<optName>[a-zA-Z0-9]+)" |
a8831418ff04
mx: add completion support for hotspot options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13508
diff
changeset
|
2525 r"[ \t]+=[ \t]*" |
a8831418ff04
mx: add completion support for hotspot options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13508
diff
changeset
|
2526 r"(?P<optDefault>([\-0-9]+(\.[0-9]+(\.[0-9]+\.[0-9]+))?|false|true|null|Name|sun\.boot\.class\.path))?" |
a8831418ff04
mx: add completion support for hotspot options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13508
diff
changeset
|
2527 r"[ \t]*" |
a8831418ff04
mx: add completion support for hotspot options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13508
diff
changeset
|
2528 r"(?P<optDoc>.+)?", |
13508
8a5b39d0bfb5
mx: add completion support for graal options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13507
diff
changeset
|
2529 re.MULTILINE) |
8a5b39d0bfb5
mx: add completion support for graal options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13507
diff
changeset
|
2530 parser.addMatcher(ValuesMatcher(jvmOptions, { |
8a5b39d0bfb5
mx: add completion support for graal options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13507
diff
changeset
|
2531 'optType' : '<optType>', |
8a5b39d0bfb5
mx: add completion support for graal options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13507
diff
changeset
|
2532 'optName' : '<optName>', |
8a5b39d0bfb5
mx: add completion support for graal options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13507
diff
changeset
|
2533 'optDefault' : '<optDefault>', |
8a5b39d0bfb5
mx: add completion support for graal options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13507
diff
changeset
|
2534 'optDoc' : '<optDoc>', |
8a5b39d0bfb5
mx: add completion support for graal options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13507
diff
changeset
|
2535 })) |
8a5b39d0bfb5
mx: add completion support for graal options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13507
diff
changeset
|
2536 |
8a5b39d0bfb5
mx: add completion support for graal options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13507
diff
changeset
|
2537 # gather graal options |
8a5b39d0bfb5
mx: add completion support for graal options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13507
diff
changeset
|
2538 output = StringIO.StringIO() |
19182
8cd798884d60
generateZshCompletions should include diagnostic VM options and supoprt completion for more mx commands
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19162
diff
changeset
|
2539 vm(['-XX:-BootstrapGraal', '-XX:+UnlockDiagnosticVMOptions', '-G:+PrintFlags' if optionType == "graal" else '-XX:+PrintFlagsWithComments'], |
13695
b688e7da4c69
refined class path used by unittest to only include dependencies of the tests that will be run
Doug Simon <doug.simon@oracle.com>
parents:
13526
diff
changeset
|
2540 vm="graal", |
b688e7da4c69
refined class path used by unittest to only include dependencies of the tests that will be run
Doug Simon <doug.simon@oracle.com>
parents:
13526
diff
changeset
|
2541 vmbuild="optimized", |
b688e7da4c69
refined class path used by unittest to only include dependencies of the tests that will be run
Doug Simon <doug.simon@oracle.com>
parents:
13526
diff
changeset
|
2542 nonZeroIsFatal=False, |
b688e7da4c69
refined class path used by unittest to only include dependencies of the tests that will be run
Doug Simon <doug.simon@oracle.com>
parents:
13526
diff
changeset
|
2543 out=output.write, |
b688e7da4c69
refined class path used by unittest to only include dependencies of the tests that will be run
Doug Simon <doug.simon@oracle.com>
parents:
13526
diff
changeset
|
2544 err=subprocess.STDOUT) |
13508
8a5b39d0bfb5
mx: add completion support for graal options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13507
diff
changeset
|
2545 |
8a5b39d0bfb5
mx: add completion support for graal options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13507
diff
changeset
|
2546 valueMap = parser.parse(output.getvalue()) |
8a5b39d0bfb5
mx: add completion support for graal options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13507
diff
changeset
|
2547 return valueMap |
8a5b39d0bfb5
mx: add completion support for graal options (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13507
diff
changeset
|
2548 |
14546
942c4daa9db9
added findbugs command to mx
Doug Simon <doug.simon@oracle.com>
parents:
14162
diff
changeset
|
2549 def findbugs(args): |
942c4daa9db9
added findbugs command to mx
Doug Simon <doug.simon@oracle.com>
parents:
14162
diff
changeset
|
2550 '''run FindBugs against non-test Java projects''' |
942c4daa9db9
added findbugs command to mx
Doug Simon <doug.simon@oracle.com>
parents:
14162
diff
changeset
|
2551 findBugsHome = mx.get_env('FINDBUGS_HOME', None) |
942c4daa9db9
added findbugs command to mx
Doug Simon <doug.simon@oracle.com>
parents:
14162
diff
changeset
|
2552 if findBugsHome: |
942c4daa9db9
added findbugs command to mx
Doug Simon <doug.simon@oracle.com>
parents:
14162
diff
changeset
|
2553 findbugsJar = join(findBugsHome, 'lib', 'findbugs.jar') |
942c4daa9db9
added findbugs command to mx
Doug Simon <doug.simon@oracle.com>
parents:
14162
diff
changeset
|
2554 else: |
942c4daa9db9
added findbugs command to mx
Doug Simon <doug.simon@oracle.com>
parents:
14162
diff
changeset
|
2555 findbugsLib = join(_graal_home, 'lib', 'findbugs-3.0.0') |
942c4daa9db9
added findbugs command to mx
Doug Simon <doug.simon@oracle.com>
parents:
14162
diff
changeset
|
2556 if not exists(findbugsLib): |
942c4daa9db9
added findbugs command to mx
Doug Simon <doug.simon@oracle.com>
parents:
14162
diff
changeset
|
2557 tmp = tempfile.mkdtemp(prefix='findbugs-download-tmp', dir=_graal_home) |
942c4daa9db9
added findbugs command to mx
Doug Simon <doug.simon@oracle.com>
parents:
14162
diff
changeset
|
2558 try: |
16599
89be7c4db12c
made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
Doug Simon <doug.simon@oracle.com>
parents:
16499
diff
changeset
|
2559 findbugsDist = mx.library('FINDBUGS_DIST').get_path(resolve=True) |
14546
942c4daa9db9
added findbugs command to mx
Doug Simon <doug.simon@oracle.com>
parents:
14162
diff
changeset
|
2560 with zipfile.ZipFile(findbugsDist) as zf: |
942c4daa9db9
added findbugs command to mx
Doug Simon <doug.simon@oracle.com>
parents:
14162
diff
changeset
|
2561 candidates = [e for e in zf.namelist() if e.endswith('/lib/findbugs.jar')] |
942c4daa9db9
added findbugs command to mx
Doug Simon <doug.simon@oracle.com>
parents:
14162
diff
changeset
|
2562 assert len(candidates) == 1, candidates |
942c4daa9db9
added findbugs command to mx
Doug Simon <doug.simon@oracle.com>
parents:
14162
diff
changeset
|
2563 libDirInZip = os.path.dirname(candidates[0]) |
942c4daa9db9
added findbugs command to mx
Doug Simon <doug.simon@oracle.com>
parents:
14162
diff
changeset
|
2564 zf.extractall(tmp) |
942c4daa9db9
added findbugs command to mx
Doug Simon <doug.simon@oracle.com>
parents:
14162
diff
changeset
|
2565 shutil.copytree(join(tmp, libDirInZip), findbugsLib) |
942c4daa9db9
added findbugs command to mx
Doug Simon <doug.simon@oracle.com>
parents:
14162
diff
changeset
|
2566 finally: |
942c4daa9db9
added findbugs command to mx
Doug Simon <doug.simon@oracle.com>
parents:
14162
diff
changeset
|
2567 shutil.rmtree(tmp) |
942c4daa9db9
added findbugs command to mx
Doug Simon <doug.simon@oracle.com>
parents:
14162
diff
changeset
|
2568 findbugsJar = join(findbugsLib, 'findbugs.jar') |
942c4daa9db9
added findbugs command to mx
Doug Simon <doug.simon@oracle.com>
parents:
14162
diff
changeset
|
2569 assert exists(findbugsJar) |
942c4daa9db9
added findbugs command to mx
Doug Simon <doug.simon@oracle.com>
parents:
14162
diff
changeset
|
2570 nonTestProjects = [p for p in mx.projects() if not p.name.endswith('.test') and not p.name.endswith('.jtt')] |
17262
b641450c19ce
mx: rename helper functions for cygwin support and update comments
Bernhard Urban <bernhard.urban@jku.at>
parents:
17233
diff
changeset
|
2571 outputDirs = map(mx._cygpathU2W, [p.output_dir() for p in nonTestProjects]) |
18613
8c3a85077f84
mx: run findbugs with the appropriate jdk
Doug Simon <doug.simon@oracle.com>
parents:
18606
diff
changeset
|
2572 javaCompliance = max([p.javaCompliance for p in nonTestProjects]) |
14546
942c4daa9db9
added findbugs command to mx
Doug Simon <doug.simon@oracle.com>
parents:
14162
diff
changeset
|
2573 findbugsResults = join(_graal_home, 'findbugs.results') |
14769 | 2574 |
17262
b641450c19ce
mx: rename helper functions for cygwin support and update comments
Bernhard Urban <bernhard.urban@jku.at>
parents:
17233
diff
changeset
|
2575 cmd = ['-jar', mx._cygpathU2W(findbugsJar), '-textui', '-low', '-maxRank', '15'] |
21166
f383ff4c9af8
mx: fix JDK selection when running outside a tty, capture STRICT_COMPLIANCE from the env file, make sure raw_input promt goes to stdout
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21165
diff
changeset
|
2576 if mx.is_interactive(): |
14767
ded08e344e4a
findbugs will also use any findbugsExcludeFilter.xml it finds in a suite's root
Doug Simon <doug.simon@oracle.com>
parents:
14762
diff
changeset
|
2577 cmd.append('-progress') |
18116
c4f649042a7b
mx/unittest: fix cygwin path issue
Bernhard Urban <bernhard.urban@jku.at>
parents:
18115
diff
changeset
|
2578 cmd = cmd + ['-auxclasspath', mx._separatedCygpathU2W(mx.classpath([d.name for d in _jdkDeployedDists] + [p.name for p in nonTestProjects])), '-output', mx._cygpathU2W(findbugsResults), '-exitcode'] + args + outputDirs |
18613
8c3a85077f84
mx: run findbugs with the appropriate jdk
Doug Simon <doug.simon@oracle.com>
parents:
18606
diff
changeset
|
2579 exitcode = mx.run_java(cmd, nonZeroIsFatal=False, javaConfig=mx.java(javaCompliance)) |
14546
942c4daa9db9
added findbugs command to mx
Doug Simon <doug.simon@oracle.com>
parents:
14162
diff
changeset
|
2580 if exitcode != 0: |
942c4daa9db9
added findbugs command to mx
Doug Simon <doug.simon@oracle.com>
parents:
14162
diff
changeset
|
2581 with open(findbugsResults) as fp: |
942c4daa9db9
added findbugs command to mx
Doug Simon <doug.simon@oracle.com>
parents:
14162
diff
changeset
|
2582 mx.log(fp.read()) |
942c4daa9db9
added findbugs command to mx
Doug Simon <doug.simon@oracle.com>
parents:
14162
diff
changeset
|
2583 os.unlink(findbugsResults) |
942c4daa9db9
added findbugs command to mx
Doug Simon <doug.simon@oracle.com>
parents:
14162
diff
changeset
|
2584 return exitcode |
13507
d3ec6003856d
mx: experimental autocompletion generation for zsh (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13486
diff
changeset
|
2585 |
14772
c929a4a3b6c5
added checkheaders command for checking Java source headers without relying on Checkstyle
Doug Simon <doug.simon@oracle.com>
parents:
14769
diff
changeset
|
2586 def checkheaders(args): |
c929a4a3b6c5
added checkheaders command for checking Java source headers without relying on Checkstyle
Doug Simon <doug.simon@oracle.com>
parents:
14769
diff
changeset
|
2587 """check Java source headers against any required pattern""" |
c929a4a3b6c5
added checkheaders command for checking Java source headers without relying on Checkstyle
Doug Simon <doug.simon@oracle.com>
parents:
14769
diff
changeset
|
2588 failures = {} |
c929a4a3b6c5
added checkheaders command for checking Java source headers without relying on Checkstyle
Doug Simon <doug.simon@oracle.com>
parents:
14769
diff
changeset
|
2589 for p in mx.projects(): |
c929a4a3b6c5
added checkheaders command for checking Java source headers without relying on Checkstyle
Doug Simon <doug.simon@oracle.com>
parents:
14769
diff
changeset
|
2590 if p.native: |
c929a4a3b6c5
added checkheaders command for checking Java source headers without relying on Checkstyle
Doug Simon <doug.simon@oracle.com>
parents:
14769
diff
changeset
|
2591 continue |
c929a4a3b6c5
added checkheaders command for checking Java source headers without relying on Checkstyle
Doug Simon <doug.simon@oracle.com>
parents:
14769
diff
changeset
|
2592 |
18163
c88ab4f1f04a
re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents:
18116
diff
changeset
|
2593 csConfig = join(mx.project(p.checkstyleProj).dir, '.checkstyle_checks.xml') |
14772
c929a4a3b6c5
added checkheaders command for checking Java source headers without relying on Checkstyle
Doug Simon <doug.simon@oracle.com>
parents:
14769
diff
changeset
|
2594 dom = xml.dom.minidom.parse(csConfig) |
c929a4a3b6c5
added checkheaders command for checking Java source headers without relying on Checkstyle
Doug Simon <doug.simon@oracle.com>
parents:
14769
diff
changeset
|
2595 for module in dom.getElementsByTagName('module'): |
c929a4a3b6c5
added checkheaders command for checking Java source headers without relying on Checkstyle
Doug Simon <doug.simon@oracle.com>
parents:
14769
diff
changeset
|
2596 if module.getAttribute('name') == 'RegexpHeader': |
c929a4a3b6c5
added checkheaders command for checking Java source headers without relying on Checkstyle
Doug Simon <doug.simon@oracle.com>
parents:
14769
diff
changeset
|
2597 for prop in module.getElementsByTagName('property'): |
c929a4a3b6c5
added checkheaders command for checking Java source headers without relying on Checkstyle
Doug Simon <doug.simon@oracle.com>
parents:
14769
diff
changeset
|
2598 if prop.getAttribute('name') == 'header': |
c929a4a3b6c5
added checkheaders command for checking Java source headers without relying on Checkstyle
Doug Simon <doug.simon@oracle.com>
parents:
14769
diff
changeset
|
2599 value = prop.getAttribute('value') |
c929a4a3b6c5
added checkheaders command for checking Java source headers without relying on Checkstyle
Doug Simon <doug.simon@oracle.com>
parents:
14769
diff
changeset
|
2600 matcher = re.compile(value, re.MULTILINE) |
c929a4a3b6c5
added checkheaders command for checking Java source headers without relying on Checkstyle
Doug Simon <doug.simon@oracle.com>
parents:
14769
diff
changeset
|
2601 for sourceDir in p.source_dirs(): |
c929a4a3b6c5
added checkheaders command for checking Java source headers without relying on Checkstyle
Doug Simon <doug.simon@oracle.com>
parents:
14769
diff
changeset
|
2602 for root, _, files in os.walk(sourceDir): |
c929a4a3b6c5
added checkheaders command for checking Java source headers without relying on Checkstyle
Doug Simon <doug.simon@oracle.com>
parents:
14769
diff
changeset
|
2603 for name in files: |
c929a4a3b6c5
added checkheaders command for checking Java source headers without relying on Checkstyle
Doug Simon <doug.simon@oracle.com>
parents:
14769
diff
changeset
|
2604 if name.endswith('.java') and name != 'package-info.java': |
c929a4a3b6c5
added checkheaders command for checking Java source headers without relying on Checkstyle
Doug Simon <doug.simon@oracle.com>
parents:
14769
diff
changeset
|
2605 f = join(root, name) |
c929a4a3b6c5
added checkheaders command for checking Java source headers without relying on Checkstyle
Doug Simon <doug.simon@oracle.com>
parents:
14769
diff
changeset
|
2606 with open(f) as fp: |
c929a4a3b6c5
added checkheaders command for checking Java source headers without relying on Checkstyle
Doug Simon <doug.simon@oracle.com>
parents:
14769
diff
changeset
|
2607 content = fp.read() |
c929a4a3b6c5
added checkheaders command for checking Java source headers without relying on Checkstyle
Doug Simon <doug.simon@oracle.com>
parents:
14769
diff
changeset
|
2608 if not matcher.match(content): |
c929a4a3b6c5
added checkheaders command for checking Java source headers without relying on Checkstyle
Doug Simon <doug.simon@oracle.com>
parents:
14769
diff
changeset
|
2609 failures[f] = csConfig |
c929a4a3b6c5
added checkheaders command for checking Java source headers without relying on Checkstyle
Doug Simon <doug.simon@oracle.com>
parents:
14769
diff
changeset
|
2610 for n, v in failures.iteritems(): |
18637
d5d1fbe270e9
mx: fixed format string
Doug Simon <doug.simon@oracle.com>
parents:
18635
diff
changeset
|
2611 mx.log('{0}: header does not match RegexpHeader defined in {1}'.format(n, v)) |
14772
c929a4a3b6c5
added checkheaders command for checking Java source headers without relying on Checkstyle
Doug Simon <doug.simon@oracle.com>
parents:
14769
diff
changeset
|
2612 return len(failures) |
c929a4a3b6c5
added checkheaders command for checking Java source headers without relying on Checkstyle
Doug Simon <doug.simon@oracle.com>
parents:
14769
diff
changeset
|
2613 |
11605
3676540f71cf
Allow mxtool suites to be in separate repositories (CR-1367)
Mick Jordan <mick.jordan@oracle.com>
parents:
11534
diff
changeset
|
2614 def mx_init(suite): |
3718 | 2615 commands = { |
11371
74414b248381
mx: added --vmbuild global option, removed --product, --fastdebug, --debug options as well as suffix of build command
Doug Simon <doug.simon@oracle.com>
parents:
11368
diff
changeset
|
2616 'build': [build, ''], |
15250
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2617 'buildjmh': [buildjmh, '[-options]'], |
9116
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
2618 'buildvars': [buildvars, ''], |
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
|
2619 'buildvms': [buildvms, '[-options]'], |
14116
be7ebdf41bea
mx: new command to start c1visualizer; support for IGV download when using a proxy server
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14048
diff
changeset
|
2620 'c1visualizer' : [c1visualizer, ''], |
14772
c929a4a3b6c5
added checkheaders command for checking Java source headers without relying on Checkstyle
Doug Simon <doug.simon@oracle.com>
parents:
14769
diff
changeset
|
2621 'checkheaders': [checkheaders, ''], |
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
|
2622 'clean': [clean, ''], |
17052
35fda668ed6e
mx: added ctw command to simplify executing CompileTheWorld
Doug Simon <doug.simon@oracle.com>
parents:
17015
diff
changeset
|
2623 'ctw': [ctw, '[-vmoptions|noinline|nocomplex|full]'], |
14546
942c4daa9db9
added findbugs command to mx
Doug Simon <doug.simon@oracle.com>
parents:
14162
diff
changeset
|
2624 'findbugs': [findbugs, ''], |
13507
d3ec6003856d
mx: experimental autocompletion generation for zsh (GRAAL-297)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13486
diff
changeset
|
2625 'generateZshCompletion' : [generateZshCompletion, ''], |
4482
7903b6c28f9c
Add hsdis command to mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4480
diff
changeset
|
2626 'hsdis': [hsdis, '[att]'], |
5245 | 2627 'hcfdis': [hcfdis, ''], |
5089
206e68bb66c6
Made the IdealGraphVisualizer runnable from mx with new 'igv' command.
Doug Simon <doug.simon@oracle.com>
parents:
5064
diff
changeset
|
2628 'igv' : [igv, ''], |
16693
b002c864e974
Truffle: rename install to maven-install-truffle and update location of Truffle JARs.
Chris Seaton <chris.seaton@oracle.com>
parents:
16676
diff
changeset
|
2629 'maven-install-truffle' : [maven_install_truffle, ''], |
11605
3676540f71cf
Allow mxtool suites to be in separate repositories (CR-1367)
Mick Jordan <mick.jordan@oracle.com>
parents:
11534
diff
changeset
|
2630 'jdkhome': [print_jdkhome, ''], |
15021
9dcd5407a603
added support for overriding/complementing JMH arguments in jmh command with a JSON string
Doug Simon <doug.simon@oracle.com>
parents:
15014
diff
changeset
|
2631 'jmh': [jmh, '[VM options] [filters|JMH-args-as-json...]'], |
11367
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
2632 'dacapo': [dacapo, '[VM options] benchmarks...|"all" [DaCapo options]'], |
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
2633 'scaladacapo': [scaladacapo, '[VM options] benchmarks...|"all" [Scala DaCapo options]'], |
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
2634 'specjvm2008': [specjvm2008, '[VM options] benchmarks...|"all" [SPECjvm2008 options]'], |
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
2635 'specjbb2013': [specjbb2013, '[VM options] [-- [SPECjbb2013 options]]'], |
39b86b83ddeb
normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents:
11359
diff
changeset
|
2636 'specjbb2005': [specjbb2005, '[VM options] [-- [SPECjbb2005 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
|
2637 'gate' : [gate, '[-options]'], |
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
|
2638 'bench' : [bench, '[-resultfile file] [all(default)|dacapo|specjvm2008|bootstrap]'], |
18897
9afee75cee46
mx: add microbench command to run JMH benchmarks
Roland Schatz <roland.schatz@oracle.com>
parents:
18894
diff
changeset
|
2639 'microbench' : [microbench, '[VM options] [-- [JMH options]]'], |
15113 | 2640 'unittest' : [unittest, '[unittest options] [--] [VM options] [filters...]', _unittestHelpSuffix], |
15250
4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
Doug Simon <doug.simon@oracle.com>
parents:
15229
diff
changeset
|
2641 'makejmhdeps' : [makejmhdeps, ''], |
15113 | 2642 'shortunittest' : [shortunittest, '[unittest options] [--] [VM options] [filters...]', _unittestHelpSuffix], |
4684
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
2643 '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
|
2644 '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
|
2645 '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
|
2646 'vmg': [vmg, '[-options] class [args...]'], |
6340
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
2647 'vmfg': [vmfg, '[-options] class [args...]'], |
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
2648 'deoptalot' : [deoptalot, '[n]'], |
11867 | 2649 'longtests' : [longtests, ''], |
16167
1f4955abca9b
mx: add jol command for java object layout introspection
Andreas Woess <andreas.woess@jku.at>
parents:
16117
diff
changeset
|
2650 'sl' : [sl, '[SL args|@VM options]'], |
1f4955abca9b
mx: add jol command for java object layout introspection
Andreas Woess <andreas.woess@jku.at>
parents:
16117
diff
changeset
|
2651 'jol' : [jol, ''], |
3718 | 2652 } |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
2653 |
5064
8a88c903e381
Updated mx commands.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5047
diff
changeset
|
2654 mx.add_argument('--jacoco', help='instruments com.oracle.* classes using JaCoCo', default='off', choices=['off', 'on', 'append']) |
11401
2d228d304247
minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents:
11395
diff
changeset
|
2655 mx.add_argument('--vmcwd', dest='vm_cwd', help='current directory will be changed to <path> before the VM is executed', default=None, metavar='<path>') |
2d228d304247
minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents:
11395
diff
changeset
|
2656 mx.add_argument('--installed-jdks', help='the base directory in which the JDKs cloned from $JAVA_HOME exist. ' + |
2d228d304247
minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents:
11395
diff
changeset
|
2657 'The VM selected by --vm and --vmbuild options is under this directory (i.e., ' + |
11493
94779c895aad
fixed documentation of --installed-jdks mx option
Doug Simon <doug.simon@oracle.com>
parents:
11424
diff
changeset
|
2658 join('<path>', '<jdk-version>', '<vmbuild>', 'jre', 'lib', '<vm>', mx.add_lib_prefix(mx.add_lib_suffix('jvm'))) + ')', default=None, metavar='<path>') |
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
|
2659 |
13967
4cd7c6629841
mx_graal: fix pylint 1.1.0 warnings
Bernhard Urban <bernhard.urban@jku.at>
parents:
13952
diff
changeset
|
2660 if _vmSourcesAvailable: |
11371
74414b248381
mx: added --vmbuild global option, removed --product, --fastdebug, --debug options as well as suffix of build command
Doug Simon <doug.simon@oracle.com>
parents:
11368
diff
changeset
|
2661 mx.add_argument('--vm', action='store', dest='vm', choices=_vmChoices.keys(), help='the VM type to build/run') |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
2662 mx.add_argument('--vmbuild', action='store', dest='vmbuild', choices=_vmbuildChoices, help='the VM build to build/run (default: ' + _vmbuildChoices[0] + ')') |
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
|
2663 mx.add_argument('--ecl', action='store_true', dest='make_eclipse_launch', help='create launch configuration for running VM execution(s) in Eclipse') |
11401
2d228d304247
minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents:
11395
diff
changeset
|
2664 mx.add_argument('--vmprefix', action='store', dest='vm_prefix', help='prefix for running the VM (e.g. "/usr/bin/gdb --args")', metavar='<prefix>') |
2d228d304247
minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents:
11395
diff
changeset
|
2665 mx.add_argument('--gdb', action='store_const', const='/usr/bin/gdb --args', dest='vm_prefix', help='alias for --vmprefix "/usr/bin/gdb --args"') |
18869
fe4f875e435f
Add --lldb option like --gdb
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18864
diff
changeset
|
2666 mx.add_argument('--lldb', action='store_const', const='lldb --', dest='vm_prefix', help='alias for --vmprefix "lldb --"') |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
2667 |
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
|
2668 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
|
2669 'export': [export, '[-options] [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
|
2670 }) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
2671 |
11605
3676540f71cf
Allow mxtool suites to be in separate repositories (CR-1367)
Mick Jordan <mick.jordan@oracle.com>
parents:
11534
diff
changeset
|
2672 mx.update_commands(suite, commands) |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
2673 |
11514
dc3c8df55905
added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents:
11512
diff
changeset
|
2674 def mx_post_parse_cmd_line(opts): # |
7916
9bff64f43299
Better java version numbers support in mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7788
diff
changeset
|
2675 # TODO _minVersion check could probably be part of a Suite in mx? |
13967
4cd7c6629841
mx_graal: fix pylint 1.1.0 warnings
Bernhard Urban <bernhard.urban@jku.at>
parents:
13952
diff
changeset
|
2676 if mx.java().version < _minVersion: |
20102
6e5df2d60fbd
mx: fix compliance check for EXTRA_JAVA_HOMES, add maximum JAVA_HOME version in mx_graal
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
20032
diff
changeset
|
2677 mx.abort('Requires Java version ' + str(_minVersion) + ' or greater for JAVA_HOME, got version ' + str(mx.java().version)) |
20805
379471b334cb
Lift 8u40 mx restriction
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
20102
diff
changeset
|
2678 if _untilVersion and mx.java().version >= _untilVersion: |
20102
6e5df2d60fbd
mx: fix compliance check for EXTRA_JAVA_HOMES, add maximum JAVA_HOME version in mx_graal
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
20032
diff
changeset
|
2679 mx.abort('Requires Java version strictly before ' + str(_untilVersion) + ' for JAVA_HOME, got version ' + str(mx.java().version)) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
2680 |
13967
4cd7c6629841
mx_graal: fix pylint 1.1.0 warnings
Bernhard Urban <bernhard.urban@jku.at>
parents:
13952
diff
changeset
|
2681 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
|
2682 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
|
2683 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
|
2684 _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
|
2685 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
|
2686 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
|
2687 _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
|
2688 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
|
2689 _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
|
2690 global _jacoco |
7ccdae96e98a
Allow JaCoCon to append to the execution file
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5016
diff
changeset
|
2691 _jacoco = opts.jacoco |
11401
2d228d304247
minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents:
11395
diff
changeset
|
2692 global _vm_cwd |
2d228d304247
minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents:
11395
diff
changeset
|
2693 _vm_cwd = opts.vm_cwd |
2d228d304247
minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents:
11395
diff
changeset
|
2694 global _installed_jdks |
2d228d304247
minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents:
11395
diff
changeset
|
2695 _installed_jdks = opts.installed_jdks |
2d228d304247
minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents:
11395
diff
changeset
|
2696 global _vm_prefix |
2d228d304247
minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents:
11395
diff
changeset
|
2697 _vm_prefix = opts.vm_prefix |
8134
6e3ebc6fd5a4
graal.jar is installed in all JDKs every time it is updated (GRAAL-136)
Doug Simon <doug.simon@oracle.com>
parents:
8132
diff
changeset
|
2698 |
16902
0583d157992a
formalized the set of distribution jars that are installed into the JDK to ensure both mx and the HotSpot make system do the necessary deployment
Doug Simon <doug.simon@oracle.com>
parents:
16877
diff
changeset
|
2699 for jdkDist in _jdkDeployedDists: |
21031
e1c063565b3c
Graal Services: use services files in jre/lib/graal/services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
20996
diff
changeset
|
2700 def _close(jdkDeployable): |
e1c063565b3c
Graal Services: use services files in jre/lib/graal/services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
20996
diff
changeset
|
2701 def _install(dist): |
e1c063565b3c
Graal Services: use services files in jre/lib/graal/services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
20996
diff
changeset
|
2702 assert dist.name == jdkDeployable.name, dist.name + "!=" + jdkDeployable.name |
e1c063565b3c
Graal Services: use services files in jre/lib/graal/services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
20996
diff
changeset
|
2703 _installDistInJdks(jdkDeployable) |
e1c063565b3c
Graal Services: use services files in jre/lib/graal/services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
20996
diff
changeset
|
2704 return _install |
e1c063565b3c
Graal Services: use services files in jre/lib/graal/services
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
20996
diff
changeset
|
2705 mx.distribution(jdkDist.name).add_update_listener(_close(jdkDist)) |