This repository has been archived by the owner on Jul 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sbt
184 lines (170 loc) · 5.47 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
import Dependency._
import ReleaseTransformations._
lazy val commonSettings: Seq[SettingsDefinition] = Seq(
organization := "io.github.qwbarch",
scalaVersion := "3.1.2",
crossScalaVersions := Seq("3.1.2", "2.13.8", "2.12.15"),
testFrameworks += new TestFramework("weaver.framework.CatsEffect"),
libraryDependencies ++= Seq(
log4CatsNoOp % Test,
weaverCats % Test,
weaverScalaCheck % Test,
),
// Enable Ymacro-annotations for scala 2.13, required for newtypes
scalacOptions ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 13)) => "-Ymacro-annotations" :: Nil
case _ => Nil
}
},
// Enable some scala 3 syntax for scala 2.12 and 2.13
scalacOptions ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, _)) => "-Xsource:3" :: Nil
case _ => Nil
}
},
// Enable better-monadic-for with non-dotty versions
libraryDependencies ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, _)) => compilerPlugin(betterMonadicFor) :: Nil
case _ => Nil
}
},
)
lazy val root = (project in file("."))
.settings(commonSettings ++ noPublishSettings ++ releaseSettings: _*)
.settings(
Compile / unmanagedSourceDirectories := Nil,
Test / unmanagedSourceDirectories := Nil,
)
.aggregate(core, circe, skunk, http4s)
lazy val core = (project in file("modules/core"))
.settings(commonSettings ++ publishSettings: _*)
.settings(
name := "snowflake4s",
libraryDependencies ++= Seq(
catsCore,
catsKernel,
catsEffectKernel,
log4CatsCore,
),
// Use newtypes for scala 2.13
libraryDependencies ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 13)) => newType :: Nil
case _ => Nil
}
},
)
lazy val circe = (project in file("modules/circe"))
.dependsOn(core % "compile->compile;test->test")
.settings(commonSettings ++ publishSettings: _*)
.settings(
name := "snowflake4s-circe",
libraryDependencies += circeCore,
)
lazy val skunk = (project in file("modules/skunk"))
.dependsOn(core % "compile->compile;test->test")
.settings(commonSettings ++ publishSettings: _*)
.settings(
name := "snowflake4s-skunk",
libraryDependencies += skunkCore,
)
lazy val http4s = (project in file("modules/http4s"))
.dependsOn(core % "compile->compile;test->test")
.dependsOn(circe % "test->test")
.settings(commonSettings ++ publishSettings: _*)
.settings(
name := "snowflake4s-http4s",
libraryDependencies ++= Seq(
http4sCore,
http4sDsl % Test,
http4sCirce % Test,
),
)
lazy val docs = (project in file("modules/docs"))
.dependsOn(core)
.enablePlugins(ParadoxPlugin)
.enablePlugins(ParadoxSitePlugin)
.enablePlugins(GhpagesPlugin)
.settings(commonSettings ++ noPublishSettings: _*)
.settings(
scalacOptions := Nil,
git.remoteRepo := "[email protected]:qwbarch/snowflake4s.git",
ghpagesNoJekyll := true,
paradoxTheme := Some(builtinParadoxTheme("generic")),
paradoxProperties ++= Map(
"organization" -> organization.value,
"version" -> version.value,
),
)
lazy val publishSettings =
releaseSettings ++ sharedPublishSettings ++ credentialSettings ++ sharedReleaseProcess
lazy val credentialSettings = Seq(
credentials ++=
(for {
username <- Option(System.getenv().get("SONATYPE_USERNAME"))
password <- Option(System.getenv().get("SONATYPE_PASSWORD"))
} yield Credentials(
"Sonatype Nexus Repository Manager",
"oss.sonatype.org",
username,
password,
)).toSeq,
)
lazy val noPublishSettings = Seq(
publish := (()),
publishLocal := (()),
publishArtifact := false,
publish / skip := true,
)
lazy val sharedReleaseProcess = Seq(
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
releaseStepCommandAndRemaining("+publishSigned"),
releaseStepCommand("sonatypeBundleRelease"),
setNextVersion,
commitNextVersion,
pushChanges,
),
)
lazy val releaseSettings = Seq(
scmInfo := Some(
ScmInfo(
url("https://github.com/qwbarch/snowflake4s"),
"scm:git:[email protected]:qwbarch/snowflake4s.git",
),
),
homepage := Some(url("https://github.com/qwbarch/snowflake4s")),
licenses := Seq(
"MIT" -> url("https://opensource.org/licenses/MIT"),
),
pomIncludeRepository := { _ =>
false
},
developers :=
List(
Developer(
id = "qwbarch",
name = "qwbarch",
email = "[email protected]",
url = url("https://github.com/qwbarch"),
),
),
publishMavenStyle := true,
Test / publishArtifact := false,
sonatypeCredentialHost := "s01.oss.sonatype.org",
sonatypeRepository := "https://s01.oss.sonatype.org/service/local",
versionScheme := Some("semver-spec"),
releaseCrossBuild := true,
usePgpKeyHex("32C27C5322CC8C7A353D1642E524CDF123A41CB7"),
)
lazy val sharedPublishSettings = Seq(publishTo := sonatypePublishToBundle.value)
addCommandAlias("ci", "+undeclaredCompileDependenciesTest; +unusedCompileDependenciesTest; scalafmtCheckAll; +test")