forked from typelevel/cats-tagless
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
245 lines (224 loc) · 8.63 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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
import com.typesafe.sbt.SbtGit.git
addCommandAlias("validateJVM", "all scalafmtCheckAll scalafmtSbtCheck testsJVM/test")
addCommandAlias("validateJS", "all testsJS/test")
addCommandAlias("validateNative", "all testsNative/test")
addCommandAlias("fmt", "all scalafmtSbt scalafmtAll")
addCommandAlias("fmtCheck", "all scalafmtSbtCheck scalafmtCheckAll")
val Scala212 = "2.12.13"
val Scala213 = "2.13.5"
val gitRepo = "[email protected]:typelevel/cats-tagless.git"
val homePage = "https://typelevel.org/cats-tagless"
// GitHub actions configuration
ThisBuild / organization := "org.typelevel"
ThisBuild / organizationName := "cats-tagless maintainers"
ThisBuild / baseVersion := "0.13"
ThisBuild / publishGithubUser := "joroKr21"
ThisBuild / publishFullName := "Georgi Krastev"
enablePlugins(SonatypeCiReleasePlugin)
ThisBuild / crossScalaVersions := Seq(Scala212, Scala213)
ThisBuild / scalaVersion := Scala213
ThisBuild / githubWorkflowArtifactUpload := false
ThisBuild / githubWorkflowBuildMatrixAdditions += "ci" -> List("validateJVM", "validateJS", "validateNative")
ThisBuild / githubWorkflowBuild := List(WorkflowStep.Sbt(List("${{ matrix.ci }}"), name = Some("Validation")))
ThisBuild / githubWorkflowAddedJobs ++= Seq(
WorkflowJob(
"microsite",
"Microsite",
githubWorkflowJobSetup.value.toList ::: List(
WorkflowStep.Use(
UseRef.Public("ruby", "setup-ruby", "v1"),
name = Some("Setup Ruby"),
params = Map("ruby-version" -> "2.6", "bundler-cache" -> "true")
),
WorkflowStep.Run(List("gem install jekyll -v 2.5"), name = Some("Install Jekyll")),
WorkflowStep.Sbt(List("docs/makeMicrosite"), name = Some("Build microsite"))
),
scalas = List(Scala213)
)
)
val catsVersion = "2.5.0"
val circeVersion = "0.13.0"
val disciplineVersion = "1.1.4"
val disciplineMunitVersion = "1.0.7"
val paradiseVersion = "2.1.1"
val scalaCheckVersion = "1.15.3"
val macroSettings = List(
libraryDependencies ++=
List("scala-compiler", "scala-reflect").map("org.scala-lang" % _ % scalaVersion.value % Provided),
scalacOptions ++= (scalaBinaryVersion.value match {
case "2.13" => List("-Ymacro-annotations")
case _ => Nil
}),
libraryDependencies ++= (scalaBinaryVersion.value match {
case "2.13" => Nil
case _ => List(compilerPlugin(("org.scalamacros" %% "paradise" % paradiseVersion).cross(CrossVersion.full)))
})
)
lazy val `cats-tagless` = project
.in(file("."))
.aggregate(rootJVM, rootJS, rootNative, docs)
.dependsOn(rootJVM, rootJS, rootNative)
.settings(rootSettings)
.enablePlugins(NoPublishPlugin)
lazy val rootJVM = project
.aggregate(coreJVM, lawsJVM, testsJVM, macrosJVM)
.dependsOn(coreJVM, lawsJVM, testsJVM, macrosJVM)
.settings(rootSettings)
.enablePlugins(NoPublishPlugin)
lazy val rootJS = project
.aggregate(coreJS, lawsJS, testsJS, macrosJS)
.dependsOn(coreJS, lawsJS, testsJS, macrosJS)
.settings(rootSettings, commonJsSettings)
.enablePlugins(NoPublishPlugin)
lazy val rootNative = project
.aggregate(coreNative, lawsNative, testsNative, macrosNative)
.dependsOn(coreNative, lawsNative, testsNative, macrosNative)
.settings(rootSettings, commonNativeSettings)
.enablePlugins(NoPublishPlugin)
lazy val coreJVM = core.jvm
lazy val coreJS = core.js
lazy val coreNative = core.native
lazy val core = crossProject(JVMPlatform, JSPlatform, NativePlatform)
.crossType(CrossType.Pure)
.enablePlugins(AutomateHeaderPlugin)
.jsSettings(commonJsSettings)
.nativeSettings(commonNativeSettings)
.settings(rootSettings)
.settings(
moduleName := "cats-tagless-core",
libraryDependencies += "org.typelevel" %%% "cats-core" % catsVersion
)
lazy val lawsJVM = laws.jvm
lazy val lawsJS = laws.js
lazy val lawsNative = laws.native
lazy val laws = crossProject(JVMPlatform, JSPlatform, NativePlatform)
.crossType(CrossType.Pure)
.dependsOn(core)
.enablePlugins(AutomateHeaderPlugin)
.jsSettings(commonJsSettings)
.nativeSettings(commonNativeSettings)
.settings(rootSettings)
.settings(
moduleName := "cats-tagless-laws",
libraryDependencies ++= List(
"org.typelevel" %%% "cats-laws" % catsVersion,
"org.typelevel" %%% "discipline-core" % disciplineVersion
)
)
lazy val macrosJVM = macros.jvm
lazy val macrosJS = macros.js
lazy val macrosNative = macros.native
lazy val macros = crossProject(JVMPlatform, JSPlatform, NativePlatform)
.crossType(CrossType.Pure)
.dependsOn(core)
.aggregate(core)
.enablePlugins(AutomateHeaderPlugin)
.jsSettings(commonJsSettings)
.nativeSettings(commonNativeSettings)
.settings(rootSettings, macroSettings)
.settings(
moduleName := "cats-tagless-macros",
scalacOptions := scalacOptions.value.filterNot(_.startsWith("-Wunused")).filterNot(_.startsWith("-Ywarn-unused")),
libraryDependencies += "org.scalacheck" %%% "scalacheck" % scalaCheckVersion % Test
)
lazy val testsJVM = tests.jvm
lazy val testsJS = tests.js
lazy val testsNative = tests.native
lazy val tests = crossProject(JVMPlatform, JSPlatform, NativePlatform)
.crossType(CrossType.Full)
.dependsOn(macros, laws)
.enablePlugins(AutomateHeaderPlugin, NoPublishPlugin)
.jvmSettings(libraryDependencies += "io.circe" %% "circe-core" % circeVersion % Test)
.jsSettings(commonJsSettings)
.jsSettings(scalaJSLinkerConfig ~= (_.withModuleKind(ModuleKind.CommonJSModule)))
.nativeSettings(commonNativeSettings)
.settings(rootSettings, macroSettings)
.settings(
moduleName := "cats-tagless-tests",
testFrameworks += new TestFramework("munit.Framework"),
libraryDependencies ++= List(
"org.typelevel" %%% "cats-free" % catsVersion,
"org.typelevel" %%% "cats-testkit" % catsVersion,
"org.typelevel" %%% "discipline-munit" % disciplineMunitVersion
).map(_ % Test)
)
/** Docs - Generates and publishes the scaladoc API documents and the project web site. */
lazy val docs = project
.dependsOn(macrosJVM)
.enablePlugins(MicrositesPlugin, SiteScaladocPlugin, NoPublishPlugin)
.settings(rootSettings, macroSettings)
.settings(
moduleName := "cats-tagless-docs",
libraryDependencies += "org.typelevel" %%% "cats-free" % catsVersion,
docsMappingsAPIDir := "api",
addMappingsToSiteDir(coreJVM / Compile / packageDoc / mappings, docsMappingsAPIDir),
organization := "org.typelevel",
autoAPIMappings := true,
micrositeName := "Cats-tagless",
micrositeDescription := "A library of utilities for tagless final algebras",
micrositeBaseUrl := "cats-tagless",
micrositeGithubOwner := "typelevel",
micrositeGithubRepo := "cats-tagless",
micrositeHighlightTheme := "atom-one-light",
micrositeTheme := "pattern",
micrositePalette := Map(
"brand-primary" -> "#51839A",
"brand-secondary" -> "#EDAF79",
"brand-tertiary" -> "#96A694",
"gray-dark" -> "#192946",
"gray" -> "#424F67",
"gray-light" -> "#E3E2E3",
"gray-lighter" -> "#F4F3F4",
"white-color" -> "#FFFFFF"
),
ghpagesNoJekyll := false,
micrositeAuthor := "cats-tagless Contributors",
scalacOptions -= "-Xfatal-warnings",
git.remoteRepo := gitRepo,
makeSite / includeFilter := "*.html" | "*.css" | "*.png" | "*.jpg" | "*.gif" | "*.js" | "*.swf" | "*.yml" | "*.md"
)
lazy val docsMappingsAPIDir = settingKey[String]("Name of subdirectory in site target directory for api docs")
lazy val rootSettings = commonSettings ::: publishSettings
lazy val commonSettings = List(
scalaVersion := (ThisBuild / scalaVersion).value,
crossScalaVersions := (ThisBuild / crossScalaVersions).value,
Test / parallelExecution := false,
resolvers ++= Seq(Resolver.sonatypeRepo("releases"), Resolver.sonatypeRepo("snapshots")),
startYear := Some(2019),
apiURL := Some(url("https://typelevel.org/cats-tagless/api/")),
autoAPIMappings := true
)
lazy val commonJsSettings = List(
Global / scalaJSStage := FastOptStage,
// currently sbt-doctest doesn't work in JS builds
// https://github.com/tkawachi/sbt-doctest/issues/52
doctestGenTests := Nil
)
lazy val commonNativeSettings = List(
doctestGenTests := Nil
)
lazy val publishSettings = List(
homepage := Some(url(homePage)),
scmInfo := Some(ScmInfo(url(homePage), gitRepo)),
licenses := List("Apache-2.0" -> url("https://www.apache.org/licenses/LICENSE-2.0.html")),
developers := List(
Developer(
"Georgi Krastev",
"@joroKr21",
url("https://www.linkedin.com/in/georgykr")
),
Developer(
"Kailuo Wang",
"@kailuowang",
url("http://kailuowang.com")
),
Developer(
"Luka Jacobowitz",
"@LukaJCB",
url("http://stackoverflow.com/users/3795501/luka-jacobowitz")
)
)
)