forked from giiita/refuel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
211 lines (190 loc) · 6.18 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
import sbt.Keys.crossScalaVersions
import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations._
lazy val buildTargetVersion = Seq("2.11.12", "2.12.10", "2.13.1")
lazy val assemblySettings = Seq(
publishTo := Some(
if (isSnapshot.value)
Opts.resolver.sonatypeSnapshots
else
Opts.resolver.sonatypeStaging
),
organization := "com.phylage",
scalacOptions in Test ++= Seq(
"-deprecation",
"-unchecked",
"-feature",
"-Xlint",
"-Ywarn-dead-code",
"-Ywarn-numeric-widen",
"-Ywarn-value-discard",
"-language:higherKinds",
"-language:implicitConversions"
),
releaseCrossBuild := true,
crossScalaVersions := buildTargetVersion,
licenses += ("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0.html")),
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
tagRelease,
releaseStepCommandAndRemaining("+publishSigned"),
ReleaseStep(action = Command.process("sonatypeRelease", _), enableCrossBuild = true)
)
)
def scl213[T](f: => Seq[T]): Def.Initialize[Seq[T]] = Def.setting {
scalaVersion.value match {
case "2.13.1" => f
case _ => Nil
}
}
def notScl213[T](f: => Seq[T]): Def.Initialize[Seq[T]] = Def.setting {
scalaVersion.value match {
case "2.13.1" => Nil
case _ => f
}
}
lazy val commonDependencySettings = Seq(
libraryDependencies ++= {
Seq(
"org.scalatest" %% "scalatest" % "3.1.0" % Test
)
},
libraryDependencies ++= scl213(Seq("org.scala-lang.modules" %% "scala-parallel-collections" % "0.2.0")).value
)
lazy val root = project.in(file("."))
.aggregate(
`macro`,
container,
util,
json,
http,
root_interfaces,
interfaces_impl,
call_interfaces
).settings(
publishLocal in ThisProject := {},
publishArtifact in ThisProject := false,
crossScalaVersions := buildTargetVersion,
resourceDirectories in Compile += {
(ThisProject / baseDirectory).value / "project" / "resources"
}
)
lazy val `macro` = (project in file("refuel-macro"))
.settings(assemblySettings, commonDependencySettings)
.settings(
name := "refuel-macro",
description := "Lightweight DI container for Scala.",
libraryDependencies ++= {
Seq(
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
"com.typesafe" % "config" % "1.3.4"
)
},
scalacOptions += "-language:experimental.macros"
)
lazy val container = (project in file("refuel-container"))
.settings(assemblySettings, commonDependencySettings)
.dependsOn(`macro`)
.settings(
name := "refuel-container",
description := "Lightweight DI container for Scala.",
parallelExecution in Test := false,
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
"com.typesafe.scala-logging" %% "scala-logging" % "3.9.2"
),
scalacOptions in Global ++= Seq(
// "-Ydebug",
// "-Ymacro-debug-verbose",
"-language:experimental.macros"
),
unmanagedClasspath in Compile ++= (unmanagedResources in Compile).value
).enablePlugins(JavaAppPackaging)
lazy val util = (project in file("refuel-util"))
.settings(assemblySettings, commonDependencySettings)
.dependsOn(container)
.settings(
name := "refuel-util",
parallelExecution in Test := true
).enablePlugins(JavaAppPackaging)
lazy val json = (project in file("refuel-json"))
.settings(assemblySettings, commonDependencySettings)
.dependsOn(util)
.settings(
name := "refuel-json",
description := "Various classes serializer / deserializer",
resourceDirectory in Jmh := (resourceDirectory in Compile).value,
javacOptions in Compile ++= Seq("-source", "1.8", "-target", "1.8")
).enablePlugins(JavaAppPackaging, JmhPlugin)
lazy val cipher = (project in file("refuel-cipher"))
.dependsOn(json)
.settings(assemblySettings, commonDependencySettings)
.settings(
name := "refuel-cipher",
description := "Cipher module for Scala.",
unmanagedClasspath in Test ++= (unmanagedResources in Compile).value,
).enablePlugins(JavaAppPackaging)
lazy val http = (project in file("refuel-http"))
.dependsOn(json)
.settings(assemblySettings, commonDependencySettings)
.settings(
name := "refuel-http",
description := "Http client for Scala.",
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-actor" % "2.5.23",
"com.typesafe.akka" %% "akka-stream" % "2.5.23",
"com.typesafe.akka" %% "akka-http-jackson" % "10.1.8",
"com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.9.9"
),
unmanagedClasspath in Test ++= (unmanagedResources in Compile).value,
testOptions in Test ++= Seq(
Tests.Setup { _ =>
import scala.sys.process._
Process("sh sh/setup-testing-http-server.sh").run
Http.connect("http://localhost:3289/endpoint")
},
Tests.Cleanup { _ =>
import scala.sys.process._
Process("sh sh/shutdown-testing-http-server.sh").run
}
)
).enablePlugins(JavaAppPackaging)
lazy val `test` = (project in file("refuel-test"))
.dependsOn(json)
.settings(assemblySettings, commonDependencySettings)
.settings(
name := "refuel-test",
description := "DI testing framework."
).enablePlugins(JavaAppPackaging)
lazy val root_interfaces = (project in file("test-across-module/root_interfaces"))
.dependsOn(http)
.settings(commonDependencySettings, assemblySettings)
.settings(
publishArtifact := false,
releaseProcess := Nil,
publish := {},
publishLocal := {},
publishTo := None
).enablePlugins(JmhPlugin)
lazy val interfaces_impl = (project in file("test-across-module/interfaces_impl"))
.dependsOn(root_interfaces)
.settings(commonDependencySettings, assemblySettings)
.settings(
publishArtifact := false,
releaseProcess := Nil,
publish := {},
publishLocal := {},
publishTo := None
)
lazy val call_interfaces = (project in file("test-across-module/call_interfaces"))
.dependsOn(interfaces_impl)
.settings(commonDependencySettings, assemblySettings)
.settings(
publishArtifact := false,
releaseProcess := Nil,
publish := {},
publishLocal := {},
publishTo := None
)