annotate mx/commands.py @ 4145:9aee7df31417

Removed 'tests' command. Folded 'make' command into 'build' command. Renamed 'eclipseprojects' command to 'ideinit'
author Doug Simon <doug.simon@oracle.com>
date Mon, 19 Dec 2011 20:56:59 +0100
parents 34527a24bcf8
children 4eb5b2469b6f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
1 #
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
2 # commands.py - the default commands available to gl.py
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
3 #
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
4 # ----------------------------------------------------------------------------------------------------
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
5 #
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
6 # Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
8 #
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
9 # This code is free software; you can redistribute it and/or modify it
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
10 # under the terms of the GNU General Public License version 2 only, as
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
11 # published by the Free Software Foundation.
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
12 #
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
13 # This code is distributed in the hope that it will be useful, but WITHOUT
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
14 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
15 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
16 # version 2 for more details (a copy is included in the LICENSE file that
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
17 # accompanied this code).
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
18 #
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
19 # You should have received a copy of the GNU General Public License version
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
20 # 2 along with this work; if not, write to the Free Software Foundation,
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
21 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
22 #
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
23 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
24 # or visit www.oracle.com if you need additional information or have any
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
25 # questions.
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
26 #
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
27 # ----------------------------------------------------------------------------------------------------
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
28
3732
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
29 import os, sys, shutil, tarfile, StringIO
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
30 from os.path import join, exists, dirname, isfile, isdir, isabs
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
31 import mx
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
32
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
33 _graal_home = dirname(dirname(__file__))
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
34 _vmbuild = 'product'
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
35
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
36 def clean(args):
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
37 """cleans the GraalVM source tree"""
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
38 os.environ.update(ARCH_DATA_MODEL='64', LANG='C', HOTSPOT_BUILD_JOBS='16')
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
39 mx.run([mx.gmake_cmd(), 'clean'], cwd=join(_graal_home, 'make'))
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
40
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
41 def example(args):
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
42 """run some or all Graal examples"""
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
43 examples = {
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
44 'safeadd': ['com.oracle.max.graal.examples.safeadd', 'com.oracle.max.graal.examples.safeadd.Main'],
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
45 'vectorlib': ['com.oracle.max.graal.examples.vectorlib', 'com.oracle.max.graal.examples.vectorlib.Main'],
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
46 }
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
47
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
48 def run_example(verbose, project, mainClass):
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
49 cp = mx.classpath(project)
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
50 sharedArgs = ['-Xcomp', '-XX:CompileOnly=Main', mainClass]
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
51
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
52 res = []
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
53 mx.log("=== Server VM ===")
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
54 printArg = '-XX:+PrintCompilation' if verbose else '-XX:-PrintCompilation'
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
55 res.append(vm(['-cp', cp, printArg] + sharedArgs, vm="-server"))
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
56 mx.log("=== Graal VM ===")
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
57 printArg = '-G:+PrintCompilation' if verbose else '-G:-PrintCompilation'
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
58 res.append(vm(['-cp', cp, printArg, '-G:-Extend', '-G:-Inline'] + sharedArgs))
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
59 mx.log("=== Graal VM with extensions ===")
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
60 res.append(vm(['-cp', cp, printArg, '-G:+Extend', '-G:-Inline'] + sharedArgs))
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
61
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
62 if len([x for x in res if x != 0]) != 0:
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
63 return 1
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
64 return 0
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
65
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
66 verbose = False
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
67 if '-v' in args:
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
68 verbose = True
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
69 args = [a for a in args if a != '-v']
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
70
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
71 if len(args) == 0:
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
72 args = examples.keys()
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
73 for a in args:
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
74 config = examples.get(a)
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
75 if config is None:
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
76 mx.log('unknown example: ' + a + ' {available examples = ' + str(examples.keys()) + '}')
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
77 else:
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
78 mx.log('--------- ' + a + ' ------------')
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
79 project, mainClass = config
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
80 run_example(verbose, project, mainClass)
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
81
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
82 def dacapo(args):
3722
7c5524a4e86e Unified the way a specific build of the VM is chosen for any mx command that runs the GraalVM.
Doug Simon <doug.simon@oracle.com>
parents: 3721
diff changeset
83 """run one or all DaCapo benchmarks"""
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
84
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
85 benchmarks = {
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
86 'avrora': ['-n', '5'],
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
87 'batik': ['-n', '5'],
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
88 'eclipse': ['-n', '5'],
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
89 'fop': ['-n', '5'],
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
90 'h2': ['-n', '5'],
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
91 'jython': ['-n', '5'],
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
92 'luindex': ['-n', '5'],
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
93 'lusearch': ['-n', '5'],
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
94 'pmd': ['-n', '5'],
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
95 'sunflow': ['-n', '5'],
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
96 'tomcat': ['-n', '5'],
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
97 'tradebeans': ['-n', '5'],
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
98 'tradesoap': ['-n', '5'],
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
99 'xalan': ['-n', '5'],
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
100 }
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
101
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
102 dacapo = mx.check_get_env('DACAPO_CP')
3722
7c5524a4e86e Unified the way a specific build of the VM is chosen for any mx command that runs the GraalVM.
Doug Simon <doug.simon@oracle.com>
parents: 3721
diff changeset
103 if not isfile(dacapo) or not dacapo.endswith('.jar'):
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
104 mx.abort('Specified DaCapo jar file does not exist or is not a jar file: ' + dacapo)
3722
7c5524a4e86e Unified the way a specific build of the VM is chosen for any mx command that runs the GraalVM.
Doug Simon <doug.simon@oracle.com>
parents: 3721
diff changeset
105
7c5524a4e86e Unified the way a specific build of the VM is chosen for any mx command that runs the GraalVM.
Doug Simon <doug.simon@oracle.com>
parents: 3721
diff changeset
106 vmOpts = ['-Xms1g', '-Xmx2g', '-esa', '-cp', dacapo]
7c5524a4e86e Unified the way a specific build of the VM is chosen for any mx command that runs the GraalVM.
Doug Simon <doug.simon@oracle.com>
parents: 3721
diff changeset
107
7c5524a4e86e Unified the way a specific build of the VM is chosen for any mx command that runs the GraalVM.
Doug Simon <doug.simon@oracle.com>
parents: 3721
diff changeset
108 runs = dict()
7c5524a4e86e Unified the way a specific build of the VM is chosen for any mx command that runs the GraalVM.
Doug Simon <doug.simon@oracle.com>
parents: 3721
diff changeset
109 while len(args) != 0 and not args[0].startswith('-'):
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
110 bm = args[0]
3722
7c5524a4e86e Unified the way a specific build of the VM is chosen for any mx command that runs the GraalVM.
Doug Simon <doug.simon@oracle.com>
parents: 3721
diff changeset
111 del args[0]
7c5524a4e86e Unified the way a specific build of the VM is chosen for any mx command that runs the GraalVM.
Doug Simon <doug.simon@oracle.com>
parents: 3721
diff changeset
112 config = benchmarks.get(bm)
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
113 if (config is None):
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
114 mx.abort('unknown benchmark: ' + bm + '\nselect one of: ' + str(benchmarks.keys()))
3722
7c5524a4e86e Unified the way a specific build of the VM is chosen for any mx command that runs the GraalVM.
Doug Simon <doug.simon@oracle.com>
parents: 3721
diff changeset
115 runs[bm] = config
7c5524a4e86e Unified the way a specific build of the VM is chosen for any mx command that runs the GraalVM.
Doug Simon <doug.simon@oracle.com>
parents: 3721
diff changeset
116
7c5524a4e86e Unified the way a specific build of the VM is chosen for any mx command that runs the GraalVM.
Doug Simon <doug.simon@oracle.com>
parents: 3721
diff changeset
117 if len(runs) == 0:
7c5524a4e86e Unified the way a specific build of the VM is chosen for any mx command that runs the GraalVM.
Doug Simon <doug.simon@oracle.com>
parents: 3721
diff changeset
118 runs = benchmarks
7c5524a4e86e Unified the way a specific build of the VM is chosen for any mx command that runs the GraalVM.
Doug Simon <doug.simon@oracle.com>
parents: 3721
diff changeset
119
7c5524a4e86e Unified the way a specific build of the VM is chosen for any mx command that runs the GraalVM.
Doug Simon <doug.simon@oracle.com>
parents: 3721
diff changeset
120 vmOpts += args
7c5524a4e86e Unified the way a specific build of the VM is chosen for any mx command that runs the GraalVM.
Doug Simon <doug.simon@oracle.com>
parents: 3721
diff changeset
121 for bm in runs:
7c5524a4e86e Unified the way a specific build of the VM is chosen for any mx command that runs the GraalVM.
Doug Simon <doug.simon@oracle.com>
parents: 3721
diff changeset
122 config = benchmarks.get(bm)
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
123 vm(vmOpts + ['Harness'] + config + [bm])
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
124
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
125 def _download_and_extract_targz_jdk7(url, dst):
3730
4e3851bab8d0 Added mechanism for downloading a JDK 7 if the JDK7 environment variable is not set. This only works on Linux as only it has a single tar.gz version of the JDK available from the Oracle JDK download website.
Doug Simon <doug.simon@oracle.com>
parents: 3722
diff changeset
126 assert url.endswith('.tar.gz')
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
127 dl = join(_graal_home, 'jdk7.tar.gz')
3730
4e3851bab8d0 Added mechanism for downloading a JDK 7 if the JDK7 environment variable is not set. This only works on Linux as only it has a single tar.gz version of the JDK available from the Oracle JDK download website.
Doug Simon <doug.simon@oracle.com>
parents: 3722
diff changeset
128 try:
4e3851bab8d0 Added mechanism for downloading a JDK 7 if the JDK7 environment variable is not set. This only works on Linux as only it has a single tar.gz version of the JDK available from the Oracle JDK download website.
Doug Simon <doug.simon@oracle.com>
parents: 3722
diff changeset
129 if not exists(dl):
4145
9aee7df31417 Removed 'tests' command.
Doug Simon <doug.simon@oracle.com>
parents: 4144
diff changeset
130 mx.log('Downloading ' + url)
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
131 mx.download(dl, [url])
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
132 tmp = join(_graal_home, 'tmp')
3730
4e3851bab8d0 Added mechanism for downloading a JDK 7 if the JDK7 environment variable is not set. This only works on Linux as only it has a single tar.gz version of the JDK available from the Oracle JDK download website.
Doug Simon <doug.simon@oracle.com>
parents: 3722
diff changeset
133 if not exists(tmp):
4e3851bab8d0 Added mechanism for downloading a JDK 7 if the JDK7 environment variable is not set. This only works on Linux as only it has a single tar.gz version of the JDK available from the Oracle JDK download website.
Doug Simon <doug.simon@oracle.com>
parents: 3722
diff changeset
134 os.mkdir(tmp)
4e3851bab8d0 Added mechanism for downloading a JDK 7 if the JDK7 environment variable is not set. This only works on Linux as only it has a single tar.gz version of the JDK available from the Oracle JDK download website.
Doug Simon <doug.simon@oracle.com>
parents: 3722
diff changeset
135 with tarfile.open(dl, mode='r:gz') as f:
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
136 mx.log('Extracting ' + dl)
3730
4e3851bab8d0 Added mechanism for downloading a JDK 7 if the JDK7 environment variable is not set. This only works on Linux as only it has a single tar.gz version of the JDK available from the Oracle JDK download website.
Doug Simon <doug.simon@oracle.com>
parents: 3722
diff changeset
137 f.extractall(path=tmp)
4e3851bab8d0 Added mechanism for downloading a JDK 7 if the JDK7 environment variable is not set. This only works on Linux as only it has a single tar.gz version of the JDK available from the Oracle JDK download website.
Doug Simon <doug.simon@oracle.com>
parents: 3722
diff changeset
138 jdk = os.listdir(tmp)[0]
4e3851bab8d0 Added mechanism for downloading a JDK 7 if the JDK7 environment variable is not set. This only works on Linux as only it has a single tar.gz version of the JDK available from the Oracle JDK download website.
Doug Simon <doug.simon@oracle.com>
parents: 3722
diff changeset
139 shutil.move(join(tmp, jdk), dst)
4e3851bab8d0 Added mechanism for downloading a JDK 7 if the JDK7 environment variable is not set. This only works on Linux as only it has a single tar.gz version of the JDK available from the Oracle JDK download website.
Doug Simon <doug.simon@oracle.com>
parents: 3722
diff changeset
140 os.rmdir(tmp)
4e3851bab8d0 Added mechanism for downloading a JDK 7 if the JDK7 environment variable is not set. This only works on Linux as only it has a single tar.gz version of the JDK available from the Oracle JDK download website.
Doug Simon <doug.simon@oracle.com>
parents: 3722
diff changeset
141 os.remove(dl)
4e3851bab8d0 Added mechanism for downloading a JDK 7 if the JDK7 environment variable is not set. This only works on Linux as only it has a single tar.gz version of the JDK available from the Oracle JDK download website.
Doug Simon <doug.simon@oracle.com>
parents: 3722
diff changeset
142 except SystemExit:
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
143 mx.abort('Could not download JDK7 from http://www.oracle.com/technetwork/java/javase/downloads/index.html.\n' +
3730
4e3851bab8d0 Added mechanism for downloading a JDK 7 if the JDK7 environment variable is not set. This only works on Linux as only it has a single tar.gz version of the JDK available from the Oracle JDK download website.
Doug Simon <doug.simon@oracle.com>
parents: 3722
diff changeset
144 'Please do this manually and install it at ' + dst + ' or set the JDK7 environment variable to the install location.')
4e3851bab8d0 Added mechanism for downloading a JDK 7 if the JDK7 environment variable is not set. This only works on Linux as only it has a single tar.gz version of the JDK available from the Oracle JDK download website.
Doug Simon <doug.simon@oracle.com>
parents: 3722
diff changeset
145
4e3851bab8d0 Added mechanism for downloading a JDK 7 if the JDK7 environment variable is not set. This only works on Linux as only it has a single tar.gz version of the JDK available from the Oracle JDK download website.
Doug Simon <doug.simon@oracle.com>
parents: 3722
diff changeset
146
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
147 def _jdk7(build='product', create=False):
3730
4e3851bab8d0 Added mechanism for downloading a JDK 7 if the JDK7 environment variable is not set. This only works on Linux as only it has a single tar.gz version of the JDK available from the Oracle JDK download website.
Doug Simon <doug.simon@oracle.com>
parents: 3722
diff changeset
148 jdk7 = os.environ.get('JDK7')
4e3851bab8d0 Added mechanism for downloading a JDK 7 if the JDK7 environment variable is not set. This only works on Linux as only it has a single tar.gz version of the JDK available from the Oracle JDK download website.
Doug Simon <doug.simon@oracle.com>
parents: 3722
diff changeset
149 if jdk7 is None:
4145
9aee7df31417 Removed 'tests' command.
Doug Simon <doug.simon@oracle.com>
parents: 4144
diff changeset
150 jdk7 = join(_graal_home, 'jdk1.7.0')
3730
4e3851bab8d0 Added mechanism for downloading a JDK 7 if the JDK7 environment variable is not set. This only works on Linux as only it has a single tar.gz version of the JDK available from the Oracle JDK download website.
Doug Simon <doug.simon@oracle.com>
parents: 3722
diff changeset
151 if not exists(jdk7):
4e3851bab8d0 Added mechanism for downloading a JDK 7 if the JDK7 environment variable is not set. This only works on Linux as only it has a single tar.gz version of the JDK available from the Oracle JDK download website.
Doug Simon <doug.simon@oracle.com>
parents: 3722
diff changeset
152 # Try to download it
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
153 if mx.get_os() == 'linux':
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
154 _download_and_extract_targz_jdk7('http://download.oracle.com/otn-pub/java/jdk/7u2-b13/jdk-7u2-linux-x64.tar.gz', jdk7)
3730
4e3851bab8d0 Added mechanism for downloading a JDK 7 if the JDK7 environment variable is not set. This only works on Linux as only it has a single tar.gz version of the JDK available from the Oracle JDK download website.
Doug Simon <doug.simon@oracle.com>
parents: 3722
diff changeset
155 else:
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
156 mx.abort('Download JDK7 from http://www.oracle.com/technetwork/java/javase/downloads/index.html\n' +
3730
4e3851bab8d0 Added mechanism for downloading a JDK 7 if the JDK7 environment variable is not set. This only works on Linux as only it has a single tar.gz version of the JDK available from the Oracle JDK download website.
Doug Simon <doug.simon@oracle.com>
parents: 3722
diff changeset
157 'and install it at ' + jdk7 + ' or set the JDK7 environment variable to the JDK7 install location.')
4e3851bab8d0 Added mechanism for downloading a JDK 7 if the JDK7 environment variable is not set. This only works on Linux as only it has a single tar.gz version of the JDK available from the Oracle JDK download website.
Doug Simon <doug.simon@oracle.com>
parents: 3722
diff changeset
158
3721
71b1204a74b4 Automated creation of debug, fastdebug and optimized subdirectories of the JDK.
Doug Simon <doug.simon@oracle.com>
parents: 3718
diff changeset
159 jre = join(jdk7, 'jre')
71b1204a74b4 Automated creation of debug, fastdebug and optimized subdirectories of the JDK.
Doug Simon <doug.simon@oracle.com>
parents: 3718
diff changeset
160 if not exists(jre) or not isdir(jre):
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
161 mx.abort(jdk7 + ' does not appear to be a valid JDK directory ("jre" sub-directory is missing)')
3721
71b1204a74b4 Automated creation of debug, fastdebug and optimized subdirectories of the JDK.
Doug Simon <doug.simon@oracle.com>
parents: 3718
diff changeset
162
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
163 if build == 'product':
3721
71b1204a74b4 Automated creation of debug, fastdebug and optimized subdirectories of the JDK.
Doug Simon <doug.simon@oracle.com>
parents: 3718
diff changeset
164 return jdk7
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
165 elif build in ['debug', 'fastdebug', 'optimized']:
3721
71b1204a74b4 Automated creation of debug, fastdebug and optimized subdirectories of the JDK.
Doug Simon <doug.simon@oracle.com>
parents: 3718
diff changeset
166 res = join(jdk7, build)
71b1204a74b4 Automated creation of debug, fastdebug and optimized subdirectories of the JDK.
Doug Simon <doug.simon@oracle.com>
parents: 3718
diff changeset
167 if not exists(res):
71b1204a74b4 Automated creation of debug, fastdebug and optimized subdirectories of the JDK.
Doug Simon <doug.simon@oracle.com>
parents: 3718
diff changeset
168 if not create:
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
169 mx.abort('The ' + build + ' VM has not been created - run \'mx clean; mx make ' + build + '\'')
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
170 mx.log('[creating ' + res + '...]')
3721
71b1204a74b4 Automated creation of debug, fastdebug and optimized subdirectories of the JDK.
Doug Simon <doug.simon@oracle.com>
parents: 3718
diff changeset
171 os.mkdir(res)
71b1204a74b4 Automated creation of debug, fastdebug and optimized subdirectories of the JDK.
Doug Simon <doug.simon@oracle.com>
parents: 3718
diff changeset
172 for d in ['jre', 'lib', 'bin', 'include']:
71b1204a74b4 Automated creation of debug, fastdebug and optimized subdirectories of the JDK.
Doug Simon <doug.simon@oracle.com>
parents: 3718
diff changeset
173 shutil.copytree(join(jdk7, d), join(res, d))
71b1204a74b4 Automated creation of debug, fastdebug and optimized subdirectories of the JDK.
Doug Simon <doug.simon@oracle.com>
parents: 3718
diff changeset
174 return res
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
175 else:
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
176 mx.abort('Unknown build type: ' + build)
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
177
4145
9aee7df31417 Removed 'tests' command.
Doug Simon <doug.simon@oracle.com>
parents: 4144
diff changeset
178 def build(args):
9aee7df31417 Removed 'tests' command.
Doug Simon <doug.simon@oracle.com>
parents: 4144
diff changeset
179 """builds the GraalVM binary and compiles the Graal classes
3721
71b1204a74b4 Automated creation of debug, fastdebug and optimized subdirectories of the JDK.
Doug Simon <doug.simon@oracle.com>
parents: 3718
diff changeset
180
3722
7c5524a4e86e Unified the way a specific build of the VM is chosen for any mx command that runs the GraalVM.
Doug Simon <doug.simon@oracle.com>
parents: 3721
diff changeset
181 The optional argument specifies what type of VM to build."""
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
182
4145
9aee7df31417 Removed 'tests' command.
Doug Simon <doug.simon@oracle.com>
parents: 4144
diff changeset
183 mx.build([])
9aee7df31417 Removed 'tests' command.
Doug Simon <doug.simon@oracle.com>
parents: 4144
diff changeset
184
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
185 def fix_jvm_cfg(jdk):
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
186 jvmCfg = join(jdk, 'jre', 'lib', 'amd64', 'jvm.cfg')
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
187 found = False
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
188 if not exists(jvmCfg):
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
189 mx.abort(jvmCfg + ' does not exist')
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
190
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
191 with open(jvmCfg) as f:
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
192 for line in f:
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
193 if '-graal KNOWN' in line:
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
194 found = True
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
195 break
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
196 if not found:
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
197 mx.log('Appending "-graal KNOWN" to ' + jvmCfg)
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
198 with open(jvmCfg, 'a') as f:
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
199 f.write('-graal KNOWN\n')
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
200
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
201 build = 'product' if len(args) == 0 else args[0]
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
202 jdk7 = _jdk7(build, True)
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
203 if build == 'debug':
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
204 build = 'jvmg'
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
205
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
206 fix_jvm_cfg(jdk7)
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
207
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
208 graalVmDir = join(jdk7, 'jre', 'lib', 'amd64', 'graal')
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
209 if not exists(graalVmDir):
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
210 mx.log('Creating Graal directory in JDK7: ' + graalVmDir)
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
211 os.makedirs(graalVmDir)
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
212
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
213 def filterXusage(line):
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
214 if not 'Xusage.txt' in line:
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
215 sys.stderr.write(line + os.linesep)
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
216
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
217 os.environ.update(ARCH_DATA_MODEL='64', LANG='C', HOTSPOT_BUILD_JOBS='3', ALT_BOOTDIR=jdk7, INSTALL='y')
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
218 mx.run([mx.gmake_cmd(), build + 'graal'], cwd=join(_graal_home, 'make'), err=filterXusage)
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
219
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
220 def vm(args, vm='-graal'):
3722
7c5524a4e86e Unified the way a specific build of the VM is chosen for any mx command that runs the GraalVM.
Doug Simon <doug.simon@oracle.com>
parents: 3721
diff changeset
221 """run the GraalVM"""
7c5524a4e86e Unified the way a specific build of the VM is chosen for any mx command that runs the GraalVM.
Doug Simon <doug.simon@oracle.com>
parents: 3721
diff changeset
222
4145
9aee7df31417 Removed 'tests' command.
Doug Simon <doug.simon@oracle.com>
parents: 4144
diff changeset
223 build = _vmbuild
9aee7df31417 Removed 'tests' command.
Doug Simon <doug.simon@oracle.com>
parents: 4144
diff changeset
224 if mx.java().debug:
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
225 args = ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000'] + args
4145
9aee7df31417 Removed 'tests' command.
Doug Simon <doug.simon@oracle.com>
parents: 4144
diff changeset
226 os.environ['GRAAL'] = join(_graal_home, 'graal')
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
227 exe = join(_jdk7(build), 'bin', mx.exe_suffix('java'))
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
228 return mx.run([exe, vm] + args)
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
229
4145
9aee7df31417 Removed 'tests' command.
Doug Simon <doug.simon@oracle.com>
parents: 4144
diff changeset
230 def ideinit(args):
3732
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
231 """(re)generate Eclipse project configurations
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
232
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
233 The exit code of this command reflects how many files were updated."""
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
234
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
235
3732
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
236 def println(out, obj):
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
237 out.write(str(obj) + '\n')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
238
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
239 for p in mx.projects():
3732
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
240 if p.native:
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
241 continue
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
242
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
243 if not exists(p.dir):
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
244 os.makedirs(p.dir)
3732
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
245
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
246 changedFiles = 0
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
247
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
248 out = StringIO.StringIO()
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
249
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
250 println(out, '<?xml version="1.0" encoding="UTF-8"?>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
251 println(out, '<classpath>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
252 for src in p.srcDirs:
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
253 srcDir = join(p.dir, src)
3732
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
254 if not exists(srcDir):
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
255 os.mkdir(srcDir)
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
256 println(out, '\t<classpathentry kind="src" path="' + src + '"/>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
257
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
258 # Every Java program depends on the JRE
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
259 println(out, '\t<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
260
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
261 for dep in p.all_deps([], True):
3732
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
262 if dep == p:
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
263 continue;
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
264
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
265 if dep.isLibrary():
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
266 if hasattr(dep, 'eclipse.container'):
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
267 println(out, '\t<classpathentry exported="true" kind="con" path="' + getattr(dep, 'eclipse.container') + '"/>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
268 elif hasattr(dep, 'eclipse.project'):
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
269 println(out, '\t<classpathentry combineaccessrules="false" exported="true" kind="src" path="/' + getattr(dep, 'eclipse.project') + '"/>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
270 else:
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
271 path = dep.path
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
272 if dep.mustExist:
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
273 if isabs(path):
3732
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
274 println(out, '\t<classpathentry exported="true" kind="lib" path="' + path + '"/>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
275 else:
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
276 println(out, '\t<classpathentry exported="true" kind="lib" path="/' + path + '"/>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
277 else:
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
278 println(out, '\t<classpathentry combineaccessrules="false" exported="true" kind="src" path="/' + dep.name + '"/>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
279
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
280 println(out, '\t<classpathentry kind="output" path="' + getattr(p, 'eclipse.output', 'bin') + '"/>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
281 println(out, '</classpath>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
282
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
283 if mx.update_file(join(p.dir, '.classpath'), out.getvalue()):
3732
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
284 changedFiles += 1
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
285
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
286 out.close()
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
287
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
288 csConfig = join(mx.project(p.checkstyleProj).dir, '.checkstyle_checks.xml')
3732
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
289 if exists(csConfig):
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
290 out = StringIO.StringIO()
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
291
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
292 dotCheckstyle = join(p.dir, ".checkstyle")
3732
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
293 checkstyleConfigPath = '/' + p.checkstyleProj + '/.checkstyle_checks.xml'
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
294 println(out, '<?xml version="1.0" encoding="UTF-8"?>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
295 println(out, '<fileset-config file-format-version="1.2.0" simple-config="true">')
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
296 println(out, '\t<local-check-config name="Graal Checks" location="' + checkstyleConfigPath + '" type="project" description="">')
3732
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
297 println(out, '\t\t<additional-data name="protect-config-file" value="false"/>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
298 println(out, '\t</local-check-config>')
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
299 println(out, '\t<fileset name="all" enabled="true" check-config-name="Graal Checks" local="true">')
3732
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
300 println(out, '\t\t<file-match-pattern match-pattern="." include-pattern="true"/>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
301 println(out, '\t</fileset>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
302 println(out, '\t<filter name="FileTypesFilter" enabled="true">')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
303 println(out, '\t\t<filter-data value="java"/>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
304 println(out, '\t</filter>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
305
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
306 exclude = join(p.dir, '.checkstyle.exclude')
3732
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
307 if exists(exclude):
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
308 println(out, '\t<filter name="FilesFromPackage" enabled="true">')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
309 with open(exclude) as f:
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
310 for line in f:
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
311 if not line.startswith('#'):
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
312 line = line.strip()
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
313 exclDir = join(p.dir, line)
3732
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
314 assert isdir(exclDir), 'excluded source directory listed in ' + exclude + ' does not exist or is not a directory: ' + exclDir
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
315 println(out, '\t\t<filter-data value="' + line + '"/>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
316 println(out, '\t</filter>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
317
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
318 println(out, '</fileset-config>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
319
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
320 if mx.update_file(dotCheckstyle, out.getvalue()):
3732
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
321 changedFiles += 1
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
322
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
323 out.close()
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
324
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
325
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
326 out = StringIO.StringIO()
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
327
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
328 println(out, '<?xml version="1.0" encoding="UTF-8"?>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
329 println(out, '<projectDescription>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
330 println(out, '\t<name>' + p.name + '</name>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
331 println(out, '\t<comment></comment>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
332 println(out, '\t<projects>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
333 println(out, '\t</projects>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
334 println(out, '\t<buildSpec>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
335 println(out, '\t\t<buildCommand>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
336 println(out, '\t\t\t<name>org.eclipse.jdt.core.javabuilder</name>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
337 println(out, '\t\t\t<arguments>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
338 println(out, '\t\t\t</arguments>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
339 println(out, '\t\t</buildCommand>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
340 if exists(csConfig):
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
341 println(out, '\t\t<buildCommand>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
342 println(out, '\t\t\t<name>net.sf.eclipsecs.core.CheckstyleBuilder</name>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
343 println(out, '\t\t\t<arguments>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
344 println(out, '\t\t\t</arguments>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
345 println(out, '\t\t</buildCommand>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
346 println(out, '\t</buildSpec>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
347 println(out, '\t<natures>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
348 println(out, '\t\t<nature>org.eclipse.jdt.core.javanature</nature>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
349 if exists(csConfig):
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
350 println(out, '\t\t<nature>net.sf.eclipsecs.core.CheckstyleNature</nature>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
351 println(out, '\t</natures>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
352 println(out, '</projectDescription>')
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
353
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
354 if mx.update_file(join(p.dir, '.project'), out.getvalue()):
3732
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
355 changedFiles += 1
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
356
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
357 out.close()
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
358
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
359 out = StringIO.StringIO()
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
360
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
361 settingsDir = join(p.dir, ".settings")
3732
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
362 if not exists(settingsDir):
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
363 os.mkdir(settingsDir)
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
364
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
365 myDir = dirname(__file__)
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
366
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
367 with open(join(myDir, 'org.eclipse.jdt.core.prefs')) as f:
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
368 content = f.read()
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
369 if mx.update_file(join(settingsDir, 'org.eclipse.jdt.core.prefs'), content):
3732
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
370 changedFiles += 1
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
371
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
372 with open(join(myDir, 'org.eclipse.jdt.ui.prefs')) as f:
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
373 content = f.read()
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
374 if mx.update_file(join(settingsDir, 'org.eclipse.jdt.ui.prefs'), content):
3732
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
375 changedFiles += 1
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
376
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
377 if changedFiles != 0:
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
378 mx.abort(changedFiles)
3732
3e2e8b8abdaf Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3730
diff changeset
379
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
380 def mx_init():
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
381 _vmbuild = 'product'
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
382 mx.add_argument('--product', action='store_const', dest='vmbuild', const='product', help='select the product VM')
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
383 mx.add_argument('--debug', action='store_const', dest='vmbuild', const='debug', help='select the debug VM')
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
384 mx.add_argument('--fastdebug', action='store_const', dest='vmbuild', const='fastdebug', help='select the fast debug VM')
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
385 mx.add_argument('--optimized', action='store_const', dest='vmbuild', const='optimized', help='select the optimized VM')
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
386 commands = {
4145
9aee7df31417 Removed 'tests' command.
Doug Simon <doug.simon@oracle.com>
parents: 4144
diff changeset
387 'build': [build, '[product|debug|fastdebug|optimized]'],
3722
7c5524a4e86e Unified the way a specific build of the VM is chosen for any mx command that runs the GraalVM.
Doug Simon <doug.simon@oracle.com>
parents: 3721
diff changeset
388 'dacapo': [dacapo, '[benchmark] [VM options]'],
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
389 'example': [example, '[-v] example names...'],
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
390 'clean': [clean, ''],
3722
7c5524a4e86e Unified the way a specific build of the VM is chosen for any mx command that runs the GraalVM.
Doug Simon <doug.simon@oracle.com>
parents: 3721
diff changeset
391 'vm': [vm, '[-options] class [args...]'],
4145
9aee7df31417 Removed 'tests' command.
Doug Simon <doug.simon@oracle.com>
parents: 4144
diff changeset
392 'ideinit': [ideinit, ''],
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
393 }
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
394 mx.commands.update(commands)
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
395
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
396 def mx_post_parse_cmd_line(opts):
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
397 global _vmbuild
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
398 if not opts.vmbuild is None:
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
399 _vmbuild = opts.vmbuild