def _fetch_jdk(self, jdk_distribution, paths): if not self._mx_path: self._mx_path = mx.get_jdk().home mx._opts.quiet = True tmp_dir = tempfile.gettempdir() _, repo_path = VC.get_vc_root(paths[0]) common_location = os.path.join(repo_path, 'common.json') fetch_args = [ '--to', tmp_dir, '--java-distribution', jdk_distribution, '--configuration', common_location ] JdkDistribution._jdk_distributions = [] args = mx_fetchjdk._parse_fetchsettings(fetch_args) distribution = args["java-distribution"] base_path = args["base-path"] jdk_home = distribution.get_final_path(base_path) if mx.is_darwin(): jdk_home = os.join(jdk_home, 'Contents', 'Home') if jdk_home != self._jdk_home: try: mx_fetchjdk.fetch_jdk(fetch_args) self._jdk_home = jdk_home os.environ['JAVA_HOME'] = jdk_home except (OSError, IOError) as err: mx.log(str(err)) self._jdk_home = mx.get_jdk().home mx._opts.quiet = False
def _clone(self): self.clean_tmp_files() current_path = os.getcwd() git, repo_path = VC.get_vc_root(os.getcwd()) relative_path = current_path[len(repo_path) + 1:] git_url = git.default_pull(os.getcwd()) repo_name = git_url[git_url.rfind('/') + 1:git_url.rfind('.')] repo_dist = os.path.join(self._tmp_dir, repo_name) git._clone(git_url, repo_dist) return repo_name, relative_path
def buildSvmImage(args): """build a shared SubstrateVM library to run Graal.nodejs""" with _import_substratevm() as _svm: _svm.flag_suitename_map['nodejs'] = ('graal-nodejs', ['TRUFFLENODE'], ['TRUFFLENODE_NATIVE'], 'js') _js_version = VC.get_vc(_suite.vc_dir).parent(_suite.vc_dir) mx.logv('Fetch JS version {}'.format(_js_version)) for _lang in ['js', 'nodejs']: _svm.fetch_languages(['--language:{}=version={}'.format(_lang, _js_version)]) with _svm.native_image_context() as _native_image: _native_image(['--language:nodejs', '-H:JNIConfigurationFiles={}'.format(join(_suite.dir, 'svmnodejs.jniconfig'))] + args)
def buildSvmImage(args): """build a shared SubstrateVM library to run Graal.nodejs""" _svm = _import_substratevm() _svm.flag_suitename_map['nodejs'] = ('graal-nodejs', ['TRUFFLENODE'], ['TRUFFLENODE_GRAALVM_SUPPORT'], 'js') _js_version = VC.get_vc(_suite.vc_dir).parent(_suite.vc_dir) mx.logv('Fetch JS version {}'.format(_js_version)) for _lang in ['js', 'nodejs']: _svm.fetch_languages(['--language:{}=version={}'.format(_lang, _js_version)]) _svm.fetch_languages(['--tool:regex']) with _svm.native_image_context() as _native_image: _native_image(['--language:nodejs', '-H:JNIConfigurationResources=svmnodejs.jniconfig'] + args)
def buildSvmImage(args): """build a shared SubstrateVM library to run Graal.nodejs""" _svm = _import_substratevm() _svm.flag_suitename_map['nodejs'] = ('graal-nodejs', ['TRUFFLENODE'], ['TRUFFLENODE_GRAALVM_SUPPORT'], 'js') _js_version = VC.get_vc(_suite.vc_dir).parent(_suite.vc_dir) mx.logv('Fetch JS version {}'.format(_js_version)) for _lang in ['js', 'nodejs']: _svm.truffle_language_ensure(_lang, _js_version) _svm.native_image_on_jvm([ '-H:+EnforceMaxRuntimeCompileMethods', '--language:nodejs', '-H:JNIConfigurationResources=svmnodejs.jniconfig' ] + args)
def _fetch_jdk(self, jdk_id, paths): if not self._mx_path: self._mx_path = mx.get_jdk().home old_quiet = mx._opts.quiet mx._opts.quiet = True _, repo_path = VC.get_vc_root(paths[0]) try: # Change directory so that fetch-jdk finds common.json and jdk-binaries.json in repo_path old_cwd = os.getcwd() os.chdir(repo_path) jdk_home = mx_fetchjdk.fetch_jdk( ['--to', tempfile.gettempdir(), '--jdk-id', jdk_id, '']) self._jdk_home = jdk_home os.environ['JAVA_HOME'] = jdk_home except (OSError, IOError) as err: mx.log(str(err)) self._jdk_home = mx.get_jdk().home finally: os.chdir(old_cwd) mx._opts.quiet = old_quiet
def _get_build_dir(self, path): _, repo_path = VC.get_vc_root(path) build_dir = os.path.dirname(repo_path) return build_dir