Mercurial > hg > graal-jvmci-8
comparison mx/mx_graal.py @ 17262:b641450c19ce
mx: rename helper functions for cygwin support and update comments
author | Bernhard Urban <bernhard.urban@jku.at> |
---|---|
date | Tue, 30 Sep 2014 10:05:30 +0200 |
parents | a02c295218aa |
children | f0364a8ec40e |
comparison
equal
deleted
inserted
replaced
17261:d4fe68441072 | 17262:b641450c19ce |
---|---|
527 if exists(join(p.output_dir(), mainClass.replace('.', os.sep) + '.class')): | 527 if exists(join(p.output_dir(), mainClass.replace('.', os.sep) + '.class')): |
528 genSrcDir = _makeHotspotGeneratedSourcesDir() | 528 genSrcDir = _makeHotspotGeneratedSourcesDir() |
529 graalRuntime_inline_hpp = join(genSrcDir, 'graalRuntime.inline.hpp') | 529 graalRuntime_inline_hpp = join(genSrcDir, 'graalRuntime.inline.hpp') |
530 cp = os.pathsep.join([mx.distribution(d).path for d in dist.distDependencies] + [dist.path, p.output_dir()]) | 530 cp = os.pathsep.join([mx.distribution(d).path for d in dist.distDependencies] + [dist.path, p.output_dir()]) |
531 tmp = StringIO.StringIO() | 531 tmp = StringIO.StringIO() |
532 mx.run_java(['-cp', mx._tspU2W(cp), mainClass], out=tmp.write) | 532 mx.run_java(['-cp', mx._separatedCygpathU2W(cp), mainClass], out=tmp.write) |
533 | 533 |
534 # Compute SHA1 for currently generated graalRuntime.inline.hpp content | 534 # Compute SHA1 for currently generated graalRuntime.inline.hpp content |
535 # and all other generated sources in genSrcDir | 535 # and all other generated sources in genSrcDir |
536 d = hashlib.sha1() | 536 d = hashlib.sha1() |
537 d.update(tmp.getvalue()) | 537 d.update(tmp.getvalue()) |
550 # Store SHA1 in generated Java class and append class to specified jar | 550 # Store SHA1 in generated Java class and append class to specified jar |
551 javaSource = join(_graal_home, 'GeneratedSourcesSha1.java') | 551 javaSource = join(_graal_home, 'GeneratedSourcesSha1.java') |
552 javaClass = join(_graal_home, 'GeneratedSourcesSha1.class') | 552 javaClass = join(_graal_home, 'GeneratedSourcesSha1.class') |
553 with open(javaSource, 'w') as fp: | 553 with open(javaSource, 'w') as fp: |
554 print >> fp, 'class GeneratedSourcesSha1 { private static final String value = "' + sha1 + '"; }' | 554 print >> fp, 'class GeneratedSourcesSha1 { private static final String value = "' + sha1 + '"; }' |
555 subprocess.check_call([mx.java().javac, '-d', mx._tpU2W(_graal_home), mx._tpU2W(javaSource)], stderr=subprocess.PIPE, stdout=subprocess.PIPE) | 555 subprocess.check_call([mx.java().javac, '-d', mx._cygpathU2W(_graal_home), mx._cygpathU2W(javaSource)], stderr=subprocess.PIPE, stdout=subprocess.PIPE) |
556 zf = zipfile.ZipFile(dist.path, 'a') | 556 zf = zipfile.ZipFile(dist.path, 'a') |
557 with open(javaClass, 'rb') as fp: | 557 with open(javaClass, 'rb') as fp: |
558 zf.writestr(os.path.basename(javaClass), fp.read()) | 558 zf.writestr(os.path.basename(javaClass), fp.read()) |
559 zf.close() | 559 zf.close() |
560 os.unlink(javaSource) | 560 os.unlink(javaSource) |
609 startToken = 'RUNINDEBUGSHELL_STARTSEQUENCE' | 609 startToken = 'RUNINDEBUGSHELL_STARTSEQUENCE' |
610 endToken = 'RUNINDEBUGSHELL_ENDSEQUENCE' | 610 endToken = 'RUNINDEBUGSHELL_ENDSEQUENCE' |
611 | 611 |
612 winSDK = mx.get_env('WIN_SDK', 'C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\') | 612 winSDK = mx.get_env('WIN_SDK', 'C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\') |
613 | 613 |
614 if not exists(mx._tpW2U(winSDK)): | 614 if not exists(mx._cygpathW2U(winSDK)): |
615 mx.abort("Could not find Windows SDK : '" + winSDK + "' does not exist") | 615 mx.abort("Could not find Windows SDK : '" + winSDK + "' does not exist") |
616 | 616 |
617 winSDKSetEnv = mx._tpW2U(join(winSDK, 'Bin', 'SetEnv.cmd')) | 617 winSDKSetEnv = mx._cygpathW2U(join(winSDK, 'Bin', 'SetEnv.cmd')) |
618 if not exists(winSDKSetEnv): | 618 if not exists(winSDKSetEnv): |
619 mx.abort("Invalid Windows SDK path (" + winSDK + ") : could not find Bin/SetEnv.cmd (you can use the WIN_SDK environment variable to specify an other path)") | 619 mx.abort("Invalid Windows SDK path (" + winSDK + ") : could not find Bin/SetEnv.cmd (you can use the WIN_SDK environment variable to specify an other path)") |
620 | 620 |
621 wincmd = 'cmd.exe /E:ON /V:ON /K "' + mx._tpU2W(winSDKSetEnv) + '"' | 621 wincmd = 'cmd.exe /E:ON /V:ON /K "' + mx._cygpathU2W(winSDKSetEnv) + '"' |
622 p = subprocess.Popen(wincmd, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | 622 p = subprocess.Popen(wincmd, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
623 stdout = p.stdout | 623 stdout = p.stdout |
624 stdin = p.stdin | 624 stdin = p.stdin |
625 if logFile: | 625 if logFile: |
626 log = open(logFile, 'w') | 626 log = open(logFile, 'w') |
845 if not mustBuild: | 845 if not mustBuild: |
846 mx.logv('[all files in src and make directories are older than ' + timestampFile[len(_graal_home) + 1:] + ' - skipping native build]') | 846 mx.logv('[all files in src and make directories are older than ' + timestampFile[len(_graal_home) + 1:] + ' - skipping native build]') |
847 continue | 847 continue |
848 | 848 |
849 if platform.system() == 'Windows' or "CYGWIN" in platform.system(): | 849 if platform.system() == 'Windows' or "CYGWIN" in platform.system(): |
850 t_compilelogfile = mx._tpU2W(os.path.join(_graal_home, "graalCompile.log")) | 850 t_compilelogfile = mx._cygpathU2W(os.path.join(_graal_home, "graalCompile.log")) |
851 mksHome = mx.get_env('MKS_HOME', 'C:\\cygwin\\bin') | 851 mksHome = mx.get_env('MKS_HOME', 'C:\\cygwin\\bin') |
852 | 852 |
853 variant = {'client': 'compiler1', 'server': 'compiler2'}.get(vm, vm) | 853 variant = {'client': 'compiler1', 'server': 'compiler2'}.get(vm, vm) |
854 project_config = variant + '_' + build | 854 project_config = variant + '_' + build |
855 t_graal_home = mx._tpU2W(_graal_home) | 855 t_graal_home = mx._cygpathU2W(_graal_home) |
856 _runInDebugShell('msbuild ' + t_graal_home + r'\build\vs-amd64\jvm.vcproj /p:Configuration=' + project_config + ' /target:clean', t_graal_home) | 856 _runInDebugShell('msbuild ' + t_graal_home + r'\build\vs-amd64\jvm.vcproj /p:Configuration=' + project_config + ' /target:clean', t_graal_home) |
857 winCompileCmd = r'set HotSpotMksHome=' + mksHome + r'& set OUT_DIR=' + mx._tpU2W(jdk) + r'& set JAVA_HOME=' + mx._tpU2W(jdk) + r'& set path=%JAVA_HOME%\bin;%path%;%HotSpotMksHome%& cd /D "' + t_graal_home + r'\make\windows"& call create.bat ' + t_graal_home | 857 winCompileCmd = r'set HotSpotMksHome=' + mksHome + r'& set OUT_DIR=' + mx._cygpathU2W(jdk) + r'& set JAVA_HOME=' + mx._cygpathU2W(jdk) + r'& set path=%JAVA_HOME%\bin;%path%;%HotSpotMksHome%& cd /D "' + t_graal_home + r'\make\windows"& call create.bat ' + t_graal_home |
858 print winCompileCmd | 858 print winCompileCmd |
859 winCompileSuccess = re.compile(r"^Writing \.vcxproj file:") | 859 winCompileSuccess = re.compile(r"^Writing \.vcxproj file:") |
860 if not _runInDebugShell(winCompileCmd, t_graal_home, t_compilelogfile, winCompileSuccess): | 860 if not _runInDebugShell(winCompileCmd, t_graal_home, t_compilelogfile, winCompileSuccess): |
861 mx.log('Error executing create command') | 861 mx.log('Error executing create command') |
862 return | 862 return |
1449 | 1449 |
1450 global _jacoco | 1450 global _jacoco |
1451 _jacoco = 'off' | 1451 _jacoco = 'off' |
1452 | 1452 |
1453 t = Task('CleanAndBuildIdealGraphVisualizer') | 1453 t = Task('CleanAndBuildIdealGraphVisualizer') |
1454 buildxml = mx._tpU2W(join(_graal_home, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'build.xml')) | 1454 buildxml = mx._cygpathU2W(join(_graal_home, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'build.xml')) |
1455 mx.run(['ant', '-f', buildxml, '-q', 'clean', 'build']) | 1455 mx.run(['ant', '-f', buildxml, '-q', 'clean', 'build']) |
1456 tasks.append(t.stop()) | 1456 tasks.append(t.stop()) |
1457 | 1457 |
1458 # Prevent Graal modifications from breaking the standard builds | 1458 # Prevent Graal modifications from breaking the standard builds |
1459 if args.buildNonGraal: | 1459 if args.buildNonGraal: |
2243 finally: | 2243 finally: |
2244 shutil.rmtree(tmp) | 2244 shutil.rmtree(tmp) |
2245 findbugsJar = join(findbugsLib, 'findbugs.jar') | 2245 findbugsJar = join(findbugsLib, 'findbugs.jar') |
2246 assert exists(findbugsJar) | 2246 assert exists(findbugsJar) |
2247 nonTestProjects = [p for p in mx.projects() if not p.name.endswith('.test') and not p.name.endswith('.jtt')] | 2247 nonTestProjects = [p for p in mx.projects() if not p.name.endswith('.test') and not p.name.endswith('.jtt')] |
2248 outputDirs = map(mx._tpU2W, [p.output_dir() for p in nonTestProjects]) | 2248 outputDirs = map(mx._cygpathU2W, [p.output_dir() for p in nonTestProjects]) |
2249 findbugsResults = join(_graal_home, 'findbugs.results') | 2249 findbugsResults = join(_graal_home, 'findbugs.results') |
2250 | 2250 |
2251 cmd = ['-jar', mx._tpU2W(findbugsJar), '-textui', '-low', '-maxRank', '15'] | 2251 cmd = ['-jar', mx._cygpathU2W(findbugsJar), '-textui', '-low', '-maxRank', '15'] |
2252 if sys.stdout.isatty(): | 2252 if sys.stdout.isatty(): |
2253 cmd.append('-progress') | 2253 cmd.append('-progress') |
2254 cmd = cmd + ['-auxclasspath', mx.classpath([d.name for d in _jdkDeployedDists] + [p.name for p in nonTestProjects]), '-output', mx._tpU2W(findbugsResults), '-exitcode'] + args + outputDirs | 2254 cmd = cmd + ['-auxclasspath', mx.classpath([d.name for d in _jdkDeployedDists] + [p.name for p in nonTestProjects]), '-output', mx._cygpathU2W(findbugsResults), '-exitcode'] + args + outputDirs |
2255 exitcode = mx.run_java(cmd, nonZeroIsFatal=False) | 2255 exitcode = mx.run_java(cmd, nonZeroIsFatal=False) |
2256 if exitcode != 0: | 2256 if exitcode != 0: |
2257 with open(findbugsResults) as fp: | 2257 with open(findbugsResults) as fp: |
2258 mx.log(fp.read()) | 2258 mx.log(fp.read()) |
2259 os.unlink(findbugsResults) | 2259 os.unlink(findbugsResults) |