-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.sbt
More file actions
202 lines (171 loc) · 6.17 KB
/
build.sbt
File metadata and controls
202 lines (171 loc) · 6.17 KB
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
/**
* Build file for Scala Parsec modules.
* Manages build settings and dependencies (internal & external) for each submodule.
* Creates deployable units via assembly plugin.
*/
/** Dependency defs */
import Versions._
def baseScalaVersion = "2.11.8"
def baseScalaBinaryVersion = "2.11"
/** Akka */
def akkaActor = "com.typesafe.akka" %% "akka-actor" % akkaVersion
def akkaHttp = "com.typesafe.akka" %% "akka-http-experimental" % akkaVersion
def akkaHttpTestkit = "com.typesafe.akka" %% "akka-http-testkit" % akkaVersion % "test"
def akkaSlf4j = "com.typesafe.akka" %% "akka-slf4j" % akkaVersion
def akkaStream = "com.typesafe.akka" %% "akka-stream" % akkaVersion
def akkaStreamTestkit = "com.typesafe.akka" %% "akka-stream-testkit" % akkaVersion % "test"
def akka = Seq(
akkaActor,
akkaHttp,
akkaHttpTestkit,
akkaSlf4j,
akkaStream,
akkaStreamTestkit
)
/** Cats */
def cats = Seq(
"org.typelevel" %% "cats-macros" % catsVersion,
"org.typelevel" %% "cats-core" % catsVersion
)
/** Datetime */
def nScalaTime = "com.github.nscala-time" %% "nscala-time" % "2.14.0"
/** Enum support */
def enumeratum = "com.beachape" %% "enumeratum-macros" % "1.3.7"
/** JSON */
def json4sNative = "org.json4s" %% "json4s-native" % "3.3.0"
/** Kafka */
def avro4s = "com.sksamuel.avro4s" %% "avro4s-core" % "1.6.2"
def kafkaCore = "org.apache.kafka" %% "kafka" % kafkaVersion
def kafkaAvroSerializer = "io.confluent" % "kafka-avro-serializer" % confluentVersion
def kafka = Seq(
avro4s,
kafkaCore,
kafkaAvroSerializer
)
/** Cryptography */
def bouncycastle = "org.bouncycastle" % "bcprov-ext-debug-jdk15on" % "1.55"
def codec = "org.apache.directory.studio" % "org.apache.commons.codec" % "1.8"
def bitcoinj = "org.bitcoinj" % "bitcoinj-core" % "0.14.3"
def crypto = Seq(
bouncycastle,
codec,
bitcoinj
)
/** Logging */
def slf4jApi = "org.slf4j" % "slf4j-api" % slf4jVersion
def log4jOverSlf4j = "org.slf4j" % "log4j-over-slf4j" % slf4jVersion
def logbackClassic = "ch.qos.logback" % "logback-classic" % "1.1.2"
/** Testing */
def scalatest = "org.scalatest" %% "scalatest" % "2.2.6" % "test"
def scalacheck = Seq(
"org.scalacheck" %% "scalacheck" % "1.12.5" % "test",
"org.typelevel" %% "shapeless-scalacheck" % "0.4" % "test"
)
def testing = scalacheck :+ scalatest
/** Dependency settings */
lazy val baseJavaDependencies = Seq(
"org.apache.commons" % "commons-lang3" % "3.3.2",
"commons-io" % "commons-io" % "2.4",
"com.typesafe" % "config" % "1.2.1",
slf4jApi,
log4jOverSlf4j,
logbackClassic
)
lazy val baseScalaDependencies = Seq(
"org.scala-lang" % "scala-reflect" % baseScalaVersion
) ++ cats
/** Repositories */
val sonatypeSnapshots = "Sonatype snapshots" at "http://oss.sonatype.org/content/repositories/snapshots/"
val ukMavenCentral = "UK Maven Central" at "http://uk.maven.org/maven2"
val typesafeReleases = "Typesafe releases" at "http://repo.typesafe.com/typesafe/releases/"
lazy val resolvers = Seq(Resolver.defaultLocal, sonatypeSnapshots, ukMavenCentral, typesafeReleases)
/** Project settings */
lazy val baseProjectSettings = Seq(
organization := "org.parsec",
scalaBinaryVersion := baseScalaBinaryVersion,
scalaVersion := baseScalaVersion,
externalResolvers := resolvers,
moduleConfigurations := Seq(),
retrieveManaged := true,
transitiveClassifiers in Scope.GlobalScope := Seq("sources"),
ivyLoggingLevel := UpdateLogging.Quiet,
crossPaths := false,
publishMavenStyle := true,
javacOptions := Seq("-source", "1.8", "-target", "1.8", "-encoding", "utf8"),
javaOptions := Seq("-server", "-XX:ReservedCodeCacheSize=192m", "-Xss2m"),
javaOptions in Test := Seq("-server", "-Xmx2g", "-XX:ReservedCodeCacheSize=192m", "-Xss2m"),
testFrameworks := Seq(TestFrameworks.ScalaTest),
noTestCompletion(),
scalacOptions := Seq(
"-deprecation",
"-optimize",
"-unchecked",
"-encoding", "utf8",
"-target:jvm-1.8",
"-Xlog-reflective-calls",
"-feature",
"-language:_"
) ++ Seq(
"by-name-right-associative",
"delayedinit-select",
"doc-detached",
"inaccessible",
"missing-interpolator",
"nullary-override",
"option-implicit",
"package-object-classes",
"poly-implicit-overload",
"private-shadow",
"unsound-match"
).map(x => s"-Xlint:$x"),
compileOrder := CompileOrder.JavaThenScala,
fork in Test := true,
testOptions in Test := Seq(Tests.Filter(testName => testName.endsWith("Tests"))),
testOptions in Test += Tests.Argument("-oDF")
)
lazy val javaProjectSettings = baseProjectSettings ++ Seq(
libraryDependencies ++= baseJavaDependencies
)
lazy val scalaProjectSettings = javaProjectSettings ++ Seq(
libraryDependencies ++= baseScalaDependencies
)
/** Module projects; not configured for deployment as jar */
val fullScope = "compile->compile;test->test"
lazy val build = Project(
"build",
file("."),
settings = baseProjectSettings
).aggregate(common, domain, simulator)
lazy val common = Project(
"common",
file("common"),
settings = scalaProjectSettings ++ Seq(
libraryDependencies ++= testing :+ enumeratum
)
)
lazy val domain = Project(
"domain",
file("domain"),
settings = scalaProjectSettings ++ Seq(
libraryDependencies ++= testing ++ crypto
)
).dependsOn(common % fullScope)
/** Deployable projects; use sbt/assembly task to build fat jar */
lazy val restApi = Project(
"rest-api",
file("rest-api"),
settings = scalaProjectSettings ++ Seq(
assemblyJarName in assembly := "parsec-rest-api.jar",
libraryDependencies ++= testing ++ akka
)
)
lazy val simulator = Project(
"simulator",
file("simulator"),
settings = scalaProjectSettings ++ Seq(
mainClass in (Compile, assembly) := Some("org.parsec.ParsecSimulator"),
mainClass in run := Some("org.parsec.ParsecSimulator"),
assemblyJarName in assembly := "parsec-simulator.jar",
libraryDependencies ++= testing ++ kafka :+ nScalaTime
)
).dependsOn(common % fullScope, domain % fullScope)