comparison mx/commands.py @ 4184:fa6b78681c54

Added copyright check to the gate.
author Doug Simon <doug.simon@oracle.com>
date Tue, 03 Jan 2012 12:37:31 +0100
parents d1b26c17910a
children 4af146831ed6
comparison
equal deleted inserted replaced
4183:9e0c1b4cfef5 4184:fa6b78681c54
40 def clean(args): 40 def clean(args):
41 """cleans the GraalVM source tree""" 41 """cleans the GraalVM source tree"""
42 mx.clean(args) 42 mx.clean(args)
43 os.environ.update(ARCH_DATA_MODEL='64', LANG='C', HOTSPOT_BUILD_JOBS='16') 43 os.environ.update(ARCH_DATA_MODEL='64', LANG='C', HOTSPOT_BUILD_JOBS='16')
44 mx.run([mx.gmake_cmd(), 'clean'], cwd=join(_graal_home, 'make')) 44 mx.run([mx.gmake_cmd(), 'clean'], cwd=join(_graal_home, 'make'))
45
46 def copyrightcheck(args):
47 """run copyright check on the Mercurial controlled source files"""
48 mx.run_java(['-cp', mx.classpath('com.oracle.max.base', resolve=False), 'com.sun.max.tools.CheckCopyright', '-cfp=' + join(mx.project('com.oracle.max.base').dir, '.copyright.regex')] + args)
45 49
46 def export(args): 50 def export(args):
47 """create a GraalVM zip file for distribution""" 51 """create a GraalVM zip file for distribution"""
48 52
49 parser = ArgumentParser(prog='mx export'); 53 parser = ArgumentParser(prog='mx export');
543 547
544 # 4. Build 548 # 4. Build
545 mx.log(time.strftime('%d %b %Y %H:%M:%S - Build...')) 549 mx.log(time.strftime('%d %b %Y %H:%M:%S - Build...'))
546 build([]) 550 build([])
547 551
548 # 5. Bootstrap with system assertions enabled 552 # 5 Copyright check
553 mx.log(time.strftime('%d %b %Y %H:%M:%S - Running copyright check...'))
554 hgNode = mx.get_env('hg_node')
555 if hgNode is None:
556 copyrightcheck(['-modified', '-reporterrors=true', '-continueonerror'])
557 else:
558 revTip = int(subprocess.check_output(['hg', 'tip', '--template', "'{rev}'"]).strip("'"))
559 revLast = int(subprocess.check_output(['hg', 'log', '-r', hgNode, '--template', "'{rev}'"]).strip("'"))
560 changesetCount = revTip - revLast + 1
561 copyrightcheck(['-last=' + str(changesetCount), '-reporterrors=true', '-continueonerror'])
562
563 # 6. Bootstrap with system assertions enabled
549 mx.log(time.strftime('%d %b %Y %H:%M:%S - Bootstrap with -esa...')) 564 mx.log(time.strftime('%d %b %Y %H:%M:%S - Bootstrap with -esa...'))
550 vm(['-esa', '-version']) 565 vm(['-esa', '-version'])
551 566
552 # 6. Run unittests 567 # 7. Run unittests
553 mx.log(time.strftime('%d %b %Y %H:%M:%S - Running unit tests...')) 568 mx.log(time.strftime('%d %b %Y %H:%M:%S - Running unit tests...'))
554 unittest([]) 569 unittest([])
555 570
556 # 7. Run selected DaCapo benchmarks 571 # 8. Run selected DaCapo benchmarks
557 mx.log(time.strftime('%d %b %Y %H:%M:%S - Running DaCapo benchmarks...')) 572 mx.log(time.strftime('%d %b %Y %H:%M:%S - Running DaCapo benchmarks...'))
558 dacapo(['eclipse']) 573 dacapo(['eclipse'])
559 #dacapo(['tradesoap']) 574 #dacapo(['tradesoap'])
560 dacapo(['batik']) 575 dacapo(['batik'])
561 dacapo(['avrora']) 576 dacapo(['avrora'])
567 def mx_init(): 582 def mx_init():
568 _vmbuild = 'product' 583 _vmbuild = 'product'
569 commands = { 584 commands = {
570 'build': [build, ''], 585 'build': [build, ''],
571 'clean': [clean, ''], 586 'clean': [clean, ''],
587 'copyrightcheck': [copyrightcheck, ''],
572 'dacapo': [dacapo, '[benchmark] [VM options|DaCapo options]'], 588 'dacapo': [dacapo, '[benchmark] [VM options|DaCapo options]'],
573 'example': [example, '[-v] example names...'], 589 'example': [example, '[-v] example names...'],
574 'gate' : [gate, ''], 590 'gate' : [gate, ''],
575 'unittest' : [unittest, '[filters...]'], 591 'unittest' : [unittest, '[filters...]'],
576 'vm': [vm, '[-options] class [args...]'], 592 'vm': [vm, '[-options] class [args...]'],