comparison mx/mx_graal.py @ 21791:cd36556e1b78

Remove conditional makefile-based compilation of jvmci from mx_graal.py
author Stefan Anzinger <stefan.anzinger@oracle.com>
date Mon, 08 Jun 2015 14:25:25 +0200
parents 6db6070d30b9
children 1c22030625eb
comparison
equal deleted inserted replaced
21790:6db6070d30b9 21791:cd36556e1b78
836 def build(args, vm=None): 836 def build(args, vm=None):
837 """build the VM binary 837 """build the VM binary
838 838
839 The global '--vm' and '--vmbuild' options select which VM type and build target to build.""" 839 The global '--vm' and '--vmbuild' options select which VM type and build target to build."""
840 840
841 # Turn all jdk distributions into non HotSpot; this is only necessary as long we support building/exporting JVMCI with make and mx
842 if "--avoid-make" not in args:
843 for jdkDist in _jdkDeployedDists:
844 if jdkDist.partOfHotSpot:
845 jdkDist.partOfHotSpot = False
846
847 # Override to fail quickly if extra arguments are given 841 # Override to fail quickly if extra arguments are given
848 # at the end of the command line. This allows for a more 842 # at the end of the command line. This allows for a more
849 # helpful error message. 843 # helpful error message.
850 class AP(ArgumentParser): 844 class AP(ArgumentParser):
851 def __init__(self): 845 def __init__(self):
858 ' mx --vmbuild ' + firstBuildTarget + ' build') 852 ' mx --vmbuild ' + firstBuildTarget + ' build')
859 return result 853 return result
860 854
861 # Call mx.build to compile the Java sources 855 # Call mx.build to compile the Java sources
862 parser = AP() 856 parser = AP()
863 parser.add_argument('--export-dir', help='directory to which JVMCI and Graal jars and jvmci.options will be copied', metavar='<path>')
864 parser.add_argument('-D', action='append', help='set a HotSpot build variable (run \'mx buildvars\' to list variables)', metavar='name=value') 857 parser.add_argument('-D', action='append', help='set a HotSpot build variable (run \'mx buildvars\' to list variables)', metavar='name=value')
865 parser.add_argument('--avoid-make', action='store_true', help='Do not use jvmci.make file to build and export JVMCI') 858
866 opts2 = mx.build(['--source', '1.7'] + args, parser=parser) 859 opts2 = mx.build(['--source', '1.7'] + args, parser=parser)
867 assert len(opts2.remainder) == 0 860 assert len(opts2.remainder) == 0
868
869 if opts2.export_dir is not None:
870 if not exists(opts2.export_dir):
871 os.makedirs(opts2.export_dir)
872 else:
873 assert os.path.isdir(opts2.export_dir), '{0} is not a directory'.format(opts2.export_dir)
874
875 defsPath = join(_graal_home, 'make', 'defs.make')
876 with open(defsPath) as fp:
877 defs = fp.read()
878 jvmciJars = []
879 jdkJars = []
880 for jdkDist in _jdkDeployedDists:
881 dist = mx.distribution(jdkDist.name)
882 jdkJars.append(join(_graal_home, dist.path))
883 defLine = 'EXPORT_LIST += $(EXPORT_JRE_LIB_DIR)/' + basename(dist.path)
884 if jdkDist.isExtension:
885 defLine = 'EXPORT_LIST += $(EXPORT_JRE_LIB_EXT_DIR)/' + basename(dist.path)
886 elif jdkDist.usesJVMCIClassLoader:
887 defLine = 'EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_DIR)/' + basename(dist.path)
888 jvmciJars.append(dist.path)
889 else:
890 defLine = 'EXPORT_LIST += $(EXPORT_JRE_LIB_DIR)/' + basename(dist.path)
891 if defLine not in defs:
892 mx.abort('Missing following line in ' + defsPath + '\n' + defLine)
893 shutil.copy(dist.path, opts2.export_dir)
894
895 services, optionsFiles = _extractJVMCIFiles(jdkJars, jvmciJars, join(opts2.export_dir, 'services'), join(opts2.export_dir, 'options'))
896 if opts2.avoid_make:
897 for service in services:
898 defLine = 'EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)/' + service
899 if defLine not in defs:
900 mx.abort('Missing following line in ' + defsPath + ' for service from ' + dist.name + '\n' + defLine)
901 for optionsFile in optionsFiles:
902 defLine = 'EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/' + optionsFile
903 if defLine not in defs:
904 mx.abort('Missing following line in ' + defsPath + ' for options from ' + dist.name + '\n' + defLine)
905 jvmciOptions = join(_graal_home, 'jvmci.options')
906 if exists(jvmciOptions):
907 shutil.copy(jvmciOptions, opts2.export_dir)
908 861
909 if not _vmSourcesAvailable or not opts2.native: 862 if not _vmSourcesAvailable or not opts2.native:
910 return 863 return
911 864
912 builds = [_vmbuild] 865 builds = [_vmbuild]
1052 if build == 'jvmg': 1005 if build == 'jvmg':
1053 # We want ALL the symbols when debugging on Solaris 1006 # We want ALL the symbols when debugging on Solaris
1054 setMakeVar('STRIP_POLICY', 'no_strip') 1007 setMakeVar('STRIP_POLICY', 'no_strip')
1055 # This removes the need to unzip the *.diz files before debugging in gdb 1008 # This removes the need to unzip the *.diz files before debugging in gdb
1056 setMakeVar('ZIP_DEBUGINFO_FILES', '0', env=env) 1009 setMakeVar('ZIP_DEBUGINFO_FILES', '0', env=env)
1057 if not opts2.avoid_make: 1010
1058 setMakeVar('JVMCI_USE_MAKE', '1') 1011 if buildSuffix == "1":
1012 setMakeVar("JVM_VARIANTS", "client")
1013 elif buildSuffix == "":
1014 setMakeVar("JVM_VARIANTS", "server")
1015
1059 # Clear this variable as having it set can cause very confusing build problems 1016 # Clear this variable as having it set can cause very confusing build problems
1060 env.pop('CLASSPATH', None) 1017 env.pop('CLASSPATH', None)
1061 1018
1062 # Issue an env prefix that can be used to run the make on the command line 1019 # Issue an env prefix that can be used to run the make on the command line
1063 if not mx._opts.verbose: 1020 if not mx._opts.verbose:
1064 mx.log('--------------- make command line ----------------------') 1021 mx.log('--------------- make command line ----------------------')
1065 1022
1066 envPrefix = ' '.join([key + '=' + env[key] for key in env.iterkeys() if not os.environ.has_key(key) or env[key] != os.environ[key]]) 1023 envPrefix = ' '.join([key + '=' + env[key] for key in env.iterkeys() if not os.environ.has_key(key) or env[key] != os.environ[key]])
1067 if len(envPrefix): 1024 if len(envPrefix):
1068 mx.log('env ' + envPrefix + ' \\') 1025 mx.log('env ' + envPrefix + ' \\')
1069 makeTarget = "all_" + build + buildSuffix if not opts2.avoid_make else build + buildSuffix 1026
1070 runCmd.append(makeTarget) 1027 runCmd.append(build + buildSuffix)
1028 runCmd.append("docs")
1029 runCmd.append("export_" + build)
1071 1030
1072 if not mx._opts.verbose: 1031 if not mx._opts.verbose:
1073 mx.log(' '.join(runCmd)) 1032 mx.log(' '.join(runCmd))
1074 mx.log('--------------------------------------------------------') 1033 mx.log('--------------------------------------------------------')
1075 mx.run(runCmd, err=filterXusage, env=env) 1034 mx.run(runCmd, err=filterXusage, env=env)