-
Notifications
You must be signed in to change notification settings - Fork 37
/
build.sbt
172 lines (155 loc) · 5.87 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
import sbtcrossproject.CrossPlugin.autoImport.crossProject
val Scala213 = "2.13.6"
val Scala212 = "2.12.15"
val Scala3 = "3.1.2"
Global / onChangedBuildSource := ReloadOnSourceChanges
ThisBuild / crossScalaVersions := Seq(Scala212, Scala213, Scala3)
ThisBuild / licenses := Seq("MIT" -> new java.net.URL("http://opensource.org/licenses/MIT"))
ThisBuild / startYear := Some(2018)
ThisBuild / developers := List(
Developer(
"christopherdavenport",
"Christopher Davenport",
"chris@christopherdavenport.tech",
url("https://christopherdavenport.github.io/")
),
Developer(
"JesusMtnez",
"Jesús Martínez-B. H.",
"jesusmartinez93@gmail.com",
url("https://jesusmtnez.es/")
)
)
ThisBuild / githubWorkflowAddedJobs ++= Seq(
WorkflowJob(
"scalafmt",
"Scalafmt",
githubWorkflowJobSetup.value.toList ::: List(
WorkflowStep.Sbt(List("scalafmtCheckAll", "scalafmtSbtCheck"), name = Some("Scalafmt"))
),
// Awaiting release of https://github.com/scalameta/scalafmt/pull/2324/files
scalas = List(Scala3)
)
)
def crossCompileDirs(scalaVersion: String, baseDirectory: File) = {
val major = CrossVersion.partialVersion(scalaVersion) match {
case Some((2, _)) => "-2"
case _ => "-3"
}
List(CrossType.Pure, CrossType.Full).flatMap(
_.sharedSrcDir(baseDirectory, "main").toList.map(f => file(f.getPath + major))
)
}
lazy val fuuid = project
.in(file("."))
.disablePlugins(MimaPlugin)
.enablePlugins(NoPublishPlugin)
.settings(commonSettings)
.aggregate(coreJS, coreJVM, doobie, http4s, circeJS, circeJVM)
lazy val core = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.in(file("modules/core"))
.settings(commonSettings)
.settings(
Compile / unmanagedSourceDirectories ++= crossCompileDirs(
scalaVersion.value,
baseDirectory.value
)
)
.settings(
name := "fuuid"
)
lazy val coreJS = core.js
lazy val coreJVM = core.jvm
lazy val doobie = project
.in(file("modules/doobie"))
.settings(commonSettings)
.settings(
name := "fuuid-doobie",
libraryDependencies ++= Seq(
"org.tpolecat" %% "doobie-core" % doobieV,
"org.tpolecat" %% "doobie-postgres" % doobieV % Test,
"org.tpolecat" %% "doobie-h2" % doobieV % Test,
"org.tpolecat" %% "doobie-munit" % doobieV % Test,
"org.typelevel" %% "discipline-munit" % disciplineMunit % Test,
"org.scalameta" %% "munit" % munitV % Test,
"org.scalameta" %% "munit-scalacheck" % munitV % Test,
"org.typelevel" %%% "munit-cats-effect-3" % munitCE3V % Test,
("com.dimafeng" %% "testcontainers-scala-postgresql" % testcontainersV % Test)
.cross(CrossVersion.for3Use2_13)
),
Test / parallelExecution := false // Needed due to a driver initialization deadlock between Postgres and H2
)
.dependsOn(coreJVM % "compile->compile;test->test")
lazy val circe = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.in(file("modules/circe"))
.settings(commonSettings)
.settings(
name := "fuuid-circe",
libraryDependencies ++= Seq(
"io.circe" %%% "circe-core" % circeV
)
)
.jsSettings(
libraryDependencies += "io.github.cquiroz" %%% "scala-java-time" % scalaJavaTimeV % Test
)
.dependsOn(core % "compile->compile;test->test")
lazy val circeJS = circe.js
lazy val circeJVM = circe.jvm
lazy val http4s = project
.in(file("modules/http4s"))
.settings(commonSettings)
.settings(
name := "fuuid-http4s",
libraryDependencies ++= Seq(
"org.http4s" %% "http4s-core" % http4sV,
"org.http4s" %% "http4s-dsl" % http4sV % Test
)
)
.dependsOn(coreJVM % "compile->compile;test->test")
lazy val site = project
.in(file("modules/site"))
.disablePlugins(MimaPlugin)
.enablePlugins(NoPublishPlugin)
.enablePlugins(DavenverseMicrositePlugin)
.dependsOn(coreJVM, http4s, doobie, circeJVM)
.settings(
micrositeDescription := "Functional UUID's"
)
val catsV = "2.7.0" //https://github.com/typelevel/cats/releases
val catsEffectV = "3.3.12" //https://github.com/typelevel/cats-effect/releases
val circeV = "0.14.1" //https://github.com/circe/circe/releases
val http4sV = "0.23.6" //https://github.com/http4s/http4s/releases
val doobieV = "1.0.0-RC1" //https://github.com/tpolecat/doobie/releases
val scalaJavaTimeV = "2.3.0" // https://github.com/cquiroz/scala-java-time/releases
val testcontainersV = "0.39.8"
val munitV = "0.7.29"
val munitCE3V = "1.0.6"
val disciplineMunit = "1.0.9"
// General Settings
lazy val commonSettings = Seq(
libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-effect" % catsEffectV,
"org.typelevel" %%% "cats-laws" % catsV % Test,
"org.typelevel" %%% "discipline-munit" % disciplineMunit % Test,
"org.scalameta" %%% "munit" % munitV % Test,
"org.scalameta" %%% "munit-scalacheck" % munitV % Test,
"org.typelevel" %%% "munit-cats-effect-3" % munitCE3V % Test
),
libraryDependencies ++= (CrossVersion.partialVersion(scalaVersion.value) match {
case Some((3, _)) => Nil
case _ =>
Seq(
scalaOrganization.value % "scala-compiler" % scalaVersion.value % Provided,
scalaOrganization.value % "scala-reflect" % scalaVersion.value % Provided,
compilerPlugin("org.typelevel" % "kind-projector" % "0.13.2" cross CrossVersion.full),
compilerPlugin("com.olegpy" %% "better-monadic-for" % "0.3.1")
)
}),
scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 13)) => Seq("-Ymacro-annotations")
case _ => Nil
}),
Test / scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.CommonJSModule) }
)