Mercurial > hg > truffle
diff mxtool/mx.py @ 8185:3bbdf34536bc
Merge.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Sun, 10 Mar 2013 19:51:32 +0100 |
parents | 4b11a0983557 |
children | 3c74a32bb262 |
line wrap: on
line diff
--- a/mxtool/mx.py Sun Mar 10 19:51:18 2013 +0100 +++ b/mxtool/mx.py Sun Mar 10 19:51:32 2013 +0100 @@ -1651,7 +1651,8 @@ if name.startswith('@'): dname = name[1:] d = distribution(dname) - zf = zipfile.ZipFile(d.path, 'w') + fd, tmp = tempfile.mkstemp(suffix='', prefix=basename(d.path) + '.', dir=dirname(d.path)) + zf = zipfile.ZipFile(tmp, 'w') for p in sorted_deps(d.deps): outputDir = p.output_dir() for root, _, files in os.walk(outputDir): @@ -1660,19 +1661,26 @@ arcname = join(relpath, f).replace(os.sep, '/') zf.write(join(root, f), arcname) zf.close() + os.close(fd) + # Atomic on Unix + shutil.move(tmp, d.path) + #print time.time(), 'move:', tmp, '->', d.path d.notify_updated() else: p = project(name) outputDir = p.output_dir() - jar = join(p.dir, p.name + '.jar') - zf = zipfile.ZipFile(jar, 'w') + fd, tmp = tempfile.mkstemp(suffix='', prefix=p.name, dir=p.dir) + zf = zipfile.ZipFile(tmp, 'w') for root, _, files in os.walk(outputDir): for f in files: relpath = root[len(outputDir) + 1:] arcname = join(relpath, f).replace(os.sep, '/') zf.write(join(root, f), arcname) zf.close() + os.close(fd) + # Atomic on Unix + shutil.move(tmp, join(p.dir, p.name + '.jar')) def canonicalizeprojects(args): """process all project files to canonicalize the dependencies @@ -2255,13 +2263,18 @@ return False -def _genEclipseBuilder(dotProjectDoc, p, name, mxCommand, refresh=True, async=False): +def _genEclipseBuilder(dotProjectDoc, p, name, mxCommand, refresh=True, async=False, logToConsole=False): launchOut = XMLDoc(); + consoleOn = 'true' if logToConsole else 'false' launchOut.open('launchConfiguration', {'type' : 'org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType'}) + launchOut.open('mapAttribute', {'key' : 'org.eclipse.debug.core.environmentVariables'}) + launchOut.element('mapEntry', {'key' : 'JAVA_HOME', 'value' : java().jdk}) + launchOut.close('mapAttribute') + if refresh: launchOut.element('stringAttribute', {'key' : 'org.eclipse.debug.core.ATTR_REFRESH_SCOPE', 'value': '${project}'}) - launchOut.element('booleanAttribute', {'key' : 'org.eclipse.debug.core.capture_output', 'value': 'false'}) - launchOut.element('booleanAttribute', {'key' : 'org.eclipse.debug.ui.ATTR_CONSOLE_OUTPUT_ON', 'value': 'false'}) + launchOut.element('booleanAttribute', {'key' : 'org.eclipse.debug.ui.ATTR_CONSOLE_OUTPUT_ON', 'value': consoleOn}) + launchOut.element('booleanAttribute', {'key' : 'org.eclipse.debug.core.capture_output', 'value': consoleOn}) if async: launchOut.element('booleanAttribute', {'key' : 'org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND', 'value': 'true'})