Mercurial > hg > truffle
comparison mx/mx_graal.py @ 16622:faaea970b951
Add an mx install command to install the Truffle jars to the local Maven repository.
author | Chris Seaton <chris.seaton@oracle.com> |
---|---|
date | Wed, 30 Jul 2014 13:42:10 +0200 |
parents | 202d86545bba |
children | addc0564e5b5 |
comparison
equal
deleted
inserted
replaced
16621:202d86545bba | 16622:faaea970b951 |
---|---|
629 mx.log(textwrap.fill(buildVars[n], initial_indent=' ', subsequent_indent=' ', width=200)) | 629 mx.log(textwrap.fill(buildVars[n], initial_indent=' ', subsequent_indent=' ', width=200)) |
630 | 630 |
631 mx.log('') | 631 mx.log('') |
632 mx.log('Note that these variables can be given persistent values in the file ' + join(_graal_home, 'mx', 'env') + ' (see \'mx about\').') | 632 mx.log('Note that these variables can be given persistent values in the file ' + join(_graal_home, 'mx', 'env') + ' (see \'mx about\').') |
633 | 633 |
634 cached_graal_version = None | |
635 | |
636 def graal_version(dev_suffix='dev'): | |
637 global cached_graal_version | |
638 | |
639 if not cached_graal_version: | |
640 # extract latest release tag for graal | |
641 try: | |
642 tags = [x.split() for x in subprocess.check_output(['hg', '-R', _graal_home, 'tags']).split('\n') if x.startswith("graal-")] | |
643 current_revision = subprocess.check_output(['hg', '-R', _graal_home, 'id', '-i']).strip() | |
644 except: | |
645 # not a mercurial repository or hg commands are not available. | |
646 tags = None | |
647 | |
648 if tags and current_revision: | |
649 sorted_tags = sorted(tags, key=lambda e: [int(x) for x in e[0][len("graal-"):].split('.')], reverse=True) | |
650 most_recent_tag_name, most_recent_tag_revision = sorted_tags[0] | |
651 most_recent_tag_version = most_recent_tag_name[len("graal-"):] | |
652 | |
653 if current_revision == most_recent_tag_revision: | |
654 cached_graal_version = most_recent_tag_version | |
655 else: | |
656 major, minor = map(int, most_recent_tag_version.split('.')) | |
657 cached_graal_version = str(major) + '.' + str(minor + 1) + '-' + dev_suffix | |
658 else: | |
659 cached_graal_version = 'unknown-{}-{}'.format(platform.node(), time.strftime('%Y-%m-%d_%H-%M-%S_%Z')) | |
660 | |
661 return cached_graal_version | |
662 | |
634 def build(args, vm=None): | 663 def build(args, vm=None): |
635 """build the VM binary | 664 """build the VM binary |
636 | 665 |
637 The global '--vm' and '--vmbuild' options select which VM type and build target to build.""" | 666 The global '--vm' and '--vmbuild' options select which VM type and build target to build.""" |
638 | 667 |
789 setMakeVar('MAKE_VERBOSE', 'y' if mx._opts.verbose else '') | 818 setMakeVar('MAKE_VERBOSE', 'y' if mx._opts.verbose else '') |
790 if vm.endswith('nograal'): | 819 if vm.endswith('nograal'): |
791 setMakeVar('INCLUDE_GRAAL', 'false') | 820 setMakeVar('INCLUDE_GRAAL', 'false') |
792 setMakeVar('ALT_OUTPUTDIR', join(_graal_home, 'build-nograal', mx.get_os()), env=env) | 821 setMakeVar('ALT_OUTPUTDIR', join(_graal_home, 'build-nograal', mx.get_os()), env=env) |
793 else: | 822 else: |
794 # extract latest release tag for graal | 823 version = graal_version() |
795 try: | 824 setMakeVar('USER_RELEASE_SUFFIX', 'graal-' + version) |
796 tags = [x.split() for x in subprocess.check_output(['hg', '-R', _graal_home, 'tags']).split('\n') if x.startswith("graal-")] | 825 setMakeVar('GRAAL_VERSION', version) |
797 current_revision = subprocess.check_output(['hg', '-R', _graal_home, 'id', '-i']).strip() | |
798 except: | |
799 # not a mercurial repository or hg commands are not available. | |
800 tags = None | |
801 | |
802 if tags and current_revision: | |
803 sorted_tags = sorted(tags, key=lambda e: [int(x) for x in e[0][len("graal-"):].split('.')], reverse=True) | |
804 most_recent_tag_name, most_recent_tag_revision = sorted_tags[0] | |
805 most_recent_tag_version = most_recent_tag_name[len("graal-"):] | |
806 | |
807 if current_revision == most_recent_tag_revision: | |
808 version = most_recent_tag_version | |
809 else: | |
810 major, minor = map(int, most_recent_tag_version.split('.')) | |
811 version = str(major) + '.' + str(minor + 1) + '-dev' | |
812 | |
813 setMakeVar('USER_RELEASE_SUFFIX', 'graal-' + version) | |
814 setMakeVar('GRAAL_VERSION', version) | |
815 else: | |
816 version = 'unknown-{}-{}'.format(platform.node(), time.strftime('%Y-%m-%d_%H-%M-%S_%Z')) | |
817 setMakeVar('USER_RELEASE_SUFFIX', 'graal-' + version) | |
818 setMakeVar('GRAAL_VERSION', version) | |
819 setMakeVar('INCLUDE_GRAAL', 'true') | 826 setMakeVar('INCLUDE_GRAAL', 'true') |
820 setMakeVar('INSTALL', 'y', env=env) | 827 setMakeVar('INSTALL', 'y', env=env) |
821 if mx.get_os() == 'solaris': | 828 if mx.get_os() == 'solaris': |
822 # If using sparcWorks, setup flags to avoid make complaining about CC version | 829 # If using sparcWorks, setup flags to avoid make complaining about CC version |
823 cCompilerVersion = subprocess.Popen('CC -V', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True).stderr.readlines()[0] | 830 cCompilerVersion = subprocess.Popen('CC -V', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True).stderr.readlines()[0] |
1494 | 1501 |
1495 if not exists(nbplatform): | 1502 if not exists(nbplatform): |
1496 mx.logv('[This execution may take a while as the NetBeans platform needs to be downloaded]') | 1503 mx.logv('[This execution may take a while as the NetBeans platform needs to be downloaded]') |
1497 mx.run(['ant', '-f', join(_graal_home, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'build.xml'), '-l', fp.name, 'run'], env=env) | 1504 mx.run(['ant', '-f', join(_graal_home, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'build.xml'), '-l', fp.name, 'run'], env=env) |
1498 | 1505 |
1506 def install(args): | |
1507 """install Truffle into your local Maven repository""" | |
1508 mx.archive(["@TRUFFLE"]) | |
1509 mx.run(['mvn', 'install:install-file', '-DgroupId=com.oracle', '-DartifactId=truffle', '-Dversion=' + graal_version('SNAPSHOT'), '-Dpackaging=jar', '-Dfile=truffle.jar']) | |
1510 mx.run(['mvn', 'install:install-file', '-DgroupId=com.oracle', '-DartifactId=truffle-dsl-processor', '-Dversion=' + graal_version('SNAPSHOT'), '-Dpackaging=jar', '-Dfile=truffle-dsl-processor.jar']) | |
1511 | |
1499 def c1visualizer(args): | 1512 def c1visualizer(args): |
1500 """run the Cl Compiler Visualizer""" | 1513 """run the Cl Compiler Visualizer""" |
1501 libpath = join(_graal_home, 'lib') | 1514 libpath = join(_graal_home, 'lib') |
1502 if mx.get_os() == 'windows': | 1515 if mx.get_os() == 'windows': |
1503 executable = join(libpath, 'c1visualizer', 'bin', 'c1visualizer.exe') | 1516 executable = join(libpath, 'c1visualizer', 'bin', 'c1visualizer.exe') |
2153 'findbugs': [findbugs, ''], | 2166 'findbugs': [findbugs, ''], |
2154 'generateZshCompletion' : [generateZshCompletion, ''], | 2167 'generateZshCompletion' : [generateZshCompletion, ''], |
2155 'hsdis': [hsdis, '[att]'], | 2168 'hsdis': [hsdis, '[att]'], |
2156 'hcfdis': [hcfdis, ''], | 2169 'hcfdis': [hcfdis, ''], |
2157 'igv' : [igv, ''], | 2170 'igv' : [igv, ''], |
2171 'install' : [install, ''], | |
2158 'jdkhome': [print_jdkhome, ''], | 2172 'jdkhome': [print_jdkhome, ''], |
2159 'jmh': [jmh, '[VM options] [filters|JMH-args-as-json...]'], | 2173 'jmh': [jmh, '[VM options] [filters|JMH-args-as-json...]'], |
2160 'dacapo': [dacapo, '[VM options] benchmarks...|"all" [DaCapo options]'], | 2174 'dacapo': [dacapo, '[VM options] benchmarks...|"all" [DaCapo options]'], |
2161 'scaladacapo': [scaladacapo, '[VM options] benchmarks...|"all" [Scala DaCapo options]'], | 2175 'scaladacapo': [scaladacapo, '[VM options] benchmarks...|"all" [Scala DaCapo options]'], |
2162 'specjvm2008': [specjvm2008, '[VM options] benchmarks...|"all" [SPECjvm2008 options]'], | 2176 'specjvm2008': [specjvm2008, '[VM options] benchmarks...|"all" [SPECjvm2008 options]'], |