comparison mx/commands.py @ 4276:f8f262212aa4

Modified 'mx build' to update graal_paths.hpp (if necessary).
author Doug Simon <doug.simon@oracle.com>
date Thu, 12 Jan 2012 16:08:41 +0100
parents ffd5ce8fc736
children 063ea022532c
comparison
equal deleted inserted replaced
4275:afe0c2480dfd 4276:f8f262212aa4
24 # or visit www.oracle.com if you need additional information or have any 24 # or visit www.oracle.com if you need additional information or have any
25 # questions. 25 # questions.
26 # 26 #
27 # ---------------------------------------------------------------------------------------------------- 27 # ----------------------------------------------------------------------------------------------------
28 28
29 import os, sys, shutil, zipfile, tempfile, re, time, datetime, platform, subprocess 29 import os, sys, shutil, zipfile, tempfile, re, time, datetime, platform, subprocess, StringIO
30 from os.path import join, exists, dirname, basename 30 from os.path import join, exists, dirname, basename
31 from argparse import ArgumentParser, REMAINDER 31 from argparse import ArgumentParser, REMAINDER
32 import mx 32 import mx
33 import sanitycheck 33 import sanitycheck
34 34
35 _graal_home = dirname(dirname(__file__)) 35 _graal_home = dirname(dirname(__file__))
36 _vmSourcesAvailable = exists(join(_graal_home, 'make')) and exists(join(_graal_home, 'src')) 36 _vmSourcesAvailable = exists(join(_graal_home, 'make')) and exists(join(_graal_home, 'src'))
37 _vmbuild = 'product' 37 _vmbuild = 'product'
38
39 _copyrightTemplate = """/*
40 * Copyright (c) {0}, Oracle and/or its affiliates. All rights reserved.
41 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
42 *
43 * This code is free software; you can redistribute it and/or modify it
44 * under the terms of the GNU General Public License version 2 only, as
45 * published by the Free Software Foundation.
46 *
47 * This code is distributed in the hope that it will be useful, but WITHOUT
48 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
49 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
50 * version 2 for more details (a copy is included in the LICENSE file that
51 * accompanied this code).
52 *
53 * You should have received a copy of the GNU General Public License version
54 * 2 along with this work; if not, write to the Free Software Foundation,
55 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
56 *
57 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
58 * or visit www.oracle.com if you need additional information or have any
59 * questions.
60 */
61
62 """
38 63
39 def clean(args): 64 def clean(args):
40 """cleans the GraalVM source tree""" 65 """cleans the GraalVM source tree"""
41 opts = mx.clean(args, parser=ArgumentParser(prog='mx clean')) 66 opts = mx.clean(args, parser=ArgumentParser(prog='mx clean'))
42 if opts.native: 67 if opts.native:
302 327
303 def filterXusage(line): 328 def filterXusage(line):
304 if not 'Xusage.txt' in line: 329 if not 'Xusage.txt' in line:
305 sys.stderr.write(line + os.linesep) 330 sys.stderr.write(line + os.linesep)
306 331
332 # Update graal_paths.hpp
333 out = StringIO.StringIO()
334 out.write(_copyrightTemplate.format(time.strftime('%Y')))
335 for p in mx.project('com.oracle.max.graal.hotspot').all_deps([], False):
336 out.write(' prepend_to_graal_classpath(scp_compiler, graal_dir, "' + p.name + '");\n')
337 graalPaths = join(_graal_home, 'src', 'share', 'vm', 'graal', 'graal_paths.hpp')
338 assert exists(graalPaths), 'File does not exist: ' + graalPaths
339 mx.update_file(graalPaths, out.getvalue())
340 out.close()
341
307 if platform.system() == 'Windows': 342 if platform.system() == 'Windows':
308 compilelogfile = _graal_home + '/graalCompile.log' 343 compilelogfile = _graal_home + '/graalCompile.log'
309 mksHome = mx.get_env('MKS_HOME', 'C:\\cygwin\\bin') 344 mksHome = mx.get_env('MKS_HOME', 'C:\\cygwin\\bin')
310 345
311 _runInDebugShell('msbuild ' + _graal_home + r'\build\vs-amd64\jvm.vcproj /p:Configuration=compiler1_product /target:clean', _graal_home) 346 _runInDebugShell('msbuild ' + _graal_home + r'\build\vs-amd64\jvm.vcproj /p:Configuration=compiler1_product /target:clean', _graal_home)