forked from epfl-lara/inox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
169 lines (128 loc) · 5.14 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
name := "inox"
enablePlugins(GitVersioning)
git.useGitDescribe := true
organization := "ch.epfl.lara"
scalaVersion := "2.11.8"
crossScalaVersions := Seq("2.11.8", "2.12.1")
scalacOptions ++= Seq(
"-deprecation",
"-unchecked",
"-feature"
)
val osInf = Option(System.getProperty("os.name")).getOrElse("")
val isUnix = osInf.indexOf("nix") >= 0 || osInf.indexOf("nux") >= 0
val isWindows = osInf.indexOf("Win") >= 0
val isMac = osInf.indexOf("Mac") >= 0
val osName = if (isWindows) "win" else if (isMac) "mac" else "unix"
val osArch = System.getProperty("sun.arch.data.model")
unmanagedJars in Compile += {
baseDirectory.value / "unmanaged" / s"scalaz3-$osName-$osArch-${scalaBinaryVersion.value}.jar"
}
resolvers ++= Seq(
"Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots",
"Sonatype OSS Releases" at "https://oss.sonatype.org/content/repositories/releases",
"uuverifiers" at "http://logicrunch.research.it.uu.se/maven"
)
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % "3.0.1" % "test;it",
"org.apache.commons" % "commons-lang3" % "3.4",
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
"com.regblanc" %% "scala-smtlib" % "0.2.2-7-g00a9686",
"uuverifiers" %% "princess" % "2018-02-26"
)
lazy val scriptName = settingKey[String]("Name of the generated 'inox' script")
scriptName := "inox"
lazy val scriptFile = taskKey[File]("Location of the generated 'inox' script (computed from 'scriptName')")
scriptFile := file(".") / scriptName.value
clean := {
clean.value
val file = scriptFile.value
if (file.exists && file.isFile) file.delete
}
lazy val script = taskKey[Unit]("Generate the inox Bash script")
script := {
val s = streams.value
val file = scriptFile.value
try {
val cps = (dependencyClasspath in Compile).value
val out = (classDirectory in Compile).value
val res = (resourceDirectory in Compile).value
if (file.exists) {
s.log.info("Regenerating '" + file.getName + "' script")
file.delete
} else {
s.log.info("Generating '" + file.getName + "' script")
}
val paths = res.getAbsolutePath +: out.getAbsolutePath +: cps.map(_.data.absolutePath)
val cp = paths.mkString(System.getProperty("path.separator"))
IO.write(file, s"""|#!/usr/bin/env bash
|set -o posix
|
|SCALACLASSPATH=$cp
|
|java -Xmx2G -Xms512M -Xss64M -classpath "$${SCALACLASSPATH}" -Dscala.usejavacp=true inox.Main $$@ 2>&1
|""".stripMargin)
file.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 file = (sourceManaged in Compile).value / "inox" / "Build.scala"
IO.write(file, s"""|package inox
|
|object Build {
| val version = \"\"\"${version.value}\"\"\"
|}""".stripMargin)
Seq(file)
}.taskValue
lazy val genDoc = taskKey[Unit]("Typecheck and interpret the documentation")
tutSettings
tutSourceDirectory := sourceDirectory.value / "main" / "doc"
tutTargetDirectory := baseDirectory.value / "doc"
genDoc := { tutQuick.value; () }
genDoc := (genDoc dependsOn (compile in Compile)).value
Keys.fork in run := true
testOptions in Test := Seq(Tests.Argument("-oDF"))
// Note that we can't use IntegrationTest because it is already defined in sbt._
lazy val ItTest = config("it") extend (Test)
testOptions in ItTest := Seq(Tests.Argument("-oDF"))
lazy val root = (project in file("."))
.configs(ItTest)
.settings(Defaults.itSettings : _*)
.settings(inConfig(ItTest)(Defaults.testTasks ++ Seq(
logBuffered := false,
parallelExecution := false
)) : _*)
.settings(compile := ((compile in Compile) dependsOn script dependsOn genDoc).value)
publishMavenStyle := true
publishTo := {
val nexus = "https://oss.sonatype.org/"
// @nv: we can't use `isSnapshot` here as it is not compatible with sbt-git versioning
if (version.value.trim.endsWith("SNAPSHOT")) Some("snapshots" at nexus + "content/repositories/snapshots")
else Some("releases" at nexus + "service/local/staging/deploy/maven2")
}
publishArtifact in (Test, packageBin) := true
publishArtifact in (ItTest, packageBin) := true
addArtifact(artifact in (ItTest, packageBin), packageBin in ItTest)
pomIncludeRepository := { _ => false }
licenses := Seq("GNU Affero General Public License, Version 3" -> url("http://www.gnu.org/licenses/agpl-3.0.html"))
homepage := Some(url("https://github.com/epfl-lara/inox"))
pomExtra := (
<scm>
<url>[email protected]:epfl-lara/inox.git</url>
<connection>scm:git:[email protected]:epfl-lara/inox.git</connection>
</scm>
<developers>
<developer>
<id>epfl-lara</id>
<name>EPFL Lab for Automated Reasoning and Analysis</name>
<url>http://lara.epfl.ch</url>
</developer>
<developer>
<id>samarion</id>
<name>Nicolas Voirol</name>
<url>https://github.com/samarion</url>
</developer>
</developers>)