forked from vpavkin/dtc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
249 lines (224 loc) · 7.29 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
246
247
248
249
import ReleaseTransformations._
import sbtcrossproject.CrossPlugin.autoImport.crossProject
lazy val buildSettings = Seq(
organization := "ru.pavkin",
scalaVersion := "2.12.7",
crossScalaVersions := Seq("2.11.11", "2.12.7")
)
lazy val compilerOptions = Seq(
"-deprecation",
"-encoding", "UTF-8",
"-feature",
"-language:existentials",
"-language:higherKinds",
"-unchecked",
"-Xfatal-warnings",
"-Yno-adapted-args",
"-Ywarn-dead-code",
"-Ywarn-numeric-widen",
"-Xfuture"
)
lazy val catsVersion = "1.4.0"
lazy val simulacrumVersion = "0.13.0"
lazy val scalaJSJavaTimeVersion = "0.2.5"
lazy val disciplineVersion = "0.10.0"
lazy val scalaCheckDateTimeVersion = "0.2.1"
lazy val scalaCheckVersion = "1.14.0"
lazy val scalaTestVersion = "3.0.5"
lazy val momentFacadeVersion = "0.9.2"
lazy val baseSettings = Seq(
scalacOptions ++= compilerOptions ++ Seq(
"-Ywarn-unused-import"
),
testOptions in Test += Tests.Argument("-oF"),
scalacOptions in(Compile, console) := compilerOptions,
scalacOptions in(Compile, test) := compilerOptions,
resolvers ++= Seq(
Resolver.sonatypeRepo("releases")
),
libraryDependencies ++= Seq(
"com.github.mpilquist" %%% "simulacrum" % simulacrumVersion,
compilerPlugin("org.scalamacros" %% "paradise" % "2.1.1" cross CrossVersion.full)
)
)
lazy val allSettings = buildSettings ++ baseSettings ++ publishSettings
lazy val dtc = project.in(file("."))
.settings(name := "dtc")
.settings(allSettings: _*)
.settings(docSettings: _*)
.settings(noPublishSettings: _*)
.enablePlugins(ScalaUnidocPlugin)
.enablePlugins(GhpagesPlugin)
.aggregate(coreJVM, coreJS, moment, lawsJVM, lawsJS, catsJVM, catsJS, examplesJVM, examplesJS, testsJS, testsJVM)
.dependsOn(coreJVM, coreJS, moment, lawsJVM, lawsJS, catsJVM, catsJS, examplesJVM, examplesJS, testsJS, testsJVM)
lazy val core = (crossProject(JSPlatform, JVMPlatform) in file("core"))
.settings(
description := "DTC core",
moduleName := "dtc-core",
name := "core"
)
.settings(allSettings: _*)
.settings(
libraryDependencies += "org.typelevel" %%% "cats-kernel" % catsVersion
)
.jsSettings(
libraryDependencies += "org.scala-js" %%% "scalajs-java-time" % scalaJSJavaTimeVersion
)
lazy val coreJVM = core.jvm
lazy val coreJS = core.js
lazy val moment = project.in(file("moment"))
.enablePlugins(ScalaJSBundlerPlugin)
.settings(
description := "DTC moment",
moduleName := "dtc-moment",
name := "moment"
)
.settings(allSettings: _*)
.settings(
libraryDependencies += "ru.pavkin" %%% "scala-js-momentjs" % momentFacadeVersion
)
.dependsOn(coreJS)
lazy val cats = (crossProject(JSPlatform, JVMPlatform) in file("cats"))
.settings(
description := "DTC cats",
moduleName := "dtc-cats",
name := "cats"
)
.settings(allSettings: _*)
.settings(
libraryDependencies += "org.typelevel" %%% "cats-core" % catsVersion
)
.jsConfigure(_.enablePlugins(ScalaJSBundlerPlugin))
.dependsOn(core)
lazy val catsJVM = cats.jvm
lazy val catsJS = cats.js
lazy val laws = (crossProject(JSPlatform, JVMPlatform) in file("laws"))
.settings(
description := "DTC laws",
moduleName := "dtc-laws",
name := "laws"
)
.settings(allSettings: _*)
.settings(libraryDependencies ++= Seq(
"org.typelevel" %%% "discipline" % disciplineVersion,
"org.typelevel" %%% "cats-kernel" % catsVersion,
"org.typelevel" %%% "cats-core" % catsVersion,
"org.typelevel" %%% "cats-kernel-laws" % catsVersion
))
.settings(
coverageExcludedPackages := "dtc\\.laws\\..*"
)
.jsConfigure(_.enablePlugins(ScalaJSBundlerPlugin))
.dependsOn(core)
lazy val lawsJVM = laws.jvm
lazy val lawsJS = laws.js
lazy val examples = (crossProject(JSPlatform, JVMPlatform) in file("examples"))
.settings(
description := "DTC examples",
moduleName := "dtc-examples",
name := "examples"
)
.settings(allSettings: _*)
.settings(noPublishSettings: _*)
.settings(libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-core" % catsVersion
))
.settings(
coverageExcludedPackages := "dtc\\.examples\\..*"
)
.jsConfigure(_.enablePlugins(ScalaJSBundlerPlugin))
.dependsOn(core)
lazy val examplesJVM = examples.jvm
lazy val examplesJS = examples.js
lazy val tests = (crossProject(JSPlatform, JVMPlatform) in file("tests"))
.settings(
description := "DTC tests",
moduleName := "dtc-tests",
name := "tests"
)
.settings(allSettings: _*)
.settings(noPublishSettings: _*)
.settings(libraryDependencies ++= Seq(
"org.typelevel" %%% "discipline" % disciplineVersion % "test",
"org.scalacheck" %%% "scalacheck" % scalaCheckVersion % "test",
"org.scalatest" %%% "scalatest" % scalaTestVersion % "test",
"com.fortysevendeg" %% "scalacheck-toolbox-datetime" % scalaCheckDateTimeVersion % "test"
))
.settings(
coverageExcludedPackages := "dtc\\.tests\\..*"
)
.jsConfigure(_.enablePlugins(ScalaJSBundlerPlugin))
.dependsOn(core, laws)
.jsConfigure(_.dependsOn(moment))
lazy val testsJVM = tests.jvm
lazy val testsJS = tests.js
lazy val noDocProjects: Seq[ProjectReference] =
Seq(dtc, coreJS, catsJS, lawsJVM, lawsJS, testsJVM, testsJS, examplesJVM, examplesJS)
lazy val docSettings = Seq(
siteSubdirName in ScalaUnidoc := "api",
addMappingsToSiteDir(mappings in(ScalaUnidoc, packageDoc), siteSubdirName in ScalaUnidoc),
scalacOptions in(ScalaUnidoc, unidoc) ++= Seq(
"-Ymacro-expand:none",
"-groups",
"-implicits",
"-doc-source-url", scmInfo.value.get.browseUrl + "/tree/master€{FILE_PATH}.scala",
"-sourcepath", baseDirectory.in(LocalRootProject).value.getAbsolutePath
),
git.remoteRepo := "git@github.com:vpavkin/dtc.git",
unidocProjectFilter in(ScalaUnidoc, unidoc) := (inAnyProject -- inProjects(noDocProjects: _*))
)
lazy val noPublishSettings = Seq(
publish := {},
publishLocal := {},
publishArtifact := false
)
lazy val publishSettings = Seq(
releaseIgnoreUntrackedFiles := true,
releaseCrossBuild := true,
releasePublishArtifactsAction := PgpKeys.publishSigned.value,
homepage := Some(url("https://github.com/vpavkin/dtc")),
licenses := Seq("Apache 2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")),
publishMavenStyle := true,
publishArtifact in Test := false,
pomIncludeRepository := { _ => false },
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")
},
autoAPIMappings := true,
apiURL := Some(url("https://vpavkin.github.io/dtc/api/")),
scmInfo := Some(
ScmInfo(
url("https://github.com/vpavkin/dtc"),
"scm:git:git@github.com:vpavkin/dtc.git"
)
),
pomExtra :=
<developers>
<developer>
<id>vpavkin</id>
<name>Vladimir Pavkin</name>
<url>http://pavkin.ru</url>
</developer>
</developers>
)
lazy val sharedReleaseProcess = Seq(
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
publishArtifacts,
setNextVersion,
commitNextVersion,
ReleaseStep(action = releaseStepCommand("sonatypeReleaseAll")),
pushChanges
)
)
addCommandAlias("validate", ";compile;testsJVM/test;testsJS/test")