-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.sbt
149 lines (135 loc) · 5.12 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
val isScala3 = Def.setting(CrossVersion.partialVersion(scalaVersion.value).exists(_._1 != 2))
// Dependencies
val catsVersion = "2.12.0"
val castsTestkitScalatestVersion = "2.1.5"
val scalatestVersion = "3.2.19"
val disciplineVersion = "2.3.0"
// Multiple Scala versions support
val scala_2_13 = "2.13.15"
val scala_3 = "3.3.4"
val mainScalaVersion = scala_2_13
val supportedScalaVersions = Seq(scala_2_13, scala_3)
ThisBuild / crossScalaVersions := supportedScalaVersions
ThisBuild / scalaVersion := mainScalaVersion
ThisBuild / versionScheme := Some("early-semver")
ThisBuild / githubWorkflowJavaVersions := Seq(JavaSpec.temurin("11"), JavaSpec.temurin("17"))
ThisBuild / githubWorkflowPublishTargetBranches := Seq(RefPredicate.StartsWith(Ref.Tag("v")), RefPredicate.Equals(Ref.Branch("master")))
ThisBuild / tlBaseVersion := "2.0"
ThisBuild / tlCiHeaderCheck := false
ThisBuild / sonatypeCredentialHost := xerial.sbt.Sonatype.sonatypeLegacy
lazy val baseSettings = Seq(
// Scala settings
homepage := Some(url("https://github.com/theiterators/sealed-monad")),
scalacOptions ++= (if (isScala3.value)
Seq(
"-deprecation",
"-unchecked",
"-feature",
"-language:implicitConversions",
"-Ykind-projector:underscores",
"-encoding",
"utf8"
)
else
Seq(
"-deprecation",
"-unchecked",
"-feature",
"-Xsource:3",
"-P:kind-projector:underscore-placeholders",
"-encoding",
"utf8"
)),
libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-core" % catsVersion,
"org.typelevel" %%% "cats-laws" % catsVersion % Test,
"org.typelevel" %%% "cats-testkit" % catsVersion % Test,
"org.scalatest" %%% "scalatest" % scalatestVersion % Test,
"org.typelevel" %%% "discipline-scalatest" % disciplineVersion % Test
) ++ (if (isScala3.value) Nil
else
Seq(compilerPlugin("org.typelevel" %% "kind-projector" % "0.13.3" cross CrossVersion.full))),
scalafmtOnCompile := true,
// Sonatype settings
licenses := Seq("Apache-2.0" -> url("https://www.apache.org/licenses/LICENSE-2.0")),
organization := "pl.iterators",
organizationName := "Iterators",
organizationHomepage := Some(url("https://www.iteratorshq.com")),
developers := List(
Developer(
id = "luksow",
name = "Łukasz Sowa",
email = "lukasz@iteratorshq.com",
url = url("https://github.com/luksow")
),
Developer(
id = "pkiersznowski",
name = "Paweł Kiersznowski",
email = "pkiersznowski@iteratorshq.com",
url = url("https://github.com/pk044")
)
),
scmInfo := Some(
ScmInfo(
browseUrl = url("https://github.com/theiterators/sealed-monad"),
connection = "scm:git:https://github.com/theiterators/sealed-monad.git"
)
),
crossScalaVersions := supportedScalaVersions
)
lazy val noPublishSettings =
Seq(
publishArtifact := false,
skip / publish := true
)
lazy val examples = project
.in(file("examples"))
.dependsOn(core.jvm % "test->test;compile->compile")
.settings(baseSettings *)
.settings(noPublishSettings *)
.settings(
name := "examples",
description := "Sealed monad - snippets of example code",
moduleName := "sealed-examples"
)
lazy val docs = project
.in(file("sealed-docs"))
.dependsOn(core.jvm % "test->test;compile->compile")
.enablePlugins(MdocPlugin, DocusaurusPlugin)
.settings(baseSettings *)
.settings(noPublishSettings *)
.settings(
name := "docs",
description := "Sealed monad documentation",
moduleName := "sealed-docs"
)
.settings(
mdocVariables := Map(
"VERSION" -> version.value
)
)
lazy val benchmarks = project
.in(file("benchmarks"))
.dependsOn(core.jvm % "test->test;compile->compile")
.enablePlugins(JmhPlugin)
.settings(baseSettings *)
.settings(noPublishSettings *)
.settings(
name := "benchmarks",
description := "Sealed monad benchmarks",
moduleName := "sealed-benchmarks"
)
addCommandAlias("flame", "benchmarks/jmh:run -p tokens=64 -prof jmh.extras.Async:dir=target/flamegraphs;flameGraphOpts=--width,1900")
lazy val core = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Pure)
.in(file("sealedmonad"))
.jsConfigure(_.disablePlugins(DoctestPlugin))
.settings(baseSettings *)
.settings(
name := "sealed-monad",
description := "Scala library for nice for-comprehension-style error handling"
)
lazy val sealedMonad = tlCrossRootProject
.aggregate(core, benchmarks, docs, examples)
.settings(baseSettings *)