-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sbt
225 lines (212 loc) · 7.67 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
import sbt._
import Dependencies._
import TestDependencies._
import utils._
import xerial.sbt.Sonatype._
// General
Global / onChangedBuildSource := ReloadOnSourceChanges
Global / lintUnusedKeysOnLoad := false
ThisBuild / turbo := true
ThisBuild / scalaVersion := ScalaLangVersion
// Project information
ThisBuild / name := "figlet4s"
ThisBuild / startYear := Some(2020)
ThisBuild / homepage := Some(url("https://github.com/ColOfAbRiX/figlet4s"))
ThisBuild / organization := "com.colofabrix.scala"
ThisBuild / organizationName := "ColOfAbRiX"
ThisBuild / organizationHomepage := Some(url("https://github.com/ColOfAbRiX"))
ThisBuild / licenses := Seq("MIT" -> url("https://opensource.org/licenses/MIT"))
ThisBuild / scmInfo := Some(
ScmInfo(url("https://github.com/ColOfAbRiX/figlet4s"), "scm:[email protected]:ColOfAbRiX/figlet4s.git"),
)
ThisBuild / developers := List(
Developer("ColOfAbRiX", "Fabrizio Colonna", "[email protected]", url("http://github.com/ColOfAbRiX")),
)
// Publishing
ThisBuild / pomIncludeRepository := { _ => false }
ThisBuild / publishMavenStyle := true
ThisBuild / sonatypeProjectHosting := Some(
GitHubHosting("ColOfAbRiX", "figlet4s", "[email protected]"),
)
ThisBuild / publishTo := Some(
if (isSnapshot.value) Opts.resolver.sonatypeSnapshots
else Opts.resolver.sonatypeStaging,
)
// GIT version information
ThisBuild / dynverSonatypeSnapshots := true
// Scalafix
ThisBuild / scalafixDependencies += "com.github.liancheng" %% "organize-imports" % "0.4.4"
ThisBuild / scalafixScalaBinaryVersion := CrossVersion.binaryScalaVersion(scalaVersion.value)
ThisBuild / semanticdbEnabled := true
ThisBuild / semanticdbVersion := scalafixSemanticdb.revision
addCommandAlias("styleApply", "; scalafmtAll; scalafixAll")
addCommandAlias("styleCheck", "; scalafmtCheckAll; scalafixAll --check")
val commonScalaSettings: Seq[Def.Setting[_]] = Seq(
// Testing
Test / testOptions += Tests.Argument("-oFD"),
// Compiler options
scalacOptions := versioned(scalaVersion.value)(
Compiler.Options_2_12 ++ Compiler.StrictOptions,
Compiler.Options_2_13 ++ Compiler.StrictOptions,
),
Test / scalacOptions := versioned(scalaVersion.value)(
Compiler.Options_2_12,
Compiler.Options_2_13,
),
IntegrationTest / scalacOptions := versioned(scalaVersion.value)(
Compiler.Options_2_12,
Compiler.Options_2_13,
),
// Cross Scala Versions
crossScalaVersions := SupportedScalaLangVersion,
// Wartremover
Compile / wartremoverErrors := Warts.allBut(
Wart.Any,
Wart.DefaultArguments,
Wart.Nothing,
Wart.Overloading,
Wart.StringPlusAny,
Wart.ToString,
// Covered by ScalaFix
Wart.PublicInference,
),
// Scaladoc
Compile / autoAPIMappings := true,
Compile / doc / scalacOptions ++= Seq(
"-doc-title", "Figlet4s API Documentation",
"-doc-version", version.value,
"-encoding", "UTF-8",
),
// Packaging and publishing
Compile / packageBin / packageOptions ++= Seq(
Package.ManifestAttributes(
("Git-Build-Branch", git.gitCurrentBranch.value),
("Git-Head-Commit-Date", git.gitHeadCommitDate.value.getOrElse("")),
("Git-Head-Commit", git.gitHeadCommit.value.getOrElse("")),
("Git-Uncommitted-Changes", git.gitUncommittedChanges.value.toString),
),
),
)
// Figlet4s
lazy val figlet4s: Project = project
.in(file("."))
.aggregate(figlet4sCore, figlet4sEffects, figlet4sJava)
.enablePlugins(ScalaUnidocPlugin)
.settings(
name := "figlet4s",
crossScalaVersions := Nil,
publish / skip := true,
onLoadMessage :=
"""
| _____ _ _ _ _ _
| | ___(_) __ _| | ___| |_| || | ___
| | |_ | |/ _` | |/ _ \ __| || |_/ __|
| | _| | | (_| | | __/ |_|__ _\__ \
| |_| |_|\__, |_|\___|\__| |_| |___/
| |___/
| Welcome to the build for Figlet4s
|
|""".stripMargin,
ScalaUnidoc / unidoc / unidocProjectFilter := inAnyProject -- inProjects(figlet4sJava),
)
// Figlet4s Core project
lazy val figlet4sCore: Project = project
.in(file("figlet4s-core"))
.settings(commonScalaSettings)
.configs(IntegrationTest)
.settings(Defaults.itSettings)
.settings(
name := "figlet4s-core",
description := "ASCII-art banners in Scala",
libraryDependencies ++= Seq(
CatsCoreDep,
CatsEffectDep,
CatsKernelDep,
CatsScalaTestDep,
EnumeratumDep,
ScalaMockDep,
ScalaTestFlatSpecDep,
ScalaTestPlusCheckDep,
ScalaTestShouldMatchersDep,
),
)
// Figlet4s Effects project
lazy val figlet4sEffects: Project = project
.in(file("figlet4s-effects"))
.dependsOn(figlet4sCore % "compile->compile;test->test;it->it")
.settings(commonScalaSettings)
.configs(IntegrationTest)
.settings(Defaults.itSettings)
.settings(
name := "figlet4s-effects",
description := "Effects extension for Figlet4s",
libraryDependencies ++= Seq(
CatsCoreDep,
CatsEffectDep,
CatsKernelDep % Runtime,
CatsScalaTestDep,
ScalaTestFlatSpecDep,
ScalaTestShouldMatchersDep,
),
)
// Figlet4s Java integration project
lazy val figlet4sJava: Project = project
.in(file("figlet4s-java"))
.dependsOn(figlet4sCore % "compile->compile;test->test")
.settings(
name := "figlet4s-java",
description := "Java integration for Figlet4s",
javacOptions ++= Compiler.JavacOptions,
Compile / doc / javacOptions := Seq(),
crossPaths := false,
libraryDependencies ++= Seq(
ScalaTestFlatSpecDep,
ScalaTestShouldMatchersDep,
),
)
lazy val figlet4sMicrosite = project
.in(file("figlet4s-microsite"))
.enablePlugins(MicrositesPlugin)
.settings(
crossScalaVersions := SupportedScalaLangVersion,
micrositeAnalyticsToken := "UA-189728436-1",
micrositeAuthor := "ColOfAbRiX",
micrositeBaseUrl := "figlet4s",
micrositeDescription := "ASCII-art banners in Scala",
micrositeDocumentationUrl := "docs/",
micrositeGithubOwner := "ColOfAbRiX",
micrositeGithubRepo := "figlet4s",
micrositeGithubToken := sys.env.get("GITHUB_TOKEN"),
micrositeGitterChannel := false,
micrositeHighlightLanguages ++= Seq("xml", "plaintext"),
micrositeHighlightTheme := "atom-one-dark", // https://highlightjs.org/static/demo/
micrositeHomepage := "https://colofabrix.github.io/",
micrositeName := "Figlet4s",
micrositePushSiteWith := GitHub4s,
name := "figlet4s-microsite",
mdocExtraArguments := Seq("--no-link-hygiene"),
publish / skip := true,
mdocVariables := Map(
"VERSION" -> """\d+\.\d+\.\d""".r.findFirstIn(version.value).getOrElse(""),
"SCALA_VERSION" -> """\d+\.\d+""".r.findFirstIn(scalaVersion.value).getOrElse(""),
),
)
// Figlet4s Benchmarks project
lazy val figlet4sBenchmarks: Project = project
.in(file("figlet4s-benchmarks"))
.dependsOn(figlet4sCore)
.settings(
name := "figlet4s-benchmarks",
description := "Benchmarks for Figlet4s",
publishArtifact := false,
logBuffered := false,
publish / skip := true,
Test / parallelExecution := false,
Test / logBuffered := false,
resolvers ++= SonatypeRepos,
testFrameworks += new TestFramework("org.scalameter.ScalaMeterFramework"),
libraryDependencies ++= Seq(
CatsCoreDep,
ScalameterDep,
),
)