-
Notifications
You must be signed in to change notification settings - Fork 49
/
build.sbt
208 lines (153 loc) · 6.8 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
name := "Leon"
version := "3.0"
organization := "ch.epfl.lara"
val scalaVer = "2.11.8"
scalaVersion := scalaVer
scalacOptions ++= Seq(
"-deprecation",
"-unchecked",
"-feature"
)
scalacOptions in (Compile, doc) ++= Seq("-doc-root-content", baseDirectory.value+"/src/main/scala/root-doc.txt")
javacOptions += "-Xlint:unchecked"
site.settings
site.sphinxSupport()
val osName = Option(System.getProperty("os.name")).getOrElse("").toLowerCase()
val osArch = System.getProperty("sun.arch.data.model")
if(osName.indexOf("win") != -1) {
(unmanagedJars in Compile) += baseDirectory.value / "unmanaged" / s"scalaz3-win-$osArch.jar"
} else {
(unmanagedJars in Compile) += baseDirectory.value / "unmanaged" / s"scalaz3-unix-$osArch.jar"
}
unmanagedBase <<= baseDirectory { base => base / "unmanaged" / osArch }
resolvers ++= Seq(
"Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/",
"Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots",
"Sonatype OSS Releases" at "https://oss.sonatype.org/content/repositories/releases"
)
val libisabelleVer = "0.7.0"
enablePlugins(LibisabellePlugin)
isabelleVersions := List("2016-1")
isabelleSessions in Compile := List("Leon")
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-compiler" % scalaVer,
"org.scalatest" %% "scalatest" % "2.2.4" % "test",
"com.typesafe.akka" %% "akka-actor" % "2.3.4",
"info.hupel" %% "libisabelle" % libisabelleVer,
"info.hupel" %% "libisabelle-setup" % libisabelleVer,
"info.hupel" %% "pide-package" % libisabelleVer,
"info.hupel" %% "slf4j-impl-helper" % "0.1" % "optional",
"org.ow2.asm" % "asm-all" % "5.0.4",
"com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.6.0-rc2"//,
//"com.regblanc" %% "scala-smtlib" % "0.2"
)
lazy val scriptName = "leon"
lazy val scriptFile = file(".") / scriptName
clean := {
clean.value
if(scriptFile.exists && scriptFile.isFile) {
scriptFile.delete
}
}
lazy val nParallel = {
val p = System.getProperty("parallel")
if (p ne null) {
try {
p.toInt
} catch {
case nfe: NumberFormatException =>
1
}
} else {
1
}
}
lazy val script = taskKey[Unit]("Generate the leon 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 ("+(if(is64) "64b" else "32b")+")...")
f.delete
} else {
s.log.info("Generating '"+f.getName+"' script ("+(if(is64) "64b" else "32b")+")...")
}
val paths = (res.getAbsolutePath +: out.getAbsolutePath +: cps.map(_.data.absolutePath)).mkString(System.getProperty("path.separator"))
IO.write(f, s"""|#!/bin/bash --posix
|
|SCALACLASSPATH="$paths"
|
|java -Xmx2G -Xms512M -Xss64M -classpath "$${SCALACLASSPATH}" -Dscala.usejavacp=false scala.tools.nsc.MainGenericRunner -classpath "$${SCALACLASSPATH}" leon.Main $$@ 2>&1 | tee -i last.log
|""".stripMargin)
f.setExecutable(true)
} catch {
case e: Throwable =>
s.log.error("There was an error while generating the script file: " + e.getLocalizedMessage)
}
}
sourceGenerators in Compile <+= Def.task {
val libFiles = ((baseDirectory.value / "library") ** "*.scala").getPaths
val build = (sourceManaged in Compile).value / "leon" / "Build.scala"
IO.write(build, s"""|package leon
|
|object Build {
| val baseDirectory = \"\"\"${baseDirectory.value.toString}\"\"\"
| val libFiles = List(
| ${libFiles.mkString("\"\"\"", "\"\"\",\n \"\"\"", "\"\"\"").replaceAll("\\\\"+"u","\\\\\"\"\"+\"\"\"u")}
| )
|}""".stripMargin)
Seq(build)
}
sourcesInBase in Compile := false
Keys.fork in run := true
lazy val testSettings = Seq(
//Keys.fork := true,
logBuffered := (nParallel > 1),
parallelExecution := (nParallel > 1)
//testForkedParallel := true,
//javaOptions ++= Seq("-Xss64M", "-Xmx4G")
)
concurrentRestrictions in Global += Tags.limit(Tags.Test, nParallel)
// Unit Tests
testOptions in Test := Seq(Tests.Argument("-oDF"), Tests.Filter(_ startsWith "leon.unit."))
// Integration Tests
lazy val IntegrTest = config("integration") extend(Test)
testOptions in IntegrTest := Seq(Tests.Argument("-oDF"), Tests.Filter(_ startsWith "leon.integration."))
def regressionFilter(name: String, native: Boolean = false): Boolean = name.startsWith("leon.regression") && (name.endsWith("NativeZ3") == native)
// Regression Tests
lazy val RegressionTest = config("regression") extend(Test)
testOptions in RegressionTest := Seq(Tests.Argument("-oDF"), Tests.Filter(regressionFilter(_)))
// Regression Tests that heavily depend on native Z3
lazy val NativeZ3RegressionTest = config("native") extend(Test)
testOptions in NativeZ3RegressionTest := Seq(Tests.Argument("-oDF"), Tests.Filter(regressionFilter(_, native = true)))
parallelExecution in NativeZ3RegressionTest := false
logBuffered in NativeZ3RegressionTest := false
// Isabelle Tests
lazy val IsabelleTest = config("isabelle") extend(Test)
testOptions in IsabelleTest := Seq(Tests.Argument("-oDF"), Tests.Filter(_ startsWith "leon.isabelle."))
parallelExecution in IsabelleTest := false
fork in IsabelleTest := true
// GenC Tests
lazy val GenCTest = config("genc") extend(Test)
testOptions in GenCTest := Seq(Tests.Argument("-oDF"), Tests.Filter(_ startsWith "leon.genc."))
parallelExecution in GenCTest := false
def ghProject(repo: String, version: String) = RootProject(uri(s"${repo}#${version}"))
lazy val bonsai = ghProject("git://github.com/colder/bonsai.git", "10eaaee4ea0ff6567f4f866922cb871bae2da0ac")
lazy val scalaSmtlib = ghProject("git://github.com/regb/scala-smtlib.git", "3ee3ff99ac0377548af6da04c22cbe73f1987569")
lazy val cafebabe = ghProject("git://github.com/psuter/cafebabe.git", "49dce3c83450f5fa0b5e6151a537cc4b9f6a79a6")
lazy val root = (project in file(".")).
configs(RegressionTest, NativeZ3RegressionTest, IsabelleTest, GenCTest, IntegrTest).
dependsOn(bonsai).
dependsOn(scalaSmtlib).
dependsOn(cafebabe).
settings(inConfig(NativeZ3RegressionTest)(Defaults.testTasks ++ testSettings): _*).
settings(inConfig(RegressionTest)(Defaults.testTasks ++ testSettings): _*).
settings(inConfig(IntegrTest)(Defaults.testTasks ++ testSettings): _*).
settings(inConfig(IsabelleTest)(Defaults.testTasks ++ testSettings): _*).
settings(inConfig(GenCTest)(Defaults.testTasks ++ testSettings): _*).
settings(inConfig(Test)(Defaults.testTasks ++ testSettings): _*)