-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbuild.sbt
More file actions
200 lines (166 loc) · 6.12 KB
/
build.sbt
File metadata and controls
200 lines (166 loc) · 6.12 KB
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
import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType}
import scala.xml.{ Elem, Node, NodeSeq }
import scala.xml.transform.{ RewriteRule, RuleTransformer }
enablePlugins(ScalaJSPlugin)
lazy val schemes = project.in(file("."))
.settings(commonSettings)
.settings(publishSettings)
.settings(noPublishSettings)
.aggregate(coreJS, coreJVM, docs)
lazy val core = crossProject(JSPlatform, JVMPlatform)
.in(file("core"))
.enablePlugins(TutPlugin)
.settings(commonSettings)
.settings(publishSettings)
.settings(
moduleName := "schemes-core",
scalacOptions.in(Tut) ~= filterConsoleScalacOptions,
tutTargetDirectory := file(".")
)
lazy val coreJS = core.js
lazy val coreJVM = core.jvm
lazy val docs = project.in(file("docs"))
.enablePlugins(MicrositesPlugin)
.enablePlugins(ScalaUnidocPlugin)
.settings(commonSettings)
.settings(publishSettings)
.settings(noPublishSettings)
.settings(
moduleName := "schemes-docs",
ghpagesNoJekyll := false,
git.remoteRepo := "git@github.com:DavidGregory084/schemes.git",
addMappingsToSiteDir(mappings.in(ScalaUnidoc, packageDoc), micrositeDocumentationUrl),
scalacOptions.in(Tut) ~= filterConsoleScalacOptions,
scalacOptions in (ScalaUnidoc, unidoc) ++= Seq(
"-groups",
"-implicits",
"-sourcepath", baseDirectory.in(LocalRootProject).value.getAbsolutePath,
"-doc-source-url", scmInfo.value.get.browseUrl + "/tree/master€{FILE_PATH}.scala",
"-doc-root-content", (resourceDirectory.in(Compile).value / "rootdoc.txt").getAbsolutePath
),
unidocProjectFilter.in(ScalaUnidoc, unidoc) := inAnyProject -- inProjects(coreJS),
micrositeName := "schemes",
micrositeDescription := "A recursion schemes micro-library",
micrositeAuthor := "David Gregory",
micrositeHomepage := "https://DavidGregory084.github.io/schemes",
micrositeBaseUrl := "/schemes",
micrositeDocumentationUrl := "api",
micrositeGithubOwner := "DavidGregory084",
micrositeGithubRepo := "schemes",
micrositeExtraMdFiles := Map(file("README.md") -> microsites.ExtraMdFileConfig("index.md", "home")),
micrositePalette := Map(
"brand-primary" -> "#424242",
"brand-secondary" -> "#7A7A7A",
"brand-tertiary" -> "#3F3F3F",
"gray-dark" -> "#453E46",
"gray" -> "#837F84",
"gray-light" -> "#E3E2E3",
"gray-lighter" -> "#F4F3F4",
"white-color" -> "#FFFFFF"),
includeFilter in makeSite := "*.html" | "*.css" | "*.png" | "*.jpg" | "*.gif" | "*.js" | "*.swf" | "*.yml" | "*.md"
)
lazy val commonSettings = Def.settings(
organization := "io.github.davidgregory084",
organizationName := "David Gregory",
releaseCrossBuild := true,
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-core" % "1.4.0",
"org.typelevel" %% "cats-free" % "1.4.0",
"org.typelevel" %% "cats-testkit" % "1.4.0" % Test
),
libraryDependencies ++= {
scalaBinaryVersion.value match {
case "2.10" =>
compilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full) :: Nil
case _ =>
Nil
}
},
headerCreate.in(Compile) := {
headerCreate.in(Compile).triggeredBy(compile.in(Compile)).value
},
addCompilerPlugin("org.spire-math" % "kind-projector" % "0.9.8" cross CrossVersion.binary),
headerLicense := Some(HeaderLicense.ALv2("2018", "David Gregory and the Schemes project contributors")),
unmanagedSources.in(Compile, headerCreate) ++= (sourceDirectory.in(Compile).value / "boilerplate" ** "*.template").get,
coursierVerbosity := {
val travisBuild = isTravisBuild.in(Global).value
if (travisBuild)
0
else
coursierVerbosity.value
}
)
lazy val publishSettings = Def.settings(
releaseCrossBuild := true,
releasePublishArtifactsAction := PgpKeys.publishSigned.value,
publishMavenStyle := true,
publishArtifact.in(Test) := false,
pomIncludeRepository := Function.const(false),
autoAPIMappings := true,
apiURL := Some(url("https://DavidGregory084.github.io/schemes/api/")),
homepage := Some(url("https://github.com/DavidGregory084/schemes")),
startYear := Some(2017),
licenses += ("Apache 2.0", url("https://www.apache.org/licenses/LICENSE-2.0.txt")),
scmInfo := Some(ScmInfo(
url("https://github.com/DavidGregory084/schemes"),
"scm:git:git@github.com:DavidGregory084/schemes.git"
)),
developers := List(Developer(
"DavidGregory084", "David Gregory",
"davidgregory084@gmail.com",
url("https://twitter.com/DavidGregory084")
)),
publishTo := {
val nexus = "https://oss.sonatype.org/"
if (isSnapshot.value)
Some("snapshots" at nexus + "content/repositories/snapshots")
else
Some("releases" at nexus + "service/local/staging/deploy/maven2")
},
credentials ++= (for {
username <- Option(System.getenv().get("SONATYPE_USERNAME"))
password <- Option(System.getenv().get("SONATYPE_PASSWORD"))
} yield Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", username, password)).toSeq,
pomPostProcess := { (node: Node) =>
new RuleTransformer(new RewriteRule {
override def transform(node: Node): NodeSeq = node match {
case elem: Elem =>
val isDependency = elem.label == "dependency"
val isInTestScope = elem.child.exists(c => c.label == "scope" && c.text == "test")
if (isDependency && isInTestScope)
Nil
else
elem
case _ =>
node
}
}).transform(node).head
},
releaseProcess := {
import ReleaseTransformations._
Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
publishArtifacts,
setNextVersion,
commitNextVersion,
ReleaseStep(
action = state => state.copy(
remainingCommands = Exec("sonatypeReleaseAll", None) +: state.remainingCommands
),
enableCrossBuild = true
),
pushChanges
)
}
)
lazy val noPublishSettings = Def.settings(
publish := {},
publishLocal := {},
publishArtifact := false
)