comparison mx/commands.py @ 9983:13384d19fec0

Merge
author Christos Kotselidis <christos.kotselidis@oracle.com>
date Tue, 11 Jun 2013 00:00:40 +0200
parents 2194b25ff111
children 893bc1dbb58c
comparison
equal deleted inserted replaced
9982:06e176eff527 9983:13384d19fec0
230 230
231 def _arch(): 231 def _arch():
232 machine = platform.uname()[4] 232 machine = platform.uname()[4]
233 if machine in ['amd64', 'AMD64', 'x86_64', 'i86pc']: 233 if machine in ['amd64', 'AMD64', 'x86_64', 'i86pc']:
234 return 'amd64' 234 return 'amd64'
235 if machine in ['sun4v']:
236 return 'sparc'
235 if machine == 'i386' and mx.get_os() == 'darwin': 237 if machine == 'i386' and mx.get_os() == 'darwin':
236 try: 238 try:
237 # Support for Snow Leopard and earlier version of MacOSX 239 # Support for Snow Leopard and earlier version of MacOSX
238 if subprocess.check_output(['sysctl', '-n', 'hw.cpu64bit_capable']).strip() == '1': 240 if subprocess.check_output(['sysctl', '-n', 'hw.cpu64bit_capable']).strip() == '1':
239 return 'amd64' 241 return 'amd64'
341 343
342 return jdk 344 return jdk
343 345
344 def _installGraalJarInJdks(graalDist): 346 def _installGraalJarInJdks(graalDist):
345 graalJar = graalDist.path 347 graalJar = graalDist.path
348 graalOptions = join(_graal_home, 'graal.options')
346 jdks = join(_graal_home, 'jdk' + str(mx.java().version)) 349 jdks = join(_graal_home, 'jdk' + str(mx.java().version))
347 if exists(jdks): 350 if exists(jdks):
348 for e in os.listdir(jdks): 351 for e in os.listdir(jdks):
349 jreLibDir = join(jdks, e, 'jre', 'lib') 352 jreLibDir = join(jdks, e, 'jre', 'lib')
350 if exists(jreLibDir): 353 if exists(jreLibDir):
351 # do a copy and then a move to get atomic updating (on Unix) of graal.jar in the JRE 354 # do a copy and then a move to get atomic updating (on Unix) of graal.jar in the JRE
352 fd, tmp = tempfile.mkstemp(suffix='', prefix='graal.jar', dir=jreLibDir) 355 fd, tmp = tempfile.mkstemp(suffix='', prefix='graal.jar', dir=jreLibDir)
353 shutil.copyfile(graalJar, tmp) 356 shutil.copyfile(graalJar, tmp)
354 os.close(fd) 357 os.close(fd)
355 shutil.move(tmp, join(jreLibDir, 'graal.jar')) 358 shutil.move(tmp, join(jreLibDir, 'graal.jar'))
359
360 if exists(graalOptions):
361 shutil.copy(graalOptions, join(jreLibDir, 'graal.options'))
356 362
357 # run a command in the windows SDK Debug Shell 363 # run a command in the windows SDK Debug Shell
358 def _runInDebugShell(cmd, workingDir, logFile=None, findInOutput=None, respondTo={}): 364 def _runInDebugShell(cmd, workingDir, logFile=None, findInOutput=None, respondTo={}):
359 newLine = os.linesep 365 newLine = os.linesep
360 STARTTOKEN = 'RUNINDEBUGSHELL_STARTSEQUENCE' 366 STARTTOKEN = 'RUNINDEBUGSHELL_STARTSEQUENCE'
456 out.element('property', {'name' : 'src.dir', 'value' : '${gamma.dir}/graal'}) 462 out.element('property', {'name' : 'src.dir', 'value' : '${gamma.dir}/graal'})
457 out.element('property', {'name' : 'classes.dir', 'value' : '${shared.dir}/graal'}) 463 out.element('property', {'name' : 'classes.dir', 'value' : '${shared.dir}/graal'})
458 out.element('property', {'name' : 'jar.dir', 'value' : '${shared.dir}'}) 464 out.element('property', {'name' : 'jar.dir', 'value' : '${shared.dir}'})
459 out.element('property', {'name' : 'jar.file', 'value' : '${jar.dir}/graal.jar'}) 465 out.element('property', {'name' : 'jar.file', 'value' : '${jar.dir}/graal.jar'})
460 466
461 out.element('target', {'name' : 'main', 'depends' : 'jar'}) 467 out.element('target', {'name' : 'main', 'depends' : 'options,jar'})
462 468
463 serviceMap = {}; 469 serviceMap = {};
464 def addService(service, provider): 470 def addService(service, provider):
465 if service not in serviceMap: 471 if service not in serviceMap:
466 serviceMap[service] = set(); 472 serviceMap[service] = set();
511 517
512 out.open('target', {'name' : 'cleanclasses'}) 518 out.open('target', {'name' : 'cleanclasses'})
513 out.element('delete', {'dir' : '${classes.dir}'}) 519 out.element('delete', {'dir' : '${classes.dir}'})
514 out.close('target') 520 out.close('target')
515 521
522 out.open('target', {'name' : 'options', 'if' : 'graal.options.exists'})
523 out.open('copy', {'todir' : '${jar.dir}'})
524 out.element('filelist', {'dir' : '${gamma.dir}', 'files' : 'graal.options'})
525 out.close('copy')
526 out.close('target')
527
528 out.open('target', {'name' : 'check-graal-options-exists'})
529 out.element('available', {'property' : 'graal.options.exists', 'file' : '${gamma.dir}/graal.options'})
530 out.close('target')
531
516 out.open('target', {'name' : 'clean', 'depends' : 'cleanclasses'}) 532 out.open('target', {'name' : 'clean', 'depends' : 'cleanclasses'})
517 out.element('delete', {'file' : '${jar.file}'}) 533 out.element('delete', {'file' : '${jar.file}'})
518 out.close('target') 534 out.close('target')
519 535
520 out.close('project') 536 out.close('project')