Mercurial > hg > graal-jvmci-8
comparison mx.graal/mx_graal.py @ 22019:07cfd3d7072b
removed _vmSourcesAvailable
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 17 Jun 2015 15:31:28 +0200 |
parents | 11ed27b2abe8 |
children | 36a7ec14279d |
comparison
equal
deleted
inserted
replaced
22018:11ed27b2abe8 | 22019:07cfd3d7072b |
---|---|
39 import mx_graal_makefile | 39 import mx_graal_makefile |
40 | 40 |
41 _suite = mx.suite('graal') | 41 _suite = mx.suite('graal') |
42 _graal_home = _suite.dir | 42 _graal_home = _suite.dir |
43 | 43 |
44 """ Used to distinguish an exported GraalVM (see 'mx export'). """ | |
45 _vmSourcesAvailable = exists(join(_graal_home, 'make')) and exists(join(_graal_home, 'src')) | |
46 | |
47 """ The VMs that can be built and run along with an optional description. Only VMs with a | 44 """ The VMs that can be built and run along with an optional description. Only VMs with a |
48 description are listed in the dialogue for setting the default VM (see _get_vm()). """ | 45 description are listed in the dialogue for setting the default VM (see _get_vm()). """ |
49 _vmChoices = { | 46 _vmChoices = { |
50 'jvmci' : 'Normal compilation is performed with a tiered system (C1 + Graal), Truffle compilation is performed with Graal.', | 47 'jvmci' : 'Normal compilation is performed with a tiered system (C1 + Graal), Truffle compilation is performed with Graal.', |
51 'server' : 'Normal compilation is performed with a tiered system (C1 + C2), Truffle compilation is performed with Graal. Use this for optimal Truffle performance.', | 48 'server' : 'Normal compilation is performed with a tiered system (C1 + C2), Truffle compilation is performed with Graal. Use this for optimal Truffle performance.', |
412 def _jdk(build=None, vmToCheck=None, create=False, installJars=True): | 409 def _jdk(build=None, vmToCheck=None, create=False, installJars=True): |
413 """ | 410 """ |
414 Get the JDK into which Graal is installed, creating it first if necessary. | 411 Get the JDK into which Graal is installed, creating it first if necessary. |
415 """ | 412 """ |
416 if not build: | 413 if not build: |
417 build = _vmbuild if _vmSourcesAvailable else 'product' | 414 build = _vmbuild |
418 jdk = join(_jdksDir(), build) | 415 jdk = join(_jdksDir(), build) |
419 if create: | 416 if create: |
420 srcJdk = mx.java().jdk | 417 srcJdk = mx.java().jdk |
421 if not exists(jdk): | 418 if not exists(jdk): |
422 mx.log('Creating ' + jdk + ' from ' + srcJdk) | 419 mx.log('Creating ' + jdk + ' from ' + srcJdk) |
819 parser.add_argument('-D', action='append', help='set a HotSpot build variable (run \'mx buildvars\' to list variables)', metavar='name=value') | 816 parser.add_argument('-D', action='append', help='set a HotSpot build variable (run \'mx buildvars\' to list variables)', metavar='name=value') |
820 | 817 |
821 opts2 = mx.build(['--source', '1.7'] + args, parser=parser) | 818 opts2 = mx.build(['--source', '1.7'] + args, parser=parser) |
822 assert len(opts2.remainder) == 0 | 819 assert len(opts2.remainder) == 0 |
823 | 820 |
824 if not _vmSourcesAvailable or not opts2.native: | 821 if not opts2.native: |
825 return | 822 return |
826 | 823 |
827 builds = [_vmbuild] | 824 builds = [_vmbuild] |
828 | 825 |
829 if os.environ.get('BUILDING_FROM_IDE', None) == 'true': | 826 if os.environ.get('BUILDING_FROM_IDE', None) == 'true': |
1057 if cwd is None: | 1054 if cwd is None: |
1058 cwd = _vm_cwd | 1055 cwd = _vm_cwd |
1059 elif _vm_cwd is not None and _vm_cwd != cwd: | 1056 elif _vm_cwd is not None and _vm_cwd != cwd: |
1060 mx.abort("conflicting working directories: do not set --vmcwd for this command") | 1057 mx.abort("conflicting working directories: do not set --vmcwd for this command") |
1061 | 1058 |
1062 build = vmbuild if vmbuild else _vmbuild if _vmSourcesAvailable else 'product' | 1059 build = vmbuild if vmbuild else _vmbuild |
1063 jdk = _jdk(build, vmToCheck=vm, installJars=False) | 1060 jdk = _jdk(build, vmToCheck=vm, installJars=False) |
1064 _updateInstalledJVMCIOptionsFile(jdk) | 1061 _updateInstalledJVMCIOptionsFile(jdk) |
1065 mx.expand_project_in_args(args) | 1062 mx.expand_project_in_args(args) |
1066 if _make_eclipse_launch: | 1063 if _make_eclipse_launch: |
1067 mx.make_eclipse_launch(_suite, args, 'graal-' + build, name=None, deps=mx.project('com.oracle.graal.hotspot').all_deps([], True)) | 1064 mx.make_eclipse_launch(_suite, args, 'graal-' + build, name=None, deps=mx.project('com.oracle.graal.hotspot').all_deps([], True)) |
2565 'buildvms': [buildvms, '[-options]'], | 2562 'buildvms': [buildvms, '[-options]'], |
2566 'c1visualizer' : [c1visualizer, ''], | 2563 'c1visualizer' : [c1visualizer, ''], |
2567 'checkheaders': [checkheaders, ''], | 2564 'checkheaders': [checkheaders, ''], |
2568 'clean': [clean, ''], | 2565 'clean': [clean, ''], |
2569 'ctw': [ctw, '[-vmoptions|noinline|nocomplex|full]'], | 2566 'ctw': [ctw, '[-vmoptions|noinline|nocomplex|full]'], |
2567 'export': [export, '[-options] [zipfile]'], | |
2570 'findbugs': [findbugs, ''], | 2568 'findbugs': [findbugs, ''], |
2571 'generateZshCompletion' : [generateZshCompletion, ''], | 2569 'generateZshCompletion' : [generateZshCompletion, ''], |
2572 'hsdis': [hsdis, '[att]'], | 2570 'hsdis': [hsdis, '[att]'], |
2573 'hcfdis': [hcfdis, ''], | 2571 'hcfdis': [hcfdis, ''], |
2574 'igv' : [igv, ''], | 2572 'igv' : [igv, ''], |
2603 mx.add_argument('--vmcwd', dest='vm_cwd', help='current directory will be changed to <path> before the VM is executed', default=None, metavar='<path>') | 2601 mx.add_argument('--vmcwd', dest='vm_cwd', help='current directory will be changed to <path> before the VM is executed', default=None, metavar='<path>') |
2604 mx.add_argument('--installed-jdks', help='the base directory in which the JDKs cloned from $JAVA_HOME exist. ' + | 2602 mx.add_argument('--installed-jdks', help='the base directory in which the JDKs cloned from $JAVA_HOME exist. ' + |
2605 'The VM selected by --vm and --vmbuild options is under this directory (i.e., ' + | 2603 'The VM selected by --vm and --vmbuild options is under this directory (i.e., ' + |
2606 join('<path>', '<jdk-version>', '<vmbuild>', 'jre', 'lib', '<vm>', mx.add_lib_prefix(mx.add_lib_suffix('jvm'))) + ')', default=None, metavar='<path>') | 2604 join('<path>', '<jdk-version>', '<vmbuild>', 'jre', 'lib', '<vm>', mx.add_lib_prefix(mx.add_lib_suffix('jvm'))) + ')', default=None, metavar='<path>') |
2607 | 2605 |
2608 if _vmSourcesAvailable: | 2606 mx.add_argument('--vm', action='store', dest='vm', choices=_vmChoices.keys(), help='the VM type to build/run') |
2609 mx.add_argument('--vm', action='store', dest='vm', choices=_vmChoices.keys(), help='the VM type to build/run') | 2607 mx.add_argument('--vmbuild', action='store', dest='vmbuild', choices=_vmbuildChoices, help='the VM build to build/run (default: ' + _vmbuildChoices[0] + ')') |
2610 mx.add_argument('--vmbuild', action='store', dest='vmbuild', choices=_vmbuildChoices, help='the VM build to build/run (default: ' + _vmbuildChoices[0] + ')') | 2608 mx.add_argument('--ecl', action='store_true', dest='make_eclipse_launch', help='create launch configuration for running VM execution(s) in Eclipse') |
2611 mx.add_argument('--ecl', action='store_true', dest='make_eclipse_launch', help='create launch configuration for running VM execution(s) in Eclipse') | 2609 mx.add_argument('--vmprefix', action='store', dest='vm_prefix', help='prefix for running the VM (e.g. "/usr/bin/gdb --args")', metavar='<prefix>') |
2612 mx.add_argument('--vmprefix', action='store', dest='vm_prefix', help='prefix for running the VM (e.g. "/usr/bin/gdb --args")', metavar='<prefix>') | 2610 mx.add_argument('--gdb', action='store_const', const='/usr/bin/gdb --args', dest='vm_prefix', help='alias for --vmprefix "/usr/bin/gdb --args"') |
2613 mx.add_argument('--gdb', action='store_const', const='/usr/bin/gdb --args', dest='vm_prefix', help='alias for --vmprefix "/usr/bin/gdb --args"') | 2611 mx.add_argument('--lldb', action='store_const', const='lldb --', dest='vm_prefix', help='alias for --vmprefix "lldb --"') |
2614 mx.add_argument('--lldb', action='store_const', const='lldb --', dest='vm_prefix', help='alias for --vmprefix "lldb --"') | |
2615 | |
2616 commands.update({ | |
2617 'export': [export, '[-options] [zipfile]'], | |
2618 }) | |
2619 | 2612 |
2620 mx.update_commands(suite, commands) | 2613 mx.update_commands(suite, commands) |
2621 | 2614 |
2622 def mx_post_parse_cmd_line(opts): # | 2615 def mx_post_parse_cmd_line(opts): # |
2623 # TODO _minVersion check could probably be part of a Suite in mx? | 2616 # TODO _minVersion check could probably be part of a Suite in mx? |
2626 versionDesc = ">=" + str(_minVersion) | 2619 versionDesc = ">=" + str(_minVersion) |
2627 if _untilVersion: | 2620 if _untilVersion: |
2628 versionDesc += " and <=" + str(_untilVersion) | 2621 versionDesc += " and <=" + str(_untilVersion) |
2629 mx.java(_versionCheck, versionDescription=versionDesc, defaultJdk=True) | 2622 mx.java(_versionCheck, versionDescription=versionDesc, defaultJdk=True) |
2630 | 2623 |
2631 if _vmSourcesAvailable: | 2624 if hasattr(opts, 'vm') and opts.vm is not None: |
2632 if hasattr(opts, 'vm') and opts.vm is not None: | 2625 global _vm |
2633 global _vm | 2626 _vm = opts.vm |
2634 _vm = opts.vm | 2627 _vm = _vm.replace('graal', 'jvmci') |
2635 _vm = _vm.replace('graal', 'jvmci') | 2628 if hasattr(opts, 'vmbuild') and opts.vmbuild is not None: |
2636 if hasattr(opts, 'vmbuild') and opts.vmbuild is not None: | 2629 global _vmbuild |
2637 global _vmbuild | 2630 _vmbuild = opts.vmbuild |
2638 _vmbuild = opts.vmbuild | 2631 global _make_eclipse_launch |
2639 global _make_eclipse_launch | 2632 _make_eclipse_launch = getattr(opts, 'make_eclipse_launch', False) |
2640 _make_eclipse_launch = getattr(opts, 'make_eclipse_launch', False) | |
2641 global _jacoco | 2633 global _jacoco |
2642 _jacoco = opts.jacoco | 2634 _jacoco = opts.jacoco |
2643 global _vm_cwd | 2635 global _vm_cwd |
2644 _vm_cwd = opts.vm_cwd | 2636 _vm_cwd = opts.vm_cwd |
2645 global _installed_jdks | 2637 global _installed_jdks |