Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run for windows #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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