forked from zio/zio-prelude
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
160 lines (146 loc) · 5.42 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
import BuildHelper._
inThisBuild(
List(
organization := "dev.zio",
homepage := Some(url("https://zio.github.io/zio-prelude/")),
licenses := List("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")),
developers := List(
Developer(
"jdegoes",
"John De Goes",
"john@degoes.net",
url("http://degoes.net")
)
),
pgpPassphrase := sys.env.get("PGP_PASSWORD").map(_.toArray),
pgpPublicRing := file("/tmp/public.asc"),
pgpSecretRing := file("/tmp/secret.asc"),
scmInfo := Some(
ScmInfo(url("https://github.com/zio/zio-prelude/"), "scm:git:git@github.com:zio/zio-prelude.git")
)
)
)
addCommandAlias("fix", "; all compile:scalafix test:scalafix; all scalafmtSbt scalafmtAll")
addCommandAlias("check", "; scalafmtSbtCheck; scalafmtCheckAll; compile:scalafix --check; test:scalafix --check")
addCommandAlias(
"testJVM",
";coreJVM/test;experimentalJVM/test"
)
addCommandAlias(
"testJS",
";coreJS/test;experimentalJVM/test"
)
addCommandAlias(
"testNative",
";coreNative/test:compile;experimentalJVM/test"
)
val zioVersion = "1.0.3"
lazy val root = project
.in(file("."))
.settings(
skip in publish := true,
unusedCompileDependenciesFilter -= moduleFilter("org.scala-js", "scalajs-library")
)
.aggregate(
coreJVM,
coreJS,
coreNative,
experimentalJVM,
experimentalJS,
experimentalNative,
benchmarks,
docs
)
.enablePlugins(ScalaJSPlugin)
lazy val core = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.in(file("core"))
.settings(stdSettings("zio-prelude"))
.settings(crossProjectSettings)
.settings(buildInfoSettings("zio.prelude"))
.settings(scalacOptions in (Compile, console) ~= { _.filterNot(Set("-Xfatal-warnings")) })
.settings( // 2.13 and Dotty standard library doesn't contain Parallel Scala collections
libraryDependencies ++= {
val spc = List("org.scala-lang.modules" %% "scala-parallel-collections" % "1.0.0" % Optional)
Seq(
"dev.zio" %%% "zio" % zioVersion,
"dev.zio" %%% "zio-test" % zioVersion
) ++
(scalaVersion.value match {
case BuildHelper.Scala213 => spc
case BuildHelper.ScalaDotty => spc.map(_.withDottyCompat(scalaVersion.value))
case _ => List()
})
}
)
.settings(testFrameworks := Seq(new TestFramework("zio.test.sbt.ZTestFramework")))
.enablePlugins(BuildInfoPlugin)
lazy val coreJS = core.js
.settings(jsSettings)
.settings(libraryDependencies += "dev.zio" %%% "zio-test-sbt" % zioVersion)
lazy val coreJVM = core.jvm
.settings(dottySettings)
.settings(libraryDependencies += "dev.zio" %%% "zio-test-sbt" % zioVersion)
lazy val coreNative = core.native
.settings(nativeSettings)
.settings(
resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots",
dependencyOverrides += "dev.zio" %%% "zio" % "1.0.3+68-eaa7424f-SNAPSHOT"
)
.disablePlugins(
ScalafixPlugin // for some reason `ThisBuild / scalafixScalaBinaryVersion := CrossVersion.binaryScalaVersion(scalaVersion.value)` isn't enough
)
lazy val experimental = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.in(file("experimental"))
.dependsOn(core)
.settings(stdSettings("zio-prelude-experimental"))
.settings(crossProjectSettings)
.settings(buildInfoSettings("zio.prelude.experimental"))
lazy val experimentalJVM = experimental.jvm
.settings(dottySettings)
.settings(libraryDependencies += "dev.zio" %%% "zio-test-sbt" % zioVersion)
lazy val experimentalJS = experimental.js
.settings(jsSettings)
.settings(libraryDependencies += "dev.zio" %%% "zio-test-sbt" % zioVersion)
lazy val experimentalNative = experimental.native
.settings(nativeSettings)
.settings(
resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots",
dependencyOverrides += "dev.zio" %%% "zio" % "1.0.3+68-eaa7424f-SNAPSHOT"
)
.disablePlugins(
ScalafixPlugin // for some reason `ThisBuild / scalafixScalaBinaryVersion := CrossVersion.binaryScalaVersion(scalaVersion.value)` isn't enough
)
lazy val benchmarks = project.module
.settings(
skip.in(publish) := true,
moduleName := "zio-prelude-benchmarks",
scalacOptions -= "-Yno-imports",
scalacOptions -= "-Xfatal-warnings",
libraryDependencies ++= Seq(
"dev.zio" %% "zio" % zioVersion,
("org.typelevel" %% "cats-core" % "2.3.0") match {
case cats if isDotty.value => cats.withDottyCompat(scalaVersion.value)
case cats => cats
}
)
)
.dependsOn(coreJVM)
.enablePlugins(JmhPlugin)
lazy val docs = project
.in(file("zio-prelude-docs"))
.settings(
skip.in(publish) := true,
moduleName := "zio-prelude-docs",
scalacOptions -= "-Yno-imports",
scalacOptions -= "-Xfatal-warnings",
libraryDependencies ++= Seq(
"dev.zio" %% "zio" % zioVersion
),
unidocProjectFilter in (ScalaUnidoc, unidoc) := inProjects(coreJVM),
target in (ScalaUnidoc, unidoc) := (baseDirectory in LocalRootProject).value / "website" / "static" / "api",
cleanFiles += (target in (ScalaUnidoc, unidoc)).value,
docusaurusCreateSite := docusaurusCreateSite.dependsOn(unidoc in Compile).value,
docusaurusPublishGhpages := docusaurusPublishGhpages.dependsOn(unidoc in Compile).value
)
.dependsOn(coreJVM, coreJS)
.enablePlugins(MdocPlugin, DocusaurusPlugin, ScalaUnidocPlugin)