-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.sbt
175 lines (158 loc) · 5.49 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
import Dependencies._
val scala2 = "2.13.14"
val scala3 = "3.3.3"
ThisBuild / scalaVersion := scala2
ThisBuild / organization := "dev.profunktor"
ThisBuild / organizationName := "ProfunKtor"
ThisBuild / homepage := Some(url("https://neutron.profunktor.dev"))
ThisBuild / licenses := List(
"Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")
)
ThisBuild / crossScalaVersions := List(scala2, scala3)
ThisBuild / startYear := Some(2021)
ThisBuild / developers := List(
Developer(
"gvolpe",
"Gabriel Volpe",
"volpegabriel@gmail.com",
url("https://gvolpe.com")
)
)
ThisBuild / evictionErrorLevel := Level.Info
resolvers ++= Resolver.sonatypeOssRepos("snapshots")
Compile / run / fork := true
Global / onChangedBuildSource := ReloadOnSourceChanges
Global / semanticdbEnabled := true
Global / semanticdbVersion := scalafixSemanticdb.revision
def avro4sDep(scalaVersion: String, scope: String = Provided.toString): List[ModuleID] =
CrossVersion.partialVersion(scalaVersion) match {
case Some((2, _)) =>
List(Libraries.avro4s % scope)
case Some((3, _)) =>
List(Libraries.avro4s_scala3 % scope)
case _ => Nil
}
def kindProjectorDep(scalaVersion: String): List[ModuleID] =
CrossVersion.partialVersion(scalaVersion) match {
case Some((2, _)) =>
List(
CompilerPlugins.kindProjector
)
case _ => Nil
}
val commonSettings = Seq(
scalafmtOnCompile := true,
autoAPIMappings := true,
testFrameworks += new TestFramework("weaver.framework.CatsEffect")
)
lazy val noPublish = {
publish / skip := true
}
lazy val `neutron-core` = (project in file("core"))
.enablePlugins(AutomateHeaderPlugin)
.settings(commonSettings)
.settings(
libraryDependencies ++= List(
Libraries.cats,
Libraries.catsEffect,
Libraries.fs2,
Libraries.pulsar,
Libraries.weaverCats % Test
) ++ kindProjectorDep(scalaVersion.value)
)
lazy val `neutron-circe` = (project in file("circe"))
.enablePlugins(AutomateHeaderPlugin)
.dependsOn(`neutron-core`)
.settings(commonSettings)
.settings(
libraryDependencies ++= List(
Libraries.circeCore,
Libraries.circeParser
) ++ avro4sDep(scalaVersion.value)
)
lazy val `neutron-function` = (project in file("function"))
.enablePlugins(AutomateHeaderPlugin)
.settings(commonSettings)
.settings(
libraryDependencies ++= List(
Libraries.pulsarFunctionsApi,
Libraries.cats % Test,
Libraries.catsEffect % Test,
Libraries.weaverCats % Test,
Libraries.weaverScalaCheck % Test
) ++ avro4sDep(scalaVersion.value)
)
lazy val tests = (project in file("tests"))
.enablePlugins(AutomateHeaderPlugin)
.settings(commonSettings)
.configs(IntegrationTest)
.settings(
noPublish,
Defaults.itSettings,
libraryDependencies ++= List(
Libraries.circeCore % "it,test",
Libraries.circeGeneric % "it,test",
Libraries.circeParser % "it,test",
Libraries.weaverCats % "it,test"
) ++ avro4sDep(scalaVersion.value, "it,test") ++ kindProjectorDep(
scalaVersion.value
)
)
.dependsOn(`neutron-circe`)
lazy val docs = (project in file("docs"))
.dependsOn(`neutron-circe`)
.enablePlugins(ParadoxSitePlugin)
.enablePlugins(ParadoxMaterialThemePlugin)
.enablePlugins(GhpagesPlugin)
.enablePlugins(MdocPlugin)
.settings(
noPublish,
libraryDependencies ++= List(
Libraries.circeGeneric
) ++ avro4sDep(scalaVersion.value),
scalacOptions -= "-Xfatal-warnings",
scmInfo := Some(
ScmInfo(
url("https://github.com/profunktor/neutron"),
"scm:git:git@github.com:profunktor/neutron.git"
)
),
git.remoteRepo := scmInfo.value.get.connection.replace("scm:git:", ""),
ghpagesNoJekyll := true,
version := version.value.takeWhile(_ != '+'),
paradoxProperties ++= Map(
"scala-versions" -> (`neutron-core` / crossScalaVersions).value
.map(CrossVersion.partialVersion)
.flatten
.map { case (x, y) => s"$x.$y" }
.mkString("/"),
"org" -> organization.value,
"scala.binary.version" -> s"2.${CrossVersion.partialVersion(scalaVersion.value).get._2}",
"neutron-core" -> s"${(`neutron-core` / name).value}_2.${CrossVersion.partialVersion(scalaVersion.value).get._2}",
"neutron-circe" -> s"${(`neutron-circe` / name).value}_2.${CrossVersion.partialVersion(scalaVersion.value).get._2}",
"neutron-function" -> s"${(`neutron-function` / name).value}_2.${CrossVersion.partialVersion(scalaVersion.value).get._2}",
"version" -> version.value
),
mdocIn := (Paradox / sourceDirectory).value,
mdocExtraArguments ++= Seq("--no-link-hygiene"),
makeSite := makeSite.dependsOn(mdoc.toTask("")).value,
ParadoxMaterialThemePlugin.paradoxMaterialThemeSettings(Paradox),
Paradox / paradoxMaterialTheme := {
ParadoxMaterialTheme()
.withColor("teal", "indigo")
.withLogoIcon("flash_on")
.withCopyright("Copyright © ProfunKtor")
.withRepository(uri("https://github.com/profunktor/neutron"))
}
)
lazy val root = (project in file("."))
.settings(name := "neutron")
.settings(noPublish)
.aggregate(
`neutron-circe`,
`neutron-core`,
`neutron-function`,
docs,
tests
)
addCommandAlias("lint", "; scalafmtAll; scalafixAll --rules OrganizeImports")