diff --git a/README.md b/README.md index ed9fad0..335fab6 100644 --- a/README.md +++ b/README.md @@ -15,9 +15,15 @@ sbt dist/mkPack Usage: +On Unix ``` cd /scala-umad -./run.py -s /scalac_perf/build/pack/ -- -Yparallel-phases:parser,refchecks,patmat -Yparallel-sequential +./run.py -s ../scalac_perf/build/pack/ -- -Yparallel-phases:parser,refchecks,patmat -Yparallel-sequential +``` +On Windows +``` +cd \scala-umad +.\run.py -s ..\scalac_perf\build\pack\ -- -Yparallel-phases:parser,refchecks,patmat -Yparallel-sequential ``` Umad parameters are before `--`, jvm (scalac) parameters are after. diff --git a/run.py b/run.py index b8c8b25..60a10a7 100755 --- a/run.py +++ b/run.py @@ -50,8 +50,10 @@ def findFiles(path, regex): "-J-agentlib:jdwp=transport=dt_socket,server=n,address=localhost:{},suspend=y".format(options.debugPort)] classpathSeparator = ";" if os.name == 'nt' else ":" +runMvn = "mvn.cmd" if os.name == 'nt' else "mvn" +runScalac = "scalac.bat" if os.name == 'nt' else "scalac" -assert subprocess.call(["mvn", "package"], cwd="umad") == 0 +assert subprocess.call([runMvn, "package"], cwd="umad") == 0 outputBase = tempfile.mkdtemp() scalaOutput = os.path.join(outputBase, "scala") @@ -63,22 +65,29 @@ def findFiles(path, regex): def call_compiler(scalaLocation, output, additionalScalacOptions, additionalConfig=[]): agentJar = os.path.join(".", "umad", "target", "umad-1.0-SNAPSHOT.jar") configOverrides = map(lambda v: "-J-D" + v, options.config + additionalConfig) + tmp = tempfile.NamedTemporaryFile(suffix=".txt", prefix="params", delete=False) + paramsList = [configOverrides, scalacOptions, sources, debugOptions, additionalScalacOptions] + with open(tmp.name, 'w') as paramsFile: + for params in paramsList: + for param in params: + paramsFile.write(param + "\n") + paramsFile.flush() + timeBefore = time.time() subprocess.call([ - os.path.join(scalaLocation, "bin", "scalac"), + os.path.join(scalaLocation, "bin", runScalac), "-cp", classpathSeparator.join(scalaJars + jars), "-d", output, "-J-javaagent:" + agentJar, - "-toolcp", agentJar - ] + - configOverrides + - scalacOptions + - sources + - debugOptions + - additionalScalacOptions) + "-toolcp", agentJar, + "@"+tmp.name + ]) + tmp.close() + os.remove(tmp.name) return time.time() - timeBefore + compilation_time = call_compiler(options.scala, scalaOutput, options.additionalOptions) print "Compilation done in:", compilation_time, "s"