-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathbuild.sbt
131 lines (121 loc) · 4.87 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
import scala.sys.process._
import java.nio.file.{Paths, Files}
import java.nio.file.attribute.PosixFilePermissions
import scala.util.Try
lazy val commonSettings = Seq(
name := "TriCera",
organization := "uuverifiers",
version := "0.3.1",
homepage := Some(url("https://github.com/uuverifiers/tricera")),
licenses := Seq("BSD-3-Clause" -> url("https://opensource.org/licenses/BSD-3-Clause")),
description := "TriCera is a model checker for C programs.",
scalaVersion := "2.11.12",
crossScalaVersions := Seq("2.11.12", "2.12.18"),
publishTo := Some(Resolver.file("file", new File( "/home/compilation/public_html/maven/" )) ),
useCoursier := false
)
lazy val parserSettings = Seq(
publishArtifact in packageDoc := false,
publishArtifact in packageSrc := false,
exportJars := true,
crossPaths := true
)
lazy val ccParser = (project in file("cc-parser")).
settings(commonSettings: _*).
settings(parserSettings: _*).
settings(
name := "TriCera-CC-parser",
packageBin in Compile := baseDirectory.value / "cc-parser.jar",
unmanagedJars in Compile += baseDirectory.value / "cc-parser.jar"
).disablePlugins(AssemblyPlugin)
lazy val acslParser = (project in file("acsl-parser")).
settings(commonSettings: _*).
settings(parserSettings: _*).
settings(
name := "TriCera-ACSL-parser",
packageBin in Compile := baseDirectory.value / "acsl-parser.jar",
unmanagedJars in Compile += baseDirectory.value / "acsl-parser.jar"
).disablePlugins(AssemblyPlugin)
lazy val pp = taskKey[Unit]("")
pp := {
val f = url("https://github.com/zafer-esen/tri-pp/releases/download/v0.1.3/tri-pp")
f #> file("tri-pp") !
}
def addExecutePermissions(file: File): Unit = {
val path = Paths.get(file.getAbsolutePath)
if (Files.exists(path)) {
val fileSystem = path.getFileSystem
if (fileSystem.supportedFileAttributeViews().contains("posix")) {
Try {
val permissions = PosixFilePermissions.fromString("rwxr-xr-x")
Files.setPosixFilePermissions(path, permissions)
println(s"Set execute permissions on ${file.getAbsolutePath}")
}.getOrElse {
println(s"Could not set execute permissions on ${file.getAbsolutePath}")
}
} else {
println(s"Skipping permission changes: " +
s"${file.getAbsolutePath} is on a non-POSIX filesystem (${fileSystem.provider()}).")
}
} else {
println(s"File not found: ${file.getAbsolutePath}")
}
}
lazy val ppWithErrorHandling = taskKey[Unit]("Download the preprocessor")
ppWithErrorHandling := {
if ({val f = baseDirectory.value / "tri-pp"
Files.exists(Paths.get(f.toString)) &&
fileToRichFile(f).attributes.size > 0}) {
println("tri-pp found, skipping download.")
addExecutePermissions(baseDirectory.value / "tri-pp")
}
else {
pp.result.value match{
case Inc(inc : Incomplete) =>
println("failure! Please double check the link in build.sbt" +
" and make sure it exists.")
case _ =>
println("tri-pp downloaded.")
addExecutePermissions(baseDirectory.value / "tri-pp")
}
}
}
(compile in Compile) := ((compile in Compile) dependsOn ppWithErrorHandling).value
// Actual project
lazy val root = (project in file(".")).
aggregate(ccParser).
dependsOn(ccParser).
aggregate(acslParser).
dependsOn(acslParser).
settings(commonSettings: _*).
//
settings(
scalaSource in Compile := baseDirectory.value / "src",
//
scalaSource in Test := baseDirectory.value / "unit-tests",
//
mainClass in Compile := Some("tricera.Main"),
//
scalacOptions in Compile ++=
List("-feature",
"-language:implicitConversions,postfixOps,reflectiveCalls"),
scalacOptions += (scalaVersion map { sv => sv match {
case "2.11.12" => "-optimise"
case "2.12.18" => "-opt:_"
}}).value,
resolvers += "uuverifiers" at "https://eldarica.org/maven/",
libraryDependencies += "uuverifiers" %% "eldarica" % "2.1",
libraryDependencies += "uuverifiers" %% "horn-concurrency" % "2.1.1",
libraryDependencies += "net.jcazevedo" %% "moultingyaml" % "0.4.2",
libraryDependencies += "org.scalactic" %% "scalactic" % "3.2.12",
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.12" % "test",
excludeDependencies ++= Seq(
// exclude java-cup from transitive dependencies, ccParser includes newer version
ExclusionRule("net.sf.squirrel-sql.thirdparty-non-maven", "java-cup"))
)
// project can also be built by providing dependencies under the lib directory
// and uncommenting below code to discard clashing transitive dependencies
//assemblyMergeStrategy in assembly := {
// case PathList("META-INF", xs @ _*) => MergeStrategy.discard
// case x => MergeStrategy.last
//}