-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathbuild.sbt
180 lines (157 loc) · 8.1 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
val scala_version = "2.12.7"
val paradise_version = "2.1.0"
val scalatestVersion = "3.0.5"
name := "spatial"
trapExit := false
val base = Seq(
organization := "edu.stanford.cs.dawn",
scalaVersion := scala_version,
version := "1.1-SNAPSHOT",
licenses += ("MIT", url("https://opensource.org/licenses/MIT")),
isSnapshot := version.value.endsWith("-SNAPSHOT"),
/** External Libraries (e.g. maven dependencies) **/
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % scalatestVersion, // Testing
"com.github.scopt" %% "scopt" % "3.7.0", // Command line args
"org.scala-lang.modules" %% "scala-xml" % "1.0.6", // scala 2.12 and scala test 2.12 depends on 1.06 so sbt select the older version anyway
"com.github.pureconfig" %% "pureconfig" % "0.9.2",
"org.jpmml" % "pmml-evaluator" % "1.4.8",
"javax.xml.bind" % "jaxb-api" % "2.3.0",
"org.scalanlp" %% "breeze" % "1.0"
// "com.thoughtworks.xstream" % "xstream" % "1.4.3",
// These are a bit bulky, leaving them out in favor of a stripped down version for now
//"org.apache.commons" % "commons-lang3" % "3.3.2",
//"commons-io" % "commons-io" % "2.5"
),
pgpPassphrase := {
try {Some(scala.io.Source.fromFile(Path.userHome / ".sbt" / "pgp.credentials").mkString.trim.toCharArray)}
catch { case _:Throwable => None }
},
/** Scalac Options **/
scalacOptions += "-target:jvm-1.8", // JVM 1.8
scalacOptions ++= Seq("-encoding", "UTF-8"), // Encoding using UTF-8
scalacOptions += "-unchecked", // Enable additional warnings
scalacOptions += "-deprecation", // Enable warnings on deprecated usage
scalacOptions += "-feature", // Warnings for features requiring explicit import
// scalacOptions += "-Xfatal-warnings", // Warnings are errors // Disabled this in order to run pmml
scalacOptions += "-language:higherKinds", // Globally enable higher kinded type parameters
scalacOptions += "-language:implicitConversions", // Globally enable implicit conversions
scalacOptions += "-language:experimental.macros", // Globally enable macros
scalacOptions += "-language:existentials", // Globally enable existentials
scalacOptions += "-Yno-generic-signatures", // Suppress generation of generic signatures in bytecode
scalacOptions += "-Xfuture", // Enable "future language features"
/** Project Structure **/
resourceDirectory in Compile := baseDirectory(_/ "resources").value,
scalaSource in Compile := baseDirectory(_/"src").value,
/** Testing **/
scalacOptions in Test ++= Seq("-Yrangepos"),
/** Macro Paradise **/
resolvers += Resolver.sonatypeRepo("snapshots"),
resolvers += Resolver.sonatypeRepo("releases"),
addCompilerPlugin("org.scalamacros" % "paradise" % paradise_version cross CrossVersion.full),
/** Release **/
publishArtifact := true,
homepage := Some(url("https://spatial.stanford.edu")),
scmInfo := Some(ScmInfo(url("https://github.com/stanford-ppl/spatial"),
"git@github.com:stanford-ppl/spatial.git")),
developers := List(Developer("mattfel1",
"Matthew Feldman",
"mattfel@stanford.edu",
url("https://github.com/mattfel1")),
Developer("dkoeplin",
"David Koeplinger",
"dkoeplin@stanford.edu",
url("https://github.com/dkoeplin")),
Developer("raghup17",
"Raghu Prabhakar",
"raghup17@stanford.edu",
url("https://github.com/raghup17")),
Developer("yaqiz",
"Yaqi Zhang",
"yaqiz@stanford.edu",
url("https://github.com/yaqiz")),
Developer("pyprogrammer",
"Nathan Zhang",
"stanfurd@stanford.edu",
url("https://github.com/pyprogrammer"))
),
publishTo := Some(
if (isSnapshot.value)
Opts.resolver.sonatypeSnapshots
else
Opts.resolver.sonatypeStaging
),
publishMavenStyle := true
)
val emul_settings = base ++ Seq(
libraryDependencies += "org.scala-lang" % "scala-reflect" % scala_version,
name := "emul" + sys.env.get("EMUL_PACKAGE").getOrElse(""),
//crossScalaVersions := Seq(scala_version, "2.11.7"),
scalacOptions in (Compile, doc) += "-diagrams", // Generate type hiearchy graph in scala doc
)
val common = base ++ Seq(
libraryDependencies += "org.scala-lang" % "scala-reflect" % scala_version,
scalacOptions += "-opt:l:method,inline", // Enable method optimizations, inlining
scalacOptions += "-opt-warnings:none", // Disable optimization warnings
scalacOptions in (Compile, doc) += "-diagrams", // Generate type hiearchy graph in scala doc
)
val models_settings = base ++ Seq(
name := "models" + sys.env.get("MODELS_PACKAGE").getOrElse("")
)
val utils_settings = common ++ Seq(
name := "utils" + sys.env.get("UTILS_PACKAGE").getOrElse("")
)
val chisel3_version = sys.props.getOrElse("chisel3Version", "3.1.6")
val testers_version = sys.props.getOrElse("chisel-iotestersVersion", "1.2.8")
val fringe_settings = base ++ Seq(
scalacOptions += "-Xsource:2.11",
name := "fringe" + sys.env.get("FRINGE_PACKAGE").getOrElse(""),
libraryDependencies ++= Seq(
//"org.scala-lang" % "scala-reflect" % "2.11.7",
"edu.berkeley.cs" %% "chisel3" % chisel3_version, // Chisel
"edu.berkeley.cs" %% "chisel-iotesters" % testers_version,
),
scalacOptions += "-language:reflectiveCalls", // Globally enable reflective calls
scalacOptions in (Compile, console) --= Seq("-Ywarn-unused:imports", "-Xfatal-warnings"), // allow warnings in console
)
/** Projects **/
lazy val utils = project.settings(utils_settings)
lazy val emul = project.settings(emul_settings)
lazy val fringe = project.settings(fringe_settings).dependsOn(emul, utils)
lazy val models = project.settings(models_settings).dependsOn(utils)
lazy val forge = project.settings(common).dependsOn(utils)
lazy val poly = project.settings(common).dependsOn(utils, emul)
lazy val argon = project.settings(common).dependsOn(utils, forge, emul)
lazy val spatial = (project in file(".")).settings(
common// ++ Seq(scalaSource in Test := baseDirectory(_/"test").value)
).dependsOn(forge, emul, argon, models, poly)
lazy val apps = project.settings(common).dependsOn(spatial)
/** Testing Projects **/
/*lazy val appsTest = project.settings(*/
/*common ++ Seq(scalaSource in Test := baseDirectory.in(spatial).value/"test/spatial/tests/apps/"),*/
/*).dependsOn(spatial)*/
/*lazy val compilerTest = project.settings(*/
/*common ++ Seq(scalaSource in Test := baseDirectory.in(spatial).value/"test/spatial/tests/compiler/"),*/
/*).dependsOn(spatial)*/
/*lazy val RosettaTest = project.settings(*/
/*common ++ Seq(scalaSource in Test := baseDirectory.in(spatial).value/"test/spatial/tests/Rosetta/"),*/
/*).dependsOn(spatial)*/
/*lazy val syntaxTest = project.settings(*/
/*common ++ Seq(scalaSource in Test := baseDirectory.in(spatial).value/"test/spatial/tests/syntax/"),*/
/*).dependsOn(spatial)*/
/*lazy val featureTest = project.settings(*/
/*common ++ Seq(scalaSource in Test := baseDirectory.in(spatial).value/"test/spatial/tests/feature/"),*/
/*).dependsOn(spatial)*/
/*lazy val test = project.settings(common).aggregate(appsTest, compilerTest, RosettaTest, syntaxTest,*/
/*featureTest)*/
lazy val test = project.settings(
common ++ Seq(scalaSource in Test := baseDirectory.in(spatial).value/"test"),
).dependsOn(spatial)
lazy val pirTest = project
.settings(common)
.settings(
scalaSource in Test := baseDirectory.in(spatial).value/"pir/regression"
).dependsOn(spatial)
/** Set number of threads for testing **/
val threadsOrDefault: Int = Option(System.getProperty("maxthreads")).getOrElse("1").toInt
Global / concurrentRestrictions += Tags.limit(Tags.Test, threadsOrDefault)