-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sbt
204 lines (167 loc) · 7.2 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
import microsites.ConfigYml
import xerial.sbt.Sonatype._
name := "clipp"
dynverSonatypeSnapshots in ThisBuild := true
val scala212 = "2.12.18"
val scala213 = "2.13.12"
val scala3 = "3.3.0"
val scalacOptions212 = Seq("-Ypartial-unification", "-deprecation")
val scalacOptions213 = Seq("-deprecation")
val scalacOptions3 = Seq("-deprecation", "-Ykind-projector")
lazy val commonSettings =
Seq(
scalaVersion := scala213,
crossScalaVersions := List(scala212, scala213, scala3),
organization := "io.github.vigoo",
libraryDependencies ++=
(CrossVersion.partialVersion(scalaVersion.value) match {
case Some((3, _)) => Seq.empty
case _ => Seq(
compilerPlugin("org.typelevel" % "kind-projector" % "0.13.2" cross CrossVersion.full),
)
}),
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-core" % "2.8.0",
"org.typelevel" %% "cats-free" % "2.8.0",
"org.atnos" %% "eff" % "6.0.1",
),
coverageEnabled in(Test, compile) := true,
coverageEnabled in(Compile, compile) := false,
scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 12)) => scalacOptions212
case Some((2, 13)) => scalacOptions213
case Some((3, _)) => scalacOptions3
case _ => Nil
}),
// Publishing
publishMavenStyle := true,
licenses := Seq("APL2" -> url("http://www.apache.org/licenses/LICENSE-2.0.txt")),
sonatypeProjectHosting := Some(GitHubHosting("vigoo", "clipp", "[email protected]")),
developers := List(
Developer(id = "vigoo", name = "Daniel Vigovszky", email = "[email protected]", url = url("https://vigoo.github.io"))
),
sonatypeCredentialHost := "s01.oss.sonatype.org",
sonatypeRepository := "https://s01.oss.sonatype.org/service/local",
credentials ++=
(for {
username <- Option(System.getenv().get("SONATYPE_USERNAME"))
password <- Option(System.getenv().get("SONATYPE_PASSWORD"))
} yield
Credentials(
"Sonatype Nexus Repository Manager",
"s01.oss.sonatype.org",
username,
password)).toSeq
)
lazy val root = Project("clipp", file(".")).settings(commonSettings).settings(
publishArtifact := false
) aggregate(core, zio, zio2, catsEffect, catsEffect3)
lazy val core = Project("clipp-core", file("clipp-core")).settings(commonSettings).settings(
description := "Clipp core",
libraryDependencies ++= Seq(
"dev.zio" %% "zio-test" % "1.0.17" % Test,
"dev.zio" %% "zio-test-sbt" % "1.0.17" % Test
),
testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework")
)
lazy val zio = Project("clipp-zio", file("clipp-zio")).settings(commonSettings).settings(
description := "Clipp ZIO interface",
libraryDependencies ++= Seq(
"dev.zio" %% "zio" % "1.0.17",
"dev.zio" %% "zio-test" % "1.0.17" % Test,
"dev.zio" %% "zio-test-sbt" % "1.0.17" % Test
),
testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework")
).dependsOn(core)
lazy val zio2 = Project("clipp-zio-2", file("clipp-zio-2")).settings(commonSettings).settings(
description := "Clipp ZIO 2 interface",
resolvers +=
"Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots",
libraryDependencies ++= Seq(
"dev.zio" %% "zio" % "2.0.2",
"dev.zio" %% "zio-test" % "2.0.2" % Test,
"dev.zio" %% "zio-test-sbt" % "2.0.2" % Test
),
testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework")
).dependsOn(core)
lazy val catsEffect = Project("clipp-cats-effect", file("clipp-cats-effect")).settings(commonSettings).settings(
description := "Clipp Cats-Effect interface",
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-effect" % "2.5.5",
"dev.zio" %% "zio-test" % "1.0.17" % Test,
"dev.zio" %% "zio-test-sbt" % "1.0.17" % Test,
),
testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework")
).dependsOn(core)
lazy val catsEffect3 = Project("clipp-cats-effect3", file("clipp-cats-effect3")).settings(commonSettings).settings(
description := "Clipp Cats-Effect 3 interface",
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-effect" % "3.3.14",
"dev.zio" %% "zio-test" % "1.0.17" % Test,
"dev.zio" %% "zio-test-sbt" % "1.0.17" % Test,
),
testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework")
).dependsOn(core)
lazy val docs = project
.settings(commonSettings)
.enablePlugins(GhpagesPlugin)
.enablePlugins(SiteScaladocPlugin)
.enablePlugins(ScalaUnidocPlugin)
.enablePlugins(MicrositesPlugin)
.settings(
name := "clipp",
description := "Functional command line argument parser and usage info generator for Scala",
publishArtifact := false,
siteSubdirName in ScalaUnidoc := "api",
addMappingsToSiteDir(mappings in(ScalaUnidoc, packageDoc), siteSubdirName in ScalaUnidoc),
unidocProjectFilter in(ScalaUnidoc, unidoc) := inProjects(
core,
catsEffect,
zio
),
git.remoteRepo := "[email protected]:vigoo/clipp.git",
micrositeUrl := "https://vigoo.github.io",
micrositeBaseUrl := "/clipp",
micrositeHomepage := "https://vigoo.github.io/clipp/",
micrositeDocumentationUrl := "/clipp/docs",
micrositeAuthor := "Daniel Vigovszky",
micrositeTwitterCreator := "@dvigovszky",
micrositeGithubOwner := "vigoo",
micrositeGithubRepo := "clipp",
micrositeGitterChannel := false,
micrositeDataDirectory := file("docs/src/microsite/data"),
micrositeStaticDirectory := file("docs/src/microsite/static"),
micrositeImgDirectory := file("docs/src/microsite/img"),
micrositeCssDirectory := file("docs/src/microsite/styles"),
micrositeSassDirectory := file("docs/src/microsite/partials"),
micrositeJsDirectory := file("docs/src/microsite/scripts"),
micrositeTheme := "light",
micrositeHighlightLanguages ++= Seq("scala", "sbt"),
micrositeConfigYaml := ConfigYml(
yamlCustomProperties = Map(
"url" -> "https://vigoo.github.io",
"plugins" -> List("jemoji", "jekyll-sitemap")
)
),
//micrositeAnalyticsToken := "UA-56320875-2",
includeFilter in makeSite := "*.html" | "*.css" | "*.png" | "*.jpg" | "*.gif" | "*.js" | "*.swf" | "*.txt" | "*.xml" | "*.svg",
micrositePushSiteWith := GitHub4s,
micrositeGithubToken := sys.env.get("GITHUB_TOKEN")
)
.dependsOn(core, catsEffect, zio)
// Temporary fix to avoid including mdoc in the published POM
import scala.xml.{Node => XmlNode, NodeSeq => XmlNodeSeq, _}
import scala.xml.transform.{RewriteRule, RuleTransformer}
// skip dependency elements with a scope
pomPostProcess := { (node: XmlNode) =>
new RuleTransformer(new RewriteRule {
override def transform(node: XmlNode): XmlNodeSeq = node match {
case e: Elem if e.label == "dependency" && e.child.exists(child => child.label == "artifactId" && child.text.startsWith("mdoc_")) =>
val organization = e.child.filter(_.label == "groupId").flatMap(_.text).mkString
val artifact = e.child.filter(_.label == "artifactId").flatMap(_.text).mkString
val version = e.child.filter(_.label == "version").flatMap(_.text).mkString
Comment(s"dependency $organization#$artifact;$version has been omitted")
case _ => node
}
}).transform(node).head
}