-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
199 lines (176 loc) · 8.29 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
import sbt.Keys._
lazy val UnitTest = config("unit").extend(Test)
lazy val ItTest = config("it").extend(Test)
/////////////////////// DEPENDENCIES /////////////////////////
val akkaV = "2.4.17"
val akkaHttpV = "10.0.5"
val sangriaV = "1.0.0"
val akkaActor = "com.typesafe.akka" %% "akka-actor" % akkaV
val akkaHttp = "com.typesafe.akka" %% "akka-http-core" % akkaHttpV
val akkaHttpCore = "com.typesafe.akka" %% "akka-http" % akkaHttpV
val sprayJson = "com.typesafe.akka" %% "akka-http-spray-json" % akkaHttpV
val sangria = "org.sangria-graphql" %% "sangria" % sangriaV excludeAll(
ExclusionRule(organization = "org.parboiled"))
val sangriaJson = "org.sangria-graphql" %% "sangria-spray-json" % sangriaV excludeAll(
ExclusionRule(organization = "org.parboiled"))
val slick = "com.typesafe.slick" %% "slick" % "3.2.0"
val logback = "ch.qos.logback" % "logback-classic" % "1.2.3"
val postgresql = "postgresql" % "postgresql" % "9.1-901.jdbc4"
val hikariSlick = "com.typesafe.slick" %% "slick-hikaricp" % "3.2.0"
val gnparser = "org.globalnames" %% "gnparser" % "0.3.4-20170220_1130UTC-SNAPSHOT"
val gnmatcher = "org.globalnames" %% "gnmatcher" % "0.1.1"
val scalaz = "org.scalaz" %% "scalaz-core" % "7.1.7"
val jodaTime = "joda-time" % "joda-time" % "2.9.9" % Test
val jodaConvert = "org.joda" % "joda-convert" % "1.8.1" % Test
val scalatest = "org.scalatest" %% "scalatest" % "2.2.6" % Test
val akkaHttpTestkit = "com.typesafe.akka" %% "akka-http-testkit" % akkaHttpV % Test
val pegdown = "org.pegdown" % "pegdown" % "1.6.0" % Test
val commonsio = "commons-io" % "commons-io" % "2.5" % Test
val mockito = "org.mockito" % "mockito-core" % "2.2.5" % Test
//////////////////////////////////////////////////////////////
val commonSettings = Seq(
version := "0.1.0-SNAPSHOT",
scalaVersion in ThisBuild := "2.11.8",
organization := "org.globalnames",
homepage := Some(new URL("http://globalnames.org/")),
description := "Global scientific names resolver",
startYear := Some(2015),
licenses := Seq("MIT" -> new URL("https://github.com/GlobalNamesArchitecture/gnresolver/blob/master/LICENSE")),
resolvers ++= Seq(
"scalaz-bintray" at "http://dl.bintray.com/scalaz/releases",
"sonatype snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/"
),
javacOptions ++= Seq(
"-encoding", "UTF-8",
"-source", "1.6",
"-target", "1.6",
"-Xlint:unchecked",
"-Xlint:deprecation"),
scalacOptions ++= List(
"-encoding", "UTF-8",
"-feature",
"-unchecked",
"-deprecation",
"-Xlint",
"-language:_",
"-target:jvm-1.6",
"-Xlog-reflective-calls"),
javaOptions += "-Dlog.level=" + sys.env.getOrElse("LOG_LEVEL", "OFF"),
scalacOptions in Test ++= Seq("-Yrangepos")
)
val testSettings = Seq(
fork in Test := true,
javaOptions in test += "-Xms512M -Xmx512M -XX:+UseConcMarkSweepGC -XX:+UseParNewGC",
libraryDependencies += pegdown,
parallelExecution in ItTest := false,
test in Test := (test in ItTest).dependsOn(test in UnitTest).value,
testOptions in UnitTest := Seq(
Tests.Argument("-h", "target/test-html"),
Tests.Argument("-u", "target/test-xml"),
Tests.Argument("-C", "org.globalnames.resolver.TestReporter"),
Tests.Argument("-oD"), // Configuring summaries has no effect when running with SBT
Tests.Argument("-eTNCXEHLOPQRM"), // T = full backtraces, NCXEHLOPQRM = Ignore all events that are already sent to out (SBT)
Tests.Filter { testName => !testName.contains("Integration") }
),
testOptions in ItTest := Seq(
Tests.Argument("-h", "target/test-html"),
Tests.Argument("-u", "target/test-xml"),
Tests.Argument("-C", "org.globalnames.resolver.TestReporter"),
Tests.Argument("-W", "2", "2"), // warn on slow tests (over 2 seconds) every 2 seconds
Tests.Argument("-oD"), // Configuring summaries has no effect when running with SBT
Tests.Argument("-eTNCXEHLOPQRM"), // T = full backtraces, NCXEHLOPQRM = Ignore all events that are already sent to out (SBT)
Tests.Filter { testName => testName.contains("Integration") }
)
)
val publishingSettings = Seq(
publishMavenStyle := true,
useGpg := true,
publishTo := {
val nexus = "https://oss.sonatype.org/"
if (isSnapshot.value) Some("snapshots" at nexus + "content/repositories/snapshots")
else Some("releases" at nexus + "service/local/staging/deploy/maven2")
},
pomIncludeRepository := { _ => false },
pomExtra :=
<scm>
<url>git@github.com:GlobalNamesArchitecture/gnresolver.git</url>
<connection>scm:git:git@github.com:GlobalNamesArchitecture/gnresolver.git</connection>
</scm>
<developers>
<developer>
<id>dimus</id>
<name>Dmitry Mozzherin</name>
</developer>
<developer>
<id>alexander-myltsev</id>
<name>Alexander Myltsev</name>
<url>http://myltsev.com</url>
</developer>
</developers>)
val noPublishingSettings = Seq(
publishArtifact := false,
publishTo := Some(Resolver.file("Unused transient repository", file("target/unusedrepo"))))
/////////////////////// PROJECTS /////////////////////////
lazy val `gnresolver-root` = project.in(file("."))
.aggregate(resolver, benchmark, api, front)
.settings(noPublishingSettings: _*)
.settings(
crossScalaVersions := Seq("2.11.8", "2.12.1")
)
lazy val resolver = (project in file("./resolver"))
.configs(UnitTest, ItTest)
.settings(inConfig(UnitTest)(Defaults.testTasks))
.settings(inConfig(ItTest)(Defaults.testTasks))
.enablePlugins(BuildInfoPlugin)
.settings(commonSettings ++ publishingSettings ++ testSettings: _*)
.settings(
name := "gnresolver",
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion),
buildInfoPackage := "org.globalnames.resolver",
test in assembly := {},
libraryDependencies ++= Seq(slick, logback, postgresql, hikariSlick, gnparser, gnmatcher,
sangria, sangriaJson, scalatest, jodaTime, jodaConvert, mockito)
)
lazy val benchmark = (project in file("./benchmark"))
.dependsOn(resolver)
.enablePlugins(JmhPlugin)
.settings(commonSettings: _*)
.settings(noPublishingSettings: _*)
.settings(
name := "gnresolver-benchmark"
)
lazy val api = (project in file("./api"))
.dependsOn(resolver)
.configs(UnitTest, ItTest)
.settings(inConfig(UnitTest)(Defaults.testTasks))
.settings(inConfig(ItTest)(Defaults.testTasks))
.enablePlugins(BuildInfoPlugin)
.settings(commonSettings ++ testSettings: _*)
.settings(
name := "gnresolver-api",
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion),
buildInfoPackage := "org.globalnames.resolver.api",
mainClass in reStart := Some("org.globalnames.resolver.api.GnresolverMicroservice"),
libraryDependencies ++= Seq(akkaActor, akkaHttpCore, akkaHttp, sprayJson, akkaHttpTestkit,
scalatest, jodaTime, jodaConvert, commonsio, mockito),
mainClass in assembly := Some("org.globalnames.resolver.api.GnresolverMicroservice"),
test in assembly := {},
assemblyMergeStrategy in assembly := {
case "logback.xml" => MergeStrategy.last
case x =>
val oldStrategy = (assemblyMergeStrategy in assembly).value
oldStrategy(x)
}
)
lazy val front = (project in file("./front"))
.enablePlugins(PlayScala)
.settings(commonSettings: _*)
.settings(noPublishingSettings: _*)
.settings(
name := "gnresolver-front",
packageName := "gnresolver-front",
pipelineStages := Seq(digest, gzip),
libraryDependencies ++= Seq(
filters, cache, ws, gnparser
)
)