# HG changeset patch # User Doug Simon # Date 1334323568 -7200 # Node ID b9db4fee6eb20e563e13b9155303ba0467113ec1 # Parent cce31bc56c005a40f1fc43b8b579eb6dfc2c62dd skip a native build if all files in src and make are older than the timestamp of the previous build diff -r cce31bc56c00 -r b9db4fee6eb2 mx/commands.py --- a/mx/commands.py Fri Apr 13 11:15:36 2012 +0200 +++ b/mx/commands.py Fri Apr 13 15:26:08 2012 +0200 @@ -91,6 +91,9 @@ 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')) + jdks = join(_graal_home, 'jdk' + mx.java().version) + if exists(jdks): + shutil.rmtree(jdks) def export(args): """create a GraalVM zip file for distribution""" @@ -458,7 +461,28 @@ mx.abort(fp.name + ':' + str(source[:start].count('\n') + 1) + ': add missing projects to declaration:\n ' + '\n '.join(missing)) if len(extra) != 0: mx.abort(fp.name + ':' + str(source[:start].count('\n') + 1) + ': remove projects from declaration:\n ' + '\n '.join(extra)) - + + # Check if a build really needs to be done + timestampFile = join(vmDir, '.build-timestamp') + if opts2.force or not exists(timestampFile): + mustBuild = True + else: + mustBuild = False + timestamp = os.path.getmtime(timestampFile) + sources = [] + for d in ['src', 'make']: + for root, _, files in os.walk(join(_graal_home, d)): + # ignore /src/share/tools + if root != join(_graal_home, 'src', 'share', 'tools'): + sources += [join(root, name) for name in files] + for f in sources: + if len(f) != 0 and os.path.getmtime(f) > timestamp: + mustBuild = True + + if not mustBuild: + mx.log('[all files in src and make directories are older than ' + timestampFile[len(_graal_home) + 1:] + ' - skipping native build]') + continue + if platform.system() == 'Windows': compilelogfile = _graal_home + '/graalCompile.log' mksHome = mx.get_env('MKS_HOME', 'C:\\cygwin\\bin') @@ -516,6 +540,11 @@ for line in lines: f.write(line) + if exists(timestampFile): + os.utime(timestampFile, None) + else: + file(timestampFile, 'a') + def vm(args, vm=None, nonZeroIsFatal=True, out=None, err=None, cwd=None, timeout=None, vmbuild=None): """run the VM selected by the '--vm' option""" diff -r cce31bc56c00 -r b9db4fee6eb2 mxtool/mx.py --- a/mxtool/mx.py Fri Apr 13 11:15:36 2012 +0200 +++ b/mxtool/mx.py Fri Apr 13 15:26:08 2012 +0200 @@ -1041,7 +1041,7 @@ defaultEcjPath = join(_mainSuite.dir, 'mx', 'ecj.jar') 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('-f', action='store_true', dest='force', help='force build (disables timestamp checking)') 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=str(javaCompliance)) parser.add_argument('--Wapi', action='store_true', dest='warnAPI', help='show warnings about using internal APIs')