comparison mx/commands.py @ 8302:b246434a3e4a

made build-graal.xml be generated by mx
author Doug Simon <doug.simon@oracle.com>
date Fri, 15 Mar 2013 18:09:19 +0100
parents 2237260c6fdb
children 3d515bfc1677
comparison
equal deleted inserted replaced
8291:950cc0d8bc7c 8302:b246434a3e4a
49 _jacoco = 'off' 49 _jacoco = 'off'
50 50
51 _native_dbg = None 51 _native_dbg = None
52 52
53 _make_eclipse_launch = False 53 _make_eclipse_launch = False
54
55 _copyrightTemplate = """/*
56 * Copyright (c) {0}, Oracle and/or its affiliates. All rights reserved.
57 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
58 *
59 * This code is free software; you can redistribute it and/or modify it
60 * under the terms of the GNU General Public License version 2 only, as
61 * published by the Free Software Foundation.
62 *
63 * This code is distributed in the hope that it will be useful, but WITHOUT
64 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
65 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
66 * version 2 for more details (a copy is included in the LICENSE file that
67 * accompanied this code).
68 *
69 * You should have received a copy of the GNU General Public License version
70 * 2 along with this work; if not, write to the Free Software Foundation,
71 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
72 *
73 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
74 * or visit www.oracle.com if you need additional information or have any
75 * questions.
76 */
77
78 """
79 54
80 _minVersion = mx.JavaVersion('1.7.0_04') 55 _minVersion = mx.JavaVersion('1.7.0_04')
81 56
82 def _chmodDir(chmodFlags, dirname, fnames): 57 def _chmodDir(chmodFlags, dirname, fnames):
83 os.chmod(dirname, chmodFlags) 58 os.chmod(dirname, chmodFlags)
460 """print the JDK directory selected for the 'vm' command""" 435 """print the JDK directory selected for the 'vm' command"""
461 436
462 build = _vmbuild if _vmSourcesAvailable else 'product' 437 build = _vmbuild if _vmSourcesAvailable else 'product'
463 print join(_graal_home, 'jdk' + str(mx.java().version), build) 438 print join(_graal_home, 'jdk' + str(mx.java().version), build)
464 439
440 def initantbuild(args):
441 """(re)generates an ant build file for producing graal.jar"""
442 parser=ArgumentParser(prog='mx initantbuild')
443 parser.add_argument('-f', '--buildfile', help='file to generate', default=join(_graal_home, 'make', 'build-graal.xml'))
444
445 args = parser.parse_args(args)
446
447 out = mx.XMLDoc()
448
449 out.comment("""
450 Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
451 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
452
453 This code is free software; you can redistribute it and/or modify it
454 under the terms of the GNU General Public License version 2 only, as
455 published by the Free Software Foundation. Oracle designates this
456 particular file as subject to the "Classpath" exception as provided
457 by Oracle in the LICENSE file that accompanied this code.
458
459 This code is distributed in the hope that it will be useful, but WITHOUT
460 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
461 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
462 version 2 for more details (a copy is included in the LICENSE file that
463 accompanied this code).
464
465 You should have received a copy of the GNU General Public License version
466 2 along with this work; if not, write to the Free Software Foundation,
467 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
468
469 Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
470 or visit www.oracle.com if you need additional information or have any
471 questions.
472 """)
473
474 out.open('project', {'name' : 'graal', 'default' : 'main', 'basedir' : '.'})
475 out.element('property', {'name' : 'src.dir', 'value' : '${gamma.dir}/graal'})
476 out.element('property', {'name' : 'classes.dir', 'value' : '${shared.dir}/graal'})
477 out.element('property', {'name' : 'jar.dir', 'value' : '${shared.dir}'})
478 out.element('property', {'name' : 'jar.file', 'value' : '${jar.dir}/graal.jar'})
479
480 out.element('target', {'name' : 'main', 'depends' : 'jar'})
481
482 out.open('target', {'name' : 'compile'})
483 out.element('mkdir', {'dir' : '${classes.dir}'})
484 out.open('javac', {'destdir' : '${classes.dir}', 'debug' : 'on', 'includeantruntime' : 'false', })
485 for p in mx.sorted_deps(mx.distribution('GRAAL').deps):
486 out.element('src', {'path' : '${src.dir}/' + p.name})
487 out.element('compilerarg', {'value' : '-XDignore.symbol.file'})
488 out.close('javac')
489 out.close('target')
490
491 out.open('target', {'name' : 'jar', 'depends' : 'compile'})
492 out.element('mkdir', {'dir' : '${jar.dir}'})
493 out.element('jar', {'destfile' : '${jar.file}', 'basedir' : '${classes.dir}'})
494 out.close('target')
495
496 out.open('target', {'name' : 'clean'})
497 out.element('delete', {'dir' : '${classes.dir}'})
498 out.element('delete', {'file' : '${jar.filr}'})
499 out.close('target')
500
501 out.close('project')
502
503 mx.update_file(args.buildfile, out.xml(indent=' ', newl='\n'))
504
465 def build(args, vm=None): 505 def build(args, vm=None):
466 """build the VM binary 506 """build the VM binary
467 507
468 The global '--vm' option selects which VM to build. This command also 508 The global '--vm' option selects which VM to build. This command also
469 compiles the Graal classes irrespective of what VM is being built. 509 compiles the Graal classes irrespective of what VM is being built.
488 elif vm == 'client': 528 elif vm == 'client':
489 buildSuffix = '1' 529 buildSuffix = '1'
490 else: 530 else:
491 assert vm == 'graal', vm 531 assert vm == 'graal', vm
492 buildSuffix = 'graal' 532 buildSuffix = 'graal'
533
534 initantbuild([])
493 535
494 for build in builds: 536 for build in builds:
495 if build == 'ide-build-target': 537 if build == 'ide-build-target':
496 build = os.environ.get('IDE_BUILD_TARGET', 'product') 538 build = os.environ.get('IDE_BUILD_TARGET', 'product')
497 if len(build) == 0: 539 if len(build) == 0:
1130 'build': [build, '[-options]'], 1172 'build': [build, '[-options]'],
1131 'buildvms': [buildvms, '[-options]'], 1173 'buildvms': [buildvms, '[-options]'],
1132 'clean': [clean, ''], 1174 'clean': [clean, ''],
1133 'hsdis': [hsdis, '[att]'], 1175 'hsdis': [hsdis, '[att]'],
1134 'hcfdis': [hcfdis, ''], 1176 'hcfdis': [hcfdis, ''],
1177 'initantbuild' : [initantbuild, '[-options]'],
1135 'igv' : [igv, ''], 1178 'igv' : [igv, ''],
1136 'jdkhome': [jdkhome, ''], 1179 'jdkhome': [jdkhome, ''],
1137 'dacapo': [dacapo, '[[n] benchmark] [VM options|@DaCapo options]'], 1180 'dacapo': [dacapo, '[[n] benchmark] [VM options|@DaCapo options]'],
1138 'scaladacapo': [scaladacapo, '[[n] benchmark] [VM options|@Scala DaCapo options]'], 1181 'scaladacapo': [scaladacapo, '[[n] benchmark] [VM options|@Scala DaCapo options]'],
1139 'specjvm2008': [specjvm2008, '[VM options|specjvm2008 options (-v, -ikv, -ict, -wt, -it)]'], 1182 'specjvm2008': [specjvm2008, '[VM options|specjvm2008 options (-v, -ikv, -ict, -wt, -it)]'],