forked from zio/zio-sql
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
228 lines (205 loc) · 9 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
import BuildHelper._
import InfrastructureHelper._
import explicitdeps.ExplicitDepsPlugin.autoImport.moduleFilterRemoveValue
import sbtcrossproject.CrossPlugin.autoImport.crossProject
inThisBuild(
List(
organization := "dev.zio",
homepage := Some(url("https://zio.github.io/zio-sql/")),
licenses := List("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")),
developers := List(
Developer("jdegoes", "John De Goes", "[email protected]", url("http://degoes.net"))
),
pgpPassphrase := sys.env.get("PGP_PASSWORD").map(_.toArray),
pgpPublicRing := file("/tmp/public.asc"),
pgpSecretRing := file("/tmp/secret.asc"),
scmInfo := Some(
ScmInfo(url("https://github.com/zio/zio-sql/"), "scm:git:[email protected]:zio/zio-sql.git")
)
)
)
addCommandAlias("fmtOnce", "all scalafmtSbt scalafmt test:scalafmt")
addCommandAlias("fmt", "fmtOnce;fmtOnce")
addCommandAlias("check", "all scalafmtSbtCheck scalafmtCheck test:scalafmtCheck")
val zioVersion = "2.0.0-RC6"
val zioSchemaVersion = "0.1.9"
val testcontainersVersion = "1.17.2"
val testcontainersScalaVersion = "0.40.7"
lazy val startPostgres = taskKey[Unit]("Start up Postgres")
startPostgres := startService(Database.Postgres, streams.value)
lazy val stopPostgres = taskKey[Unit]("Shut down Postgres")
stopPostgres := stopService(Database.Postgres, streams.value)
lazy val startMySQL = taskKey[Unit]("Start up MySQL")
startMySQL := startService(Database.MySQL, streams.value)
lazy val stopMySQL = taskKey[Unit]("Shut down MySQL")
stopMySQL := stopService(Database.MySQL, streams.value)
lazy val startMsSQL = taskKey[Unit]("Start up Microsoft SQL Server")
startMsSQL := startService(Database.MSSQL, streams.value)
lazy val stopMsSQL = taskKey[Unit]("Shut down Microsoft SQL Server")
stopMsSQL := stopService(Database.MSSQL, streams.value)
lazy val startOracle = taskKey[Unit]("Start up Oracle")
startOracle := startService(Database.Oracle, streams.value)
lazy val stopOracle = taskKey[Unit]("Shut down Oracle")
stopOracle := stopService(Database.Oracle, streams.value)
lazy val root = project
.in(file("."))
.settings(
publish / skip := true,
unusedCompileDependenciesFilter -= moduleFilter("org.scala-js", "scalajs-library")
)
.aggregate(
coreJVM,
coreJS,
docs,
driver,
examples,
jdbc,
mysql,
oracle,
postgres,
sqlserver
)
lazy val core = crossProject(JSPlatform, JVMPlatform)
.in(file("core"))
.settings(stdSettings("zio-sql"))
.settings(crossProjectSettings)
.settings(buildInfoSettings("zio.sql"))
.settings(
libraryDependencies ++= Seq(
"dev.zio" %% "zio" % zioVersion,
"dev.zio" %% "zio-streams" % zioVersion,
"dev.zio" %% "zio-schema" % zioSchemaVersion,
"dev.zio" %% "zio-schema-derivation" % zioSchemaVersion,
"dev.zio" %% "zio-test" % zioVersion % Test,
"dev.zio" %% "zio-test-sbt" % zioVersion % Test
),
dependencyOverrides += "dev.zio" %% "zio" % zioVersion,
resolvers += Resolver.sonatypeRepo("snapshots")
)
.settings(testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework"))
lazy val coreJS = core.js
.settings(scalaJSUseMainModuleInitializer := true)
lazy val coreJVM = core.jvm
lazy val docs = project
.in(file("zio-sql-docs"))
.settings(
publish / skip := true,
moduleName := "zio-sql-docs",
scalacOptions -= "-Yno-imports",
scalacOptions -= "-Xfatal-warnings"
)
.dependsOn(postgres)
.enablePlugins(MdocPlugin, DocusaurusPlugin)
lazy val examples = project
.in(file("examples"))
.settings(stdSettings("examples"))
.settings(
publish / skip := true,
moduleName := "examples"
)
.dependsOn(postgres)
lazy val driver = project
.in(file("driver"))
.settings(stdSettings("zio-sql-driver"))
.settings(buildInfoSettings("zio.sql.driver"))
.settings(
libraryDependencies ++= Seq(
"dev.zio" %% "zio" % zioVersion,
"dev.zio" %% "zio-schema" % zioSchemaVersion,
"dev.zio" %% "zio-schema-derivation" % zioSchemaVersion,
"dev.zio" %% "zio-test" % zioVersion % Test,
"dev.zio" %% "zio-test-sbt" % zioVersion % Test
),
dependencyOverrides += "dev.zio" %% "zio" % zioVersion,
resolvers += Resolver.sonatypeRepo("snapshots")
)
.settings(testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework"))
lazy val jdbc = project
.in(file("jdbc"))
.settings(stdSettings("zio-sql-jdbc"))
.settings(buildInfoSettings("zio.sql.jdbc"))
.settings(
libraryDependencies ++= Seq(
"dev.zio" %% "zio-test" % zioVersion % Test,
"dev.zio" %% "zio-test-sbt" % zioVersion % Test,
"org.postgresql" % "postgresql" % "42.3.5" % Test,
"com.dimafeng" %% "testcontainers-scala-postgresql" % testcontainersScalaVersion % Test
)
)
.settings(
Seq(
Compile / doc / scalacOptions ++= Seq(
"-no-link-warnings" // Suppresses problems with Scaladoc links
)
)
)
.settings(testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework"))
.dependsOn(core.jvm)
lazy val mysql = project
.in(file("mysql"))
.dependsOn(jdbc % "compile->compile;test->test")
.dependsOn(driver)
.settings(stdSettings("zio-sql-mysql"))
.settings(buildInfoSettings("zio.sql.mysql"))
.settings(
libraryDependencies ++= Seq(
"org.testcontainers" % "testcontainers" % testcontainersVersion % Test,
"org.testcontainers" % "database-commons" % testcontainersVersion % Test,
"org.testcontainers" % "jdbc" % testcontainersVersion % Test,
"org.testcontainers" % "mysql" % testcontainersVersion % Test,
"mysql" % "mysql-connector-java" % "8.0.29" % Test,
"com.dimafeng" %% "testcontainers-scala-mysql" % testcontainersScalaVersion % Test
)
)
.settings(testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework"))
lazy val oracle = project
.in(file("oracle"))
.dependsOn(jdbc % "compile->compile;test->test")
.dependsOn(driver)
.settings(stdSettings("zio-sql-oracle"))
.settings(buildInfoSettings("zio.sql.oracle"))
.settings(
libraryDependencies ++= Seq(
"org.testcontainers" % "testcontainers" % testcontainersVersion % Test,
"org.testcontainers" % "database-commons" % testcontainersVersion % Test,
"org.testcontainers" % "oracle-xe" % testcontainersVersion % Test,
"org.testcontainers" % "jdbc" % testcontainersVersion % Test,
"com.oracle.database.jdbc" % "ojdbc8" % "21.5.0.0" % Test,
"com.dimafeng" %% "testcontainers-scala-oracle-xe" % testcontainersScalaVersion % Test
)
)
.settings(testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework"))
lazy val postgres = project
.in(file("postgres"))
.dependsOn(jdbc % "compile->compile;test->test")
.dependsOn(driver)
.settings(stdSettings("zio-sql-postgres"))
.settings(buildInfoSettings("zio.sql.postgres"))
.settings(
libraryDependencies ++= Seq(
"org.testcontainers" % "testcontainers" % testcontainersVersion % Test,
"org.testcontainers" % "database-commons" % testcontainersVersion % Test,
"org.testcontainers" % "postgresql" % testcontainersVersion % Test,
"org.testcontainers" % "jdbc" % testcontainersVersion % Test,
"org.postgresql" % "postgresql" % "42.3.5" % Compile,
"com.dimafeng" %% "testcontainers-scala-postgresql" % testcontainersScalaVersion % Test
)
)
.settings(testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework"))
lazy val sqlserver = project
.in(file("sqlserver"))
.dependsOn(jdbc % "compile->compile;test->test")
.dependsOn(driver)
.settings(stdSettings("zio-sql-sqlserver"))
.settings(buildInfoSettings("zio.sql.sqlserver"))
.settings(
libraryDependencies ++= Seq(
"org.testcontainers" % "testcontainers" % testcontainersVersion % Test,
"org.testcontainers" % "database-commons" % testcontainersVersion % Test,
"org.testcontainers" % "mssqlserver" % testcontainersVersion % Test,
"org.testcontainers" % "jdbc" % testcontainersVersion % Test,
"com.microsoft.sqlserver" % "mssql-jdbc" % "9.4.0.jre8" % Test,
"com.dimafeng" %% "testcontainers-scala-mssqlserver" % testcontainersScalaVersion % Test
)
)
.settings(testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework"))