Mercurial > hg > graal-jvmci-8
comparison mx/commands.py @ 5680:87fc13b59258
Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
In _runInDebugShell, use the platform's encoding for reading from the console
In _runInDebugShell, be able use the return code from the process to check for success, use this for the windows build
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Fri, 22 Jun 2012 11:35:11 +0200 |
parents | 14505f3e6b4c |
children | 9bb0ba9e8ba6 |
comparison
equal
deleted
inserted
replaced
5679:b32dc49bc024 | 5680:87fc13b59258 |
---|---|
284 if len(failed) != 0: | 284 if len(failed) != 0: |
285 mx.abort('Scala DaCapo failures: ' + str(failed)) | 285 mx.abort('Scala DaCapo failures: ' + str(failed)) |
286 | 286 |
287 def _vmLibDirInJdk(jdk): | 287 def _vmLibDirInJdk(jdk): |
288 """ | 288 """ |
289 Get the directory within a JDK where jvm.cfg file and the server | 289 Get the directory within a JDK where the server and client |
290 and client subdirectories are located. | 290 subdirectories are located. |
291 """ | 291 """ |
292 if platform.system() == 'Darwin': | 292 if platform.system() == 'Darwin': |
293 return join(jdk, 'jre', 'lib') | 293 return join(jdk, 'jre', 'lib') |
294 if platform.system() == 'Windows': | |
295 return join(jdk, 'jre', 'bin') | |
294 return join(jdk, 'jre', 'lib', 'amd64') | 296 return join(jdk, 'jre', 'lib', 'amd64') |
297 | |
298 def _vmCfgInJdk(jdk): | |
299 """ | |
300 Get the jvm.cfg file. | |
301 """ | |
302 if platform.system() == 'Windows': | |
303 return join(jdk, 'jre', 'lib', 'amd64', 'jvm.cfg') | |
304 return join(_vmLibDirInJdk(jdk), 'jvm.cfg') | |
295 | 305 |
296 def _jdk(build='product', create=False): | 306 def _jdk(build='product', create=False): |
297 """ | 307 """ |
298 Get the JDK into which Graal is installed, creating it first if necessary. | 308 Get the JDK into which Graal is installed, creating it first if necessary. |
299 """ | 309 """ |
313 mx.abort('Host JDK directory is missing: ' + src) | 323 mx.abort('Host JDK directory is missing: ' + src) |
314 shutil.copytree(src, dst) | 324 shutil.copytree(src, dst) |
315 | 325 |
316 # Make a copy of the default VM so that this JDK can be | 326 # Make a copy of the default VM so that this JDK can be |
317 # reliably used as the bootstrap for a HotSpot build. | 327 # reliably used as the bootstrap for a HotSpot build. |
318 jvmCfg = join(_vmLibDirInJdk(jdk), 'jvm.cfg') | 328 jvmCfg = _vmCfgInJdk(jdk) |
319 if not exists(jvmCfg): | 329 if not exists(jvmCfg): |
320 mx.abort(jvmCfg + ' does not exist') | 330 mx.abort(jvmCfg + ' does not exist') |
321 | 331 |
322 lines = [] | 332 lines = [] |
323 defaultVM = None | 333 defaultVM = None |
362 stdin = p.stdin | 372 stdin = p.stdin |
363 if logFile: | 373 if logFile: |
364 log = open(logFile, 'w') | 374 log = open(logFile, 'w') |
365 ret = False | 375 ret = False |
366 while True: | 376 while True: |
367 line = stdout.readline().decode() | 377 line = stdout.readline().decode(sys.stdout.encoding) |
368 if logFile: | 378 if logFile: |
369 log.write(line) | 379 log.write(line.encode('utf-8')) |
370 line = line.strip() | 380 line = line.strip() |
371 mx.log(line) | 381 mx.log(line) |
372 if line == STARTTOKEN: | 382 if line == STARTTOKEN: |
373 stdin.write('cd /D ' + workingDir + ' & ' + cmd + ' & echo ' + ENDTOKEN + newLine) | 383 stdin.write('cd /D ' + workingDir + ' & ' + cmd + ' & echo ' + ENDTOKEN + newLine) |
374 for regex in respondTo.keys(): | 384 for regex in respondTo.keys(): |
378 if findInOutput: | 388 if findInOutput: |
379 match = findInOutput.search(line) | 389 match = findInOutput.search(line) |
380 if match: | 390 if match: |
381 ret = True | 391 ret = True |
382 if line == ENDTOKEN: | 392 if line == ENDTOKEN: |
383 break | 393 if not findInOutput: |
394 stdin.write('echo ERR%errorlevel%' + newLine) | |
395 else: | |
396 break | |
397 if line.startswith('ERR'): | |
398 if line == 'ERR0': | |
399 ret = True | |
400 break; | |
384 stdin.write('exit' + newLine) | 401 stdin.write('exit' + newLine) |
385 if logFile: | 402 if logFile: |
386 log.close() | 403 log.close() |
387 return ret | 404 return ret |
388 | 405 |
493 winCompileSuccess = re.compile(r"^Writing \.vcxproj file:") | 510 winCompileSuccess = re.compile(r"^Writing \.vcxproj file:") |
494 if not _runInDebugShell(winCompileCmd, _graal_home, compilelogfile, winCompileSuccess): | 511 if not _runInDebugShell(winCompileCmd, _graal_home, compilelogfile, winCompileSuccess): |
495 mx.log('Error executing create command') | 512 mx.log('Error executing create command') |
496 return | 513 return |
497 winBuildCmd = 'msbuild ' + _graal_home + r'\build\vs-amd64\jvm.vcxproj /p:Configuration=' + project_config + ' /p:Platform=x64' | 514 winBuildCmd = 'msbuild ' + _graal_home + r'\build\vs-amd64\jvm.vcxproj /p:Configuration=' + project_config + ' /p:Platform=x64' |
498 winBuildSuccess = re.compile('Build succeeded.') | 515 if not _runInDebugShell(winBuildCmd, _graal_home, compilelogfile): |
499 if not _runInDebugShell(winBuildCmd, _graal_home, compilelogfile, winBuildSuccess): | |
500 mx.log('Error building project') | 516 mx.log('Error building project') |
501 return | 517 return |
502 else: | 518 else: |
503 cpus = multiprocessing.cpu_count() | 519 cpus = multiprocessing.cpu_count() |
504 if build == 'debug': | 520 if build == 'debug': |
514 env.pop('LD_LIBRARY_PATH', None) | 530 env.pop('LD_LIBRARY_PATH', None) |
515 env.pop('CLASSPATH', None) | 531 env.pop('CLASSPATH', None) |
516 | 532 |
517 mx.run([mx.gmake_cmd(), build + buildSuffix], cwd=join(_graal_home, 'make'), err=filterXusage) | 533 mx.run([mx.gmake_cmd(), build + buildSuffix], cwd=join(_graal_home, 'make'), err=filterXusage) |
518 | 534 |
519 jvmCfg = join(_vmLibDirInJdk(jdk), 'jvm.cfg') | 535 jvmCfg = _vmCfgInJdk(jdk) |
520 found = False | 536 found = False |
521 if not exists(jvmCfg): | 537 if not exists(jvmCfg): |
522 mx.abort(jvmCfg + ' does not exist') | 538 mx.abort(jvmCfg + ' does not exist') |
523 | 539 |
524 prefix = '-' + vm | 540 prefix = '-' + vm |