# HG changeset patch # User Doug Simon # Date 1325765835 -3600 # Node ID e03ff10d4bfcf50c6eb60d4eb850bb8e305fae26 # Parent 339cf8d4904dd166427044613b791e31a15bf250 Made the gate clean the Java projects only. diff -r 339cf8d4904d -r e03ff10d4bfc mx/commands.py --- a/mx/commands.py Thu Jan 05 11:31:46 2012 +0100 +++ b/mx/commands.py Thu Jan 05 13:17:15 2012 +0100 @@ -40,9 +40,10 @@ def clean(args): """cleans the GraalVM source tree""" - mx.clean(args) - os.environ.update(ARCH_DATA_MODEL='64', LANG='C', HOTSPOT_BUILD_JOBS='16') - mx.run([mx.gmake_cmd(), 'clean'], cwd=join(_graal_home, 'make')) + opts = mx.clean(args) + if opts.native: + os.environ.update(ARCH_DATA_MODEL='64', LANG='C', HOTSPOT_BUILD_JOBS='16') + mx.run([mx.gmake_cmd(), 'clean'], cwd=join(_graal_home, 'make')) def copyrightcheck(args): """run copyright check on the Mercurial controlled source files""" @@ -270,16 +271,16 @@ def build(args): """builds the GraalVM binary and compiles the Graal classes - The optional argument specifies what type of VM to build.""" + The optional last argument specifies what type of VM to build.""" build = 'product' if len(args) != 0 and not args[0].startswith('-'): build = args.pop(0) # Call mx.build to compile the Java sources - mx.build(args + ['--source', '1.7']) + opts = mx.build(args + ['--source', '1.7']) - if not _vmSourcesAvailable: + if not _vmSourcesAvailable or not opts.native: return jdk = _jdk(build, True) @@ -521,8 +522,8 @@ start = time.time() - # 1. Clean - # clean([]) + # 1. Clean (cleaning of native code disabled as gate machine takes too long to do a clean HotSpot build) + clean(['--no-native']) # 2. Checkstyle mx.log(time.strftime('%d %b %Y %H:%M:%S - Running Checkstyle...')) @@ -585,7 +586,7 @@ def mx_init(): _vmbuild = 'product' commands = { - 'build': [build, ''], + 'build': [build, '[-options]'], 'clean': [clean, ''], 'copyrightcheck': [copyrightcheck, ''], 'dacapo': [dacapo, '[benchmark] [VM options|DaCapo options]'], @@ -605,7 +606,7 @@ commands.update({ 'export': [export, '[-options] [zipfile]'], - 'build': [build, '[product|debug|fastdebug|optimized]'] + 'build': [build, '[-options] [product|debug|fastdebug|optimized]'] }) mx.commands.update(commands) diff -r 339cf8d4904d -r e03ff10d4bfc mxtool/mx.py --- a/mxtool/mx.py Thu Jan 05 11:31:46 2012 +0100 +++ b/mxtool/mx.py Thu Jan 05 13:17:15 2012 +0100 @@ -787,17 +787,18 @@ # Builtin commands -def build(args): +def build(args, parser=None): """compile the Java and C sources, linking the latter Compile all the Java source code using the appropriate compilers and linkers for the various source code types.""" - parser = ArgumentParser(prog='mx build'); + parser = parser if parser is not None else ArgumentParser(prog='mx build'); parser.add_argument('-f', action='store_true', dest='force', help='force compilation even if class files are up to date') parser.add_argument('-c', action='store_true', dest='clean', help='removes existing build output') parser.add_argument('--source', dest='compliance', help='Java compliance level', default='1.6') parser.add_argument('--Wapi', action='store_true', dest='warnAPI', help='show warnings about using internal APIs') + parser.add_argument('--no-java', action='store_false', dest='java', help='do not build Java projects') parser.add_argument('--no-native', action='store_false', dest='native', help='do not build native projects') parser.add_argument('--jdt', help='Eclipse installation or path to ecj.jar for using the Eclipse batch compiler instead of javac', metavar='') @@ -817,14 +818,19 @@ for p in sorted_deps(): if p.native: - log('Calling GNU make {0}...'.format(p.dir)) + if args.native: + log('Calling GNU make {0}...'.format(p.dir)) + + if args.clean: + run([gmake_cmd(), 'clean'], cwd=p.dir) + + run([gmake_cmd()], cwd=p.dir) + built.add(p.name) + continue + else: + if not args.java: + continue - if args.clean: - run([gmake_cmd(), 'clean'], cwd=p.dir) - - run([gmake_cmd()], cwd=p.dir) - built.add(p.name) - continue outputDir = p.output_dir() if exists(outputDir): @@ -915,6 +921,7 @@ dst = join(outputDir, name[len(sourceDir) + 1:]) if exists(dirname(dst)): shutil.copyfile(name, dst) + return args def canonicalizeprojects(args): """process all project files to canonicalize the dependencies @@ -1056,21 +1063,30 @@ os.unlink(auditfileName) return 0 -def clean(args): +def clean(args, parser=None): """remove all class files, images, and executables Removes all files created by a build, including Java class files, executables, and generated images. """ + parser = parser if parser is not None else ArgumentParser(prog='mx build'); + parser.add_argument('--no-native', action='store_false', dest='native', help='do not clean native projects') + parser.add_argument('--no-java', action='store_false', dest='java', help='do not clean Java projects') + + args = parser.parse_args(args) + for p in projects(): if p.native: - run([gmake_cmd(), '-C', p.dir, 'clean']) + if args.native: + run([gmake_cmd(), '-C', p.dir, 'clean']) else: - outputDir = p.output_dir() - if outputDir != '' and exists(outputDir): - log('Removing {0}...'.format(outputDir)) - shutil.rmtree(outputDir) + if args.java: + outputDir = p.output_dir() + if outputDir != '' and exists(outputDir): + log('Removing {0}...'.format(outputDir)) + shutil.rmtree(outputDir) + return args def help_(args): """show help for a given command @@ -1138,8 +1154,8 @@ # used in the call to str.format(). # Extensions should update this table directly commands = { - 'build': [build, '[options] projects...'], - 'checkstyle': [checkstyle, 'projects...'], + 'build': [build, '[options]'], + 'checkstyle': [checkstyle, ''], 'canonicalizeprojects': [canonicalizeprojects, ''], 'clean': [clean, ''], 'help': [help_, '[command]'],