-
Notifications
You must be signed in to change notification settings - Fork 15
/
build.sbt
250 lines (209 loc) · 15.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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
import com.typesafe.config._
import java.nio.file.{Files, StandardCopyOption}
val conf = ConfigFactory.parseFile(new File("conf/application.conf")).resolve()
version := conf.getString("app.version")
val akkaVer = "2.5.19"
name := "bbweb"
organization in ThisBuild := "org.biobank"
def excludeSpecs2(module: ModuleID): ModuleID =
module.excludeAll(ExclusionRule(organization = "org.specs2", name = "specs2"))
.exclude("com.novocode", "junit-interface")
lazy val copyLogbackTest = taskKey[Unit]("copyLogbackTest")
lazy val forcedCopyLogbackTest = taskKey[Unit]("forcedCopyLogbackTest")
lazy val copyTestData = taskKey[Unit]("copyTestData")
lazy val copyEmailConf = taskKey[Unit]("copyEmailConf")
lazy val developmentInit = taskKey[Unit]("developmentInit")
def copyTemplate(templateName: String, destName: String): Unit = {
val template = new File(templateName)
val dest = new File(destName)
if (dest.exists) {
println(s"file $destName already exists")
} else {
Files.copy(template.toPath, dest.toPath)
println(s"file $templateName copied to $destName")
}
}
def forcedCopyTemplate(templateName: String, destName: String): Unit = {
val template = new File(templateName)
val dest = new File(destName)
Files.copy(template.toPath, dest.toPath, StandardCopyOption.REPLACE_EXISTING)
println(s"file $destName overwritten with $templateName")
}
lazy val root = (project in file("."))
.enablePlugins(PlayScala, DebianPlugin)
.settings(
libraryDependencies ~= (_.map(excludeSpecs2)),
copyLogbackTest := {
copyTemplate("conf/logback-test.xml.template", "conf/logback-test.xml")
},
forcedCopyLogbackTest := {
forcedCopyTemplate("conf/logback-test.xml.template", "conf/logback-test.xml")
},
copyTestData := {
copyTemplate("conf/testdata.conf.template", "conf/testdata.conf")
},
copyEmailConf := {
copyTemplate("conf/email.conf.template", "conf/email.conf")
},
developmentInit := {
copyLogbackTest.value
copyTestData.value
copyEmailConf.value
}
)
maintainer in Linux := "Canadian BioSample Repository <tech@biosample.ca>"
packageSummary in Linux := "Biorepository application for tracking biospecimens."
packageDescription := "Biorepository application for tracking biospecimens."
scalaVersion := Option(System.getProperty("scala.version")).getOrElse("2.12.8")
scalacOptions in Compile ++= Seq(
"-target:jvm-1.8",
"-encoding", "UTF-8",
"-deprecation", // warning and location for usages of deprecated APIs
"-feature", // warning and location for usages of features that should be imported explicitly
"-language:implicitConversions",
"-language:higherKinds",
"-language:existentials",
"-language:postfixOps",
"-unchecked", // additional warnings where generated code depends on assumptions
"-Xlint:_",
"-Ywarn-adapted-args", // Warn if an argument list is modified to match the receiver
"-Ywarn-dead-code",
"-Ywarn-inaccessible",
"-Ywarn-numeric-widen",
"-Ywarn-unused:params",
"-Ywarn-unused-import",
"-Ywarn-value-discard" // Warn when non-Unit expression results are unused
)
scalacOptions in (Compile,doc) ++= Seq("-groups", "-implicits")
fork in Test := true
javaOptions in Test ++= Seq(
"-Xms512M",
"-Xmx2048M",
"-XX:+CMSClassUnloadingEnabled",
"-Dconfig.file=conf/test.conf",
"-Dlogger.resource=logback-test.xml"
)
javacOptions in ThisBuild ++= Seq(
"-source", "1.8",
"-target", "1.8",
"-Xlint"
)
javaOptions in run ++= Seq(
"-Xms256M", "-Xmx2G", "-XX:+UseConcMarkSweepGC")
sources in (Compile, doc) ~= (_ filter (_.getParent contains "org/biobank"))
fork in run := true
testOptions in Test := Nil
(testOptions in Test) += Tests.Argument(TestFrameworks.ScalaTest, "-h", "target/report")
(testOptions in Test) += Tests.Argument(TestFrameworks.ScalaTest, "-oDS")
addCompilerPlugin("com.github.ghik" %% "silencer-plugin" % "1.3.1")
resolvers ++= Seq(
Classpaths.sbtPluginReleases,
"Typesafe repository" at "https://repo.typesafe.com/typesafe/releases/",
"Sonatype OSS" at "https://oss.sonatype.org/content/repositories/releases",
"Akka Snapshots" at "http://repo.akka.io/snapshots/",
Resolver.jcenterRepo
)
libraryDependencies ++= Seq(
guice,
ehcache,
filters,
"org.scala-stm" %% "scala-stm" % "0.9",
"com.typesafe.play" %% "play-json" % "2.6.9",
( "com.typesafe.akka" %% "akka-persistence" % akkaVer % "compile" )
.excludeAll(ExclusionRule(organization="com.google.protobuf")),
"com.typesafe.akka" %% "akka-persistence-query" % akkaVer % "compile",
"com.typesafe.akka" %% "akka-remote" % akkaVer % "compile",
( "com.github.dnvriend" %% "akka-persistence-jdbc" % "3.4.0" % "compile" )
.excludeAll(ExclusionRule(organization="com.typesafe.akka")),
"mysql" % "mysql-connector-java" % "8.0.13",
"org.scalaz" %% "scalaz-core" % "7.2.27" % "compile",
"com.github.mauricio" %% "mysql-async" % "0.2.21",
"com.github.t3hnar" %% "scala-bcrypt" % "3.1",
"com.github.ancane" %% "hashids-scala" % "1.3",
"com.typesafe.play" %% "play-mailer" % "6.0.1",
"com.typesafe.play" %% "play-mailer-guice" % "6.0.1",
"com.typesafe.scala-logging" %% "scala-logging" % "3.9.2",
"com.github.ghik" %% "silencer-lib" % "1.0" % "compile",
// Testing
( "com.github.dnvriend" %% "akka-persistence-inmemory" % "2.5.1.1" % "test" )
.excludeAll(ExclusionRule(organization="com.typesafe.akka")),
"com.typesafe.akka" %% "akka-testkit" % akkaVer % "test",
"org.scalatestplus.play" %% "scalatestplus-play" % "3.1.2" % "test",
"org.pegdown" % "pegdown" % "1.6.0" % "test",
"org.codehaus.janino" % "janino" % "3.0.11" % "test",
"org.mockito" % "mockito-core" % "2.23.4" % "test",
"it.bitbl" %% "scala-faker" % "0.4" % "test",
"com.chuusai" %% "shapeless" % "2.3.3" % "test",
"org.gnieh" %% "diffson-play-json" % "3.1.0" % "test"
)
routesGenerator := InjectedRoutesGenerator
// To completely override the optimization process, use this config option:
//requireNativePath := Some("node r.js -o name=main out=javascript-min/main.min.js")
PB.targets in Compile := Seq(
scalapb.gen() -> (sourceManaged in Compile).value
)
coverageExcludedPackages := "<empty>;router.*;views.html.*;Reverse.*;org.biobank.infrastructure.event.*;org.biobank.TestData"
wartremoverErrors in (Compile, compile) ++= Warts.allBut(Wart.ArrayEquals, Wart.Nothing, Wart.Equals, Wart.ToString)
// see following for explanation: https://github.com/puffnfresh/wartremover/issues/219
wartremoverExcluded ++= ((crossTarget.value / "src_managed" / "main" / "compiled_protobuf" ) ** "*.scala").get
wartremoverExcluded ++= Seq(
crossTarget.value / "routes" / "main" / "router" / "Routes.scala",
crossTarget.value / "routes" / "main" / "router" / "RoutesPrefix.scala",
crossTarget.value / "routes" / "main" / "controllers" / "ReverseRoutes.scala",
crossTarget.value / "routes" / "main" / "controllers" / "javascript" / "JavaScriptReverseRoutes.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "AccessEvents" / "AccessEvent.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "AccessEvents" / "AccessEventsProto.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "MembershipEvents" / "MembershipEvent.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "MembershipEvents" / "MembershipEventsProto.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "CentreEvents" / "CentreAddedEvent.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "CentreEvents" / "CentreDescriptionUpdatedEvent.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "CentreEvents" / "CentreDisabledEvent.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "CentreEvents" / "CentreEnabledEvent.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "CentreEvents" / "CentreEvent.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "CentreEvents" / "CentreEventsProto.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "CentreEvents" / "CentreLocationAddedEvent.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "CentreEvents" / "CentreLocationRemovedEvent.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "CentreEvents" / "CentreLocationUpdatedEvent.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "CentreEvents" / "CentreNameUpdatedEvent.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "CentreEvents" / "StudyAddedToCentreEvent.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "CentreEvents" / "StudyRemovedFromCentreEvent.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "CollectionEventEvents" / "CollectionEventEvent.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "CollectionEventEvents" / "CollectionEventEventsProto.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "CollectionEventTypeEvents" / "CollectionEventTypeEvent.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "CollectionEventTypeEvents" / "CollectionEventTypeEventsProto.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "CommonEvents" / "Annotation.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "CommonEvents" / "AnnotationType.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "CommonEvents" / "AnnotationTypeRemoved.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "CommonEvents" / "CommonEventsProto.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "CommonEvents" / "Location.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "ParticipantEvents" / "ParticipantEvent.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "ParticipantEvents" / "ParticipantEventsProto.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "ProcessingTypeEvents" / "ProcessingTypeEvent.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "ProcessingTypeEvents" / "ProcessingTypeEventsProto.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "ShipmentEvents" / "ShipmentEvent.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "ShipmentEvents" / "ShipmentEventsProto.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "ShipmentSpecimenEvents" / "ShipmentSpecimenEvent.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "ShipmentSpecimenEvents" / "ShipmentSpecimenEventsProto.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "SpecimenEvents" / "SpecimenEvent.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "SpecimenEvents" / "SpecimenEventsProto.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "StudyEvents" / "CollectionEventTypeAddedEvent.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "StudyEvents" / "CollectionEventTypeRemovedEvent.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "StudyEvents" / "CollectionEventTypeUpdatedEvent.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "StudyEvents" / "ProcessingTypeAddedEvent.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "StudyEvents" / "ProcessingTypeRemovedEvent.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "StudyEvents" / "ProcessingTypeUpdatedEvent.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "StudyEvents" / "SpecimenGroupAddedEvent.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "StudyEvents" / "SpecimenGroupRemovedEvent.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "StudyEvents" / "SpecimenGroupUpdatedEvent.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "StudyEvents" / "SpecimenLinkAnnotationTypeAddedEvent.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "StudyEvents" / "SpecimenLinkAnnotationTypeRemovedEvent.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "StudyEvents" / "SpecimenLinkAnnotationTypeUpdatedEvent.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "StudyEvents" / "SpecimenLinkTypeAddedEvent.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "StudyEvents" / "SpecimenLinkTypeRemovedEvent.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "StudyEvents" / "SpecimenLinkTypeUpdatedEvent.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "StudyEvents" / "StudyEvent.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "StudyEvents" / "StudyEventOld.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "StudyEvents" / "StudyEventsProto.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "UserEvents" / "UserEvent.scala",
crossTarget.value / "src_managed" / "main" / "org" / "biobank" / "infrastructure" / "events" / "UserEvents" / "UserEventsProto.scala"
)