forked from malyzajko/daisy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
executable file
·98 lines (76 loc) · 2.88 KB
/
build.sbt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name := "Daisy"
version := "0.0"
organization := "org.mpi-sws.ava"
//enablePlugins(ScalaNativePlugin)
scalaVersion := "2.11.11"
scalacOptions ++= Seq(
"-deprecation",
"-unchecked",
"-feature")
resolvers += "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/"
resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-compiler" % "2.11.11",
"org.scalatest" % "scalatest_2.11" % "2.2.4" % "test",
"com.storm-enroute" %% "scalameter" % "0.7",
"com.regblanc" % "scala-smtlib_2.11" % "0.2",
"org.fusesource.hawtjni" % "hawtjni-runtime" % "1.9" //for JNI
)
envVars := Map("LC_NUMERIC" -> "en_US.UTF-8")
Keys.fork in run := true
javaOptions in run ++= Seq(
"-Xms256M", "-Xmx2G", "-XX:+UseConcMarkSweepGC")
Keys.fork in Test := true //for native libraries to be on correct path
val scalaMeterFramework = new TestFramework("org.scalameter.ScalaMeterFramework")
testFrameworks += scalaMeterFramework
lazy val Benchmark = config("bench") extend Test
testOptions in Test += Tests.Argument(scalaMeterFramework, "-silent")
parallelExecution in Test := false
logBuffered := false
lazy val basic = Project("daisy", file(".")
) configs(
Benchmark
) settings(
inConfig(Benchmark)(Defaults.testSettings): _*
)
lazy val scriptFile = file(".") / "daisy"
clean := {
clean.value
if(scriptFile.exists && scriptFile.isFile) {
scriptFile.delete
}
}
lazy val script = taskKey[Unit]("Generate the daisy Bash script")
script := {
val s = streams.value
try {
val cps = (dependencyClasspath in Compile).value
val out = (classDirectory in Compile).value
val res = (resourceDirectory in Compile).value
//val is64 = System.getProperty("sun.arch.data.model") == "64"
val f = scriptFile
if(f.exists) {
s.log.info("Regenerating '"+f.getName+"' script ...")
f.delete
} else {
s.log.info("Generating '"+f.getName+"' script ...")
}
val paths = (res.getAbsolutePath +: out.getAbsolutePath +: cps.map(_.data.absolutePath)).mkString(System.getProperty("path.separator"))
//val base = baseDirectory.value.getAbsolutePath
IO.write(f, s"""|#!/bin/bash --posix
|
|SCALACLASSPATH="$paths"
|
|TMP=$$LC_NUMERIC
|LC_NUMERIC=en_US.UTF-8
|
|java -Xmx2G -Xms512M -Xss64M -classpath "$${SCALACLASSPATH}" -Dscala.usejavacp=false scala.tools.nsc.MainGenericRunner -classpath "$${SCALACLASSPATH}" daisy.Main $$@ 2>&1 | tee -i last.log
|
|LC_NUMERIC=$$TMP
|""".stripMargin)
f.setExecutable(true)
} catch {
case e: Throwable =>
s.log.error("There was an error while generating the script file: " + e.getLocalizedMessage)
}
}