comparison mx/commands.py @ 5239:b9db4fee6eb2

skip a native build if all files in src and make are older than the timestamp of the previous build
author Doug Simon <doug.simon@oracle.com>
date Fri, 13 Apr 2012 15:26:08 +0200
parents c1e5e3ab546d
children 55ff4ba8d7b1
comparison
equal deleted inserted replaced
5238:cce31bc56c00 5239:b9db4fee6eb2
89 """cleans the GraalVM source tree""" 89 """cleans the GraalVM source tree"""
90 opts = mx.clean(args, parser=ArgumentParser(prog='mx clean')) 90 opts = mx.clean(args, parser=ArgumentParser(prog='mx clean'))
91 if opts.native: 91 if opts.native:
92 os.environ.update(ARCH_DATA_MODEL='64', LANG='C', HOTSPOT_BUILD_JOBS='16') 92 os.environ.update(ARCH_DATA_MODEL='64', LANG='C', HOTSPOT_BUILD_JOBS='16')
93 mx.run([mx.gmake_cmd(), 'clean'], cwd=join(_graal_home, 'make')) 93 mx.run([mx.gmake_cmd(), 'clean'], cwd=join(_graal_home, 'make'))
94 jdks = join(_graal_home, 'jdk' + mx.java().version)
95 if exists(jdks):
96 shutil.rmtree(jdks)
94 97
95 def export(args): 98 def export(args):
96 """create a GraalVM zip file for distribution""" 99 """create a GraalVM zip file for distribution"""
97 100
98 parser = ArgumentParser(prog='mx export'); 101 parser = ArgumentParser(prog='mx export');
456 extra = actual - expected 459 extra = actual - expected
457 if len(missing) != 0: 460 if len(missing) != 0:
458 mx.abort(fp.name + ':' + str(source[:start].count('\n') + 1) + ': add missing projects to declaration:\n ' + '\n '.join(missing)) 461 mx.abort(fp.name + ':' + str(source[:start].count('\n') + 1) + ': add missing projects to declaration:\n ' + '\n '.join(missing))
459 if len(extra) != 0: 462 if len(extra) != 0:
460 mx.abort(fp.name + ':' + str(source[:start].count('\n') + 1) + ': remove projects from declaration:\n ' + '\n '.join(extra)) 463 mx.abort(fp.name + ':' + str(source[:start].count('\n') + 1) + ': remove projects from declaration:\n ' + '\n '.join(extra))
461 464
465 # Check if a build really needs to be done
466 timestampFile = join(vmDir, '.build-timestamp')
467 if opts2.force or not exists(timestampFile):
468 mustBuild = True
469 else:
470 mustBuild = False
471 timestamp = os.path.getmtime(timestampFile)
472 sources = []
473 for d in ['src', 'make']:
474 for root, _, files in os.walk(join(_graal_home, d)):
475 # ignore <graal>/src/share/tools
476 if root != join(_graal_home, 'src', 'share', 'tools'):
477 sources += [join(root, name) for name in files]
478 for f in sources:
479 if len(f) != 0 and os.path.getmtime(f) > timestamp:
480 mustBuild = True
481
482 if not mustBuild:
483 mx.log('[all files in src and make directories are older than ' + timestampFile[len(_graal_home) + 1:] + ' - skipping native build]')
484 continue
485
462 if platform.system() == 'Windows': 486 if platform.system() == 'Windows':
463 compilelogfile = _graal_home + '/graalCompile.log' 487 compilelogfile = _graal_home + '/graalCompile.log'
464 mksHome = mx.get_env('MKS_HOME', 'C:\\cygwin\\bin') 488 mksHome = mx.get_env('MKS_HOME', 'C:\\cygwin\\bin')
465 489
466 variant = {'client': 'compiler1', 'server': 'compiler2'}.get(vm, vm) 490 variant = {'client': 'compiler1', 'server': 'compiler2'}.get(vm, vm)
513 mx.log('Appending "' + prefix + ' KNOWN" to ' + jvmCfg) 537 mx.log('Appending "' + prefix + ' KNOWN" to ' + jvmCfg)
514 lines.append(vmKnown) 538 lines.append(vmKnown)
515 with open(jvmCfg, 'w') as f: 539 with open(jvmCfg, 'w') as f:
516 for line in lines: 540 for line in lines:
517 f.write(line) 541 f.write(line)
542
543 if exists(timestampFile):
544 os.utime(timestampFile, None)
545 else:
546 file(timestampFile, 'a')
518 547
519 def vm(args, vm=None, nonZeroIsFatal=True, out=None, err=None, cwd=None, timeout=None, vmbuild=None): 548 def vm(args, vm=None, nonZeroIsFatal=True, out=None, err=None, cwd=None, timeout=None, vmbuild=None):
520 """run the VM selected by the '--vm' option""" 549 """run the VM selected by the '--vm' option"""
521 550
522 if vm is None: 551 if vm is None: