forked from typelevel/frameless
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
231 lines (214 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
226
227
228
229
230
231
val sparkVersion = "2.4.0"
val catsCoreVersion = "1.4.0"
val catsEffectVersion = "1.0.0"
val catsMtlVersion = "0.3.0"
val scalatest = "3.0.3"
val shapeless = "2.3.2"
val scalacheck = "1.14.0"
lazy val root = Project("frameless", file("." + "frameless")).in(file("."))
.aggregate(core, cats, dataset, ml, docs)
.settings(framelessSettings: _*)
.settings(noPublishSettings: _*)
lazy val core = project
.settings(name := "frameless-core")
.settings(framelessSettings: _*)
.settings(publishSettings: _*)
lazy val cats = project
.settings(name := "frameless-cats")
.settings(framelessSettings: _*)
.settings(publishSettings: _*)
.settings(
addCompilerPlugin("org.spire-math" %% "kind-projector" % "0.9.4"),
scalacOptions += "-Ypartial-unification"
)
.settings(libraryDependencies ++= Seq(
"org.typelevel" %% "cats-core" % catsCoreVersion,
"org.typelevel" %% "cats-effect" % catsEffectVersion,
"org.typelevel" %% "cats-mtl-core" % catsMtlVersion,
"org.typelevel" %% "alleycats-core" % catsCoreVersion,
"org.apache.spark" %% "spark-core" % sparkVersion % "provided",
"org.apache.spark" %% "spark-sql" % sparkVersion % "provided"))
.dependsOn(dataset % "test->test;compile->compile")
lazy val dataset = project
.settings(name := "frameless-dataset")
.settings(framelessSettings: _*)
.settings(framelessTypedDatasetREPL: _*)
.settings(publishSettings: _*)
.settings(libraryDependencies ++= Seq(
"org.apache.spark" %% "spark-core" % sparkVersion % "provided",
"org.apache.spark" %% "spark-sql" % sparkVersion % "provided"
))
.dependsOn(core % "test->test;compile->compile")
lazy val ml = project
.settings(name := "frameless-ml")
.settings(framelessSettings: _*)
.settings(framelessTypedDatasetREPL: _*)
.settings(publishSettings: _*)
.settings(libraryDependencies ++= Seq(
"org.apache.spark" %% "spark-core" % sparkVersion % "provided",
"org.apache.spark" %% "spark-sql" % sparkVersion % "provided",
"org.apache.spark" %% "spark-mllib" % sparkVersion % "provided"
))
.dependsOn(
core % "test->test;compile->compile",
dataset % "test->test;compile->compile"
)
lazy val docs = project
.settings(framelessSettings: _*)
.settings(noPublishSettings: _*)
.settings(tutSettings: _*)
.settings(crossTarget := file(".") / "docs" / "target")
.settings(libraryDependencies ++= Seq(
"org.apache.spark" %% "spark-core" % sparkVersion,
"org.apache.spark" %% "spark-sql" % sparkVersion,
"org.apache.spark" %% "spark-mllib" % sparkVersion
))
.settings(
addCompilerPlugin("org.spire-math" %% "kind-projector" % "0.9.4"),
scalacOptions ++= Seq(
"-Ypartial-unification",
"-Ydelambdafy:inline"
)
)
.dependsOn(dataset, cats, ml)
lazy val framelessSettings = Seq(
organization := "org.typelevel",
crossScalaVersions := Seq("2.11.12", "2.12.8"),
scalaVersion := crossScalaVersions.value.last,
scalacOptions ++= commonScalacOptions(scalaVersion.value),
licenses += ("Apache-2.0", url("http://opensource.org/licenses/Apache-2.0")),
testOptions in Test += Tests.Argument(TestFrameworks.ScalaTest, "-oDF"),
libraryDependencies ++= Seq(
"com.chuusai" %% "shapeless" % shapeless,
"org.scalatest" %% "scalatest" % scalatest % "test",
"org.scalacheck" %% "scalacheck" % scalacheck % "test"),
javaOptions in Test ++= Seq("-Xmx1G", "-ea"),
fork in Test := true,
parallelExecution in Test := false
) ++ consoleSettings
def commonScalacOptions(scalaVersion: String): Seq[String] = {
val versionSpecific = CrossVersion.partialVersion(scalaVersion) match {
case Some((2, 11)) =>
Seq("-Xlint:-missing-interpolator,_", "-Yinline-warnings")
case Some((2, n)) if n >= 12 =>
Seq("-Xlint:-missing-interpolator,-unused,_")
}
Seq(
"-target:jvm-1.8",
"-deprecation",
"-encoding", "UTF-8",
"-feature",
"-unchecked",
"-Xfatal-warnings",
"-Yno-adapted-args",
"-Ywarn-dead-code",
"-Ywarn-numeric-widen",
"-Ywarn-unused-import",
"-Ywarn-value-discard",
"-language:existentials",
"-language:experimental.macros",
"-language:implicitConversions",
"-language:higherKinds",
"-Xfuture") ++ versionSpecific
}
lazy val consoleSettings = Seq(
scalacOptions in (Compile, console) ~= {_.filterNot("-Ywarn-unused-import" == _)},
scalacOptions in (Test, console) := (scalacOptions in (Compile, console)).value
)
lazy val framelessTypedDatasetREPL = Seq(
initialize ~= { _ => // Color REPL
val ansi = System.getProperty("sbt.log.noformat", "false") != "true"
if (ansi) System.setProperty("scala.color", "true")
},
initialCommands in console :=
"""
|import org.apache.spark.{SparkConf, SparkContext}
|import org.apache.spark.sql.SparkSession
|import frameless.functions.aggregate._
|import frameless.syntax._
|
|val conf = new SparkConf().setMaster("local[*]").setAppName("frameless repl").set("spark.ui.enabled", "false")
|implicit val spark = SparkSession.builder().config(conf).appName("REPL").getOrCreate()
|
|import spark.implicits._
|
|spark.sparkContext.setLogLevel("WARN")
|
|import frameless.TypedDataset
""".stripMargin,
cleanupCommands in console :=
"""
|spark.stop()
""".stripMargin
)
lazy val publishSettings = Seq(
useGpg := true,
publishMavenStyle := true,
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")
},
publishArtifact in Test := false,
pomIncludeRepository := Function.const(false),
pomExtra in Global := {
<url>https://github.com/typelevel/frameless</url>
<scm>
<url>git@github.com:typelevel/frameless.git</url>
<connection>scm:git:git@github.com:typelevel/frameless.git</connection>
</scm>
<developers>
<developer>
<id>OlivierBlanvillain</id>
<name>Olivier Blanvillain</name>
<url>https://github.com/OlivierBlanvillain/</url>
</developer>
<developer>
<id>adelbertc</id>
<name>Adelbert Chang</name>
<url>https://github.com/adelbertc/</url>
</developer>
<developer>
<id>imarios</id>
<name>Marios Iliofotou</name>
<url>https://github.com/imarios/</url>
</developer>
<developer>
<id>kanterov</id>
<name>Gleb Kanterov</name>
<url>https://github.com/kanterov/</url>
</developer>
<developer>
<id>non</id>
<name>Erik Osheim</name>
<url>https://github.com/non/</url>
</developer>
<developer>
<id>jeremyrsmith</id>
<name>Jeremy Smith</name>
<url>https://github.com/jeremyrsmith/</url>
</developer>
</developers>
}
)
lazy val noPublishSettings = Seq(
publish := (),
publishLocal := (),
publishArtifact := false
)
lazy val credentialSettings = Seq(
// For Travis CI - see http://www.cakesolutions.net/teamblogs/publishing-artefacts-to-oss-sonatype-nexus-using-sbt-and-travis-ci
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
)
copyReadme := copyReadmeImpl.value
lazy val copyReadme = taskKey[Unit]("copy for website generation")
lazy val copyReadmeImpl = Def.task {
val from = baseDirectory.value / "README.md"
val to = baseDirectory.value / "docs" / "src" / "main" / "tut" / "README.md"
sbt.IO.copy(List((from, to)), overwrite = true, preserveLastModified = true)
}