forked from scalaz/scalaz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
169 lines (151 loc) · 4.82 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
import build._
import com.typesafe.sbt.osgi.OsgiKeys
import sbtcrossproject.CrossPlugin.autoImport.crossProject
val minSuccessfulTests = settingKey[Int]("")
/*
* NOTICE if you are a contributor who only cares about the JVM, create a file
* `local.sbt` containing
*
* onLoad in Global := { s => "project rootJVM" :: s }
*
* and regular commands such as "compile" / "test" will skip over all the
* scalajs / scala-native stuff.
*/
lazy val jsProjects = Seq[ProjectReference](
coreJS, effectJS, iterateeJS, scalacheckBindingJS, testsJS
)
lazy val jvmProjects = Seq[ProjectReference](
coreJVM, effectJVM, iterateeJVM, scalacheckBindingJVM, testsJVM, concurrent, example
)
lazy val nativeProjects = Seq[ProjectReference](
coreNative, effectNative, iterateeNative, nativeTest
)
lazy val scalaz = Project(
id = "scalaz",
base = file(".")
).settings(
standardSettings,
description := "scalaz unidoc",
artifacts := Classpaths.artifactDefs(Seq(packageDoc in Compile, makePom in Compile)).value,
packagedArtifacts := Classpaths.packaged(Seq(packageDoc in Compile, makePom in Compile)).value,
pomPostProcess := { node =>
import scala.xml._
import scala.xml.transform._
val rule = new RewriteRule {
override def transform(n: Node) =
if (n.label == "dependencies") NodeSeq.Empty else n
}
new RuleTransformer(rule).transform(node)(0)
},
unidocProjectFilter in (ScalaUnidoc, unidoc) := {
(jsProjects ++ nativeProjects).foldLeft(inAnyProject)((acc, a) => acc -- inProjects(a))
},
Defaults.packageTaskSettings(packageDoc in Compile, (unidoc in Compile).map(_.flatMap(Path.allSubpaths)))
).aggregate(
jvmProjects ++ jsProjects : _*
).enablePlugins(ScalaUnidocPlugin)
lazy val rootNative = Project(
rootNativeId,
file("rootNative")
).settings(
standardSettings,
notPublish
).aggregate(nativeProjects: _*)
lazy val rootJS = Project(
"rootJS",
file("rootJS")
).settings(
standardSettings,
notPublish
).aggregate(jsProjects: _*)
lazy val rootJVM = Project(
"rootJVM",
file("rootJVM")
).settings(
standardSettings,
notPublish
).aggregate(jvmProjects: _*)
lazy val coreJVM = core.jvm
lazy val coreJS = core.js
lazy val coreNative = core.native
lazy val concurrent = Project(
id = "concurrent",
base = file("concurrent")
).settings(
standardSettings,
name := ConcurrentName,
scalacOptions in (Compile, compile) += "-Xfatal-warnings",
typeClasses := TypeClass.concurrent,
osgiExport("scalaz.concurrent"),
OsgiKeys.importPackage := Seq("javax.swing;resolution:=optional", "*")
).dependsOn(
coreJVM, effectJVM
)
lazy val effectJVM = effect.jvm
lazy val effectJS = effect.js
lazy val effectNative = effect.native
lazy val iterateeJVM = iteratee.jvm
lazy val iterateeJS = iteratee.js
lazy val iterateeNative = iteratee.native
lazy val example = Project(
id = "example",
base = file("example")
).settings(
standardSettings,
name := "scalaz-example",
notPublish,
scalacOptions in (Compile, compile) -= "-Yno-adapted-args"
).dependsOn(
coreJVM, iterateeJVM, concurrent
)
lazy val scalacheckBinding =
crossProject(JVMPlatform, JSPlatform).crossType(ScalazCrossType)
.in(file("scalacheck-binding"))
.settings(standardSettings)
.settings(
name := "scalaz-scalacheck-binding",
scalacOptions in (Compile, compile) += "-Xfatal-warnings",
scalacOptions in (Compile, compile) -= "-Ywarn-value-discard",
libraryDependencies += "org.scalacheck" %%% "scalacheck" % scalaCheckVersion.value,
osgiExport("scalaz.scalacheck")
)
.dependsOn(core, iteratee)
.jvmConfigure(_ dependsOn concurrent)
.jsSettings(scalajsProjectSettings)
lazy val scalacheckBindingJVM = scalacheckBinding.jvm
lazy val scalacheckBindingJS = scalacheckBinding.js
lazy val tests = crossProject(JSPlatform, JVMPlatform).crossType(ScalazCrossType)
.settings(standardSettings)
.settings(
name := "scalaz-tests",
notPublish,
testOptions in Test += {
val scalacheckOptions = Seq(
"-maxSize", "5",
"-workers", "1",
"-maxDiscardRatio", "50",
"-minSuccessfulTests", minSuccessfulTests.value.toString
)
Tests.Argument(TestFrameworks.ScalaCheck, scalacheckOptions: _*)
},
libraryDependencies += "org.scalacheck" %%% "scalacheck" % scalaCheckVersion.value % "test")
.jvmSettings(
minSuccessfulTests := 33
)
.jsSettings(
minSuccessfulTests := 10
)
.dependsOn(core, effect, iteratee, scalacheckBinding)
.jvmConfigure(_ dependsOn concurrent)
.jsSettings(scalajsProjectSettings)
lazy val testsJVM = tests.jvm
lazy val testsJS = tests.js
// can't use "sbt test"
// https://github.com/scala-native/scala-native/issues/339
lazy val nativeTest = Project(nativeTestId, file("nativeTest")).enablePlugins(ScalaNativePlugin)
.settings(
standardSettings,
nativeSettings,
notPublish
)
.dependsOn(iterateeNative)