comparison mx/mx_truffle.py @ 21958:ef8c90391f1e

Removing references to vmSources
author Jaroslav Tulach <jaroslav.tulach@oracle.com>
date Wed, 17 Jun 2015 11:48:30 +0200
parents 04fd8d2361df
children
comparison
equal deleted inserted replaced
21957:04fd8d2361df 21958:ef8c90391f1e
37 import fnmatch 37 import fnmatch
38 38
39 # This works because when mx loads this file, it makes sure __file__ gets an absolute path 39 # This works because when mx loads this file, it makes sure __file__ gets an absolute path
40 _graal_home = dirname(dirname(__file__)) 40 _graal_home = dirname(dirname(__file__))
41 41
42 """ Used to distinguish an exported GraalVM (see 'mx export'). """
43 _vmSourcesAvailable = True
44
45 """ The VM that will be run by the 'vm' command and built by default by the 'build' command. 42 """ The VM that will be run by the 'vm' command and built by default by the 'build' command.
46 This can be set via the global '--vm' option or the DEFAULT_VM environment variable. 43 This can be set via the global '--vm' option or the DEFAULT_VM environment variable.
47 It can also be temporarily set by using of a VM context manager object in a 'with' statement. """ 44 It can also be temporarily set by using of a VM context manager object in a 'with' statement. """
48 _vm = None 45 _vm = None
49
50 """ Prefix for running the VM. """
51 _vm_prefix = None
52 46
53 _make_eclipse_launch = False 47 _make_eclipse_launch = False
54 48
55 _minVersion = mx.VersionSpec('1.7') 49 _minVersion = mx.VersionSpec('1.7')
56 50
699 parser.add_argument('-D', action='append', help='set a HotSpot build variable (run \'mx buildvars\' to list variables)', metavar='name=value') 693 parser.add_argument('-D', action='append', help='set a HotSpot build variable (run \'mx buildvars\' to list variables)', metavar='name=value')
700 694
701 opts2 = mx.build(['--source', '1.7'] + args, parser=parser) 695 opts2 = mx.build(['--source', '1.7'] + args, parser=parser)
702 assert len(opts2.remainder) == 0 696 assert len(opts2.remainder) == 0
703 697
704 if not _vmSourcesAvailable or not opts2.native:
705 return
706
707 if os.environ.get('BUILDING_FROM_IDE', None) == 'true':
708 build = os.environ.get('IDE_BUILD_TARGET', None)
709 if build is None or len(build) == 0:
710 return
711
712 if vm is None:
713 vm = _get_vm()
714
715 def vmg(args): 698 def vmg(args):
716 """run the debug build of VM selected by the '--vm' option""" 699 """run the debug build of VM selected by the '--vm' option"""
717 return vm(args, vmbuild='debug') 700 return vm(args, vmbuild='debug')
718 701
719 def vmfg(args): 702 def vmfg(args):
724 """run the VM selected by the '--vm' option""" 707 """run the VM selected by the '--vm' option"""
725 708
726 jdk = mx.java().jdk 709 jdk = mx.java().jdk
727 mx.expand_project_in_args(args) 710 mx.expand_project_in_args(args)
728 exe = join(jdk, 'bin', mx.exe_suffix('java')) 711 exe = join(jdk, 'bin', mx.exe_suffix('java'))
729 pfx = _vm_prefix.split() if _vm_prefix is not None else [] 712 pfx = []
730 713
731 if '-version' in args: 714 if '-version' in args:
732 ignoredArgs = args[args.index('-version') + 1:] 715 ignoredArgs = args[args.index('-version') + 1:]
733 if len(ignoredArgs) > 0: 716 if len(ignoredArgs) > 0:
734 mx.log("Warning: The following options will be ignored by the vm because they come after the '-version' argument: " + ' '.join(ignoredArgs)) 717 mx.log("Warning: The following options will be ignored by the vm because they come after the '-version' argument: " + ' '.join(ignoredArgs))
1571 'sl' : [sl, '[SL args|@VM options]'], 1554 'sl' : [sl, '[SL args|@VM options]'],
1572 'sldebug' : [sldebug, '[SL args|@VM options]'], 1555 'sldebug' : [sldebug, '[SL args|@VM options]'],
1573 'jol' : [jol, ''], 1556 'jol' : [jol, ''],
1574 } 1557 }
1575 1558
1576 if _vmSourcesAvailable:
1577 mx.add_argument('--ecl', action='store_true', dest='make_eclipse_launch', help='create launch configuration for running VM execution(s) in Eclipse')
1578 mx.add_argument('--vmprefix', action='store', dest='vm_prefix', help='prefix for running the VM (e.g. "/usr/bin/gdb --args")', metavar='<prefix>')
1579 mx.add_argument('--gdb', action='store_const', const='/usr/bin/gdb --args', dest='vm_prefix', help='alias for --vmprefix "/usr/bin/gdb --args"')
1580 mx.add_argument('--lldb', action='store_const', const='lldb --', dest='vm_prefix', help='alias for --vmprefix "lldb --"')
1581
1582 commands.update({
1583 'export': [export, '[-options] [zipfile]'],
1584 })
1585
1586 mx.update_commands(suite, commands) 1559 mx.update_commands(suite, commands)
1587 1560
1588 def mx_post_parse_cmd_line(opts): # 1561 def mx_post_parse_cmd_line(opts): #
1589 # TODO _minVersion check could probably be part of a Suite in mx? 1562 # TODO _minVersion check could probably be part of a Suite in mx?
1590 if mx.java().version < _minVersion: 1563 if mx.java().version < _minVersion:
1591 mx.abort('Requires Java version ' + str(_minVersion) + ' or greater for JAVA_HOME, got version ' + str(mx.java().version)) 1564 mx.abort('Requires Java version ' + str(_minVersion) + ' or greater for JAVA_HOME, got version ' + str(mx.java().version))
1592 if _untilVersion and mx.java().version >= _untilVersion: 1565 if _untilVersion and mx.java().version >= _untilVersion:
1593 mx.abort('Requires Java version strictly before ' + str(_untilVersion) + ' for JAVA_HOME, got version ' + str(mx.java().version)) 1566 mx.abort('Requires Java version strictly before ' + str(_untilVersion) + ' for JAVA_HOME, got version ' + str(mx.java().version))
1594
1595 if _vmSourcesAvailable:
1596 global _make_eclipse_launch
1597 _make_eclipse_launch = getattr(opts, 'make_eclipse_launch', False)
1598 global _vm_prefix
1599 _vm_prefix = opts.vm_prefix
1600 1567
1601 for jdkDist in _jdkDeployedDists: 1568 for jdkDist in _jdkDeployedDists:
1602 def _close(jdkDeployable): 1569 def _close(jdkDeployable):
1603 def _install(dist): 1570 def _install(dist):
1604 assert dist.name == jdkDeployable.name, dist.name + "!=" + jdkDeployable.name 1571 assert dist.name == jdkDeployable.name, dist.name + "!=" + jdkDeployable.name