Skip to content

Commit

Permalink
run for windows
Browse files Browse the repository at this point in the history
.cmd and .bat files need suffix
  • Loading branch information
mkeskells committed Sep 12, 2018
1 parent d03e880 commit df096fa
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 10 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,15 @@ sbt dist/mkPack

Usage:

On Unix
```
cd <WORKSPACE>/scala-umad
./run.py -s <WORKSPACE>/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 <WORKSPACE>\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.
Expand Down
27 changes: 18 additions & 9 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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"
Expand Down

0 comments on commit df096fa

Please sign in to comment.