forked from typelevel/frameless
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sbt
158 lines (146 loc) · 4.96 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
val sparkVersion = "2.0.1"
val catsv = "0.7.2"
val sparkTesting = "0.3.3"
val scalatest = "2.2.5"
val shapeless = "2.3.0"
val scalacheck = "1.12.5"
lazy val root = Project("frameless", file("." + "frameless")).in(file("."))
.aggregate(core, cats, dataset, docs)
.settings(framelessSettings: _*)
.settings(noPublishSettings: _*)
lazy val core = project
.settings(name := "frameless-core")
.settings(framelessSettings: _*)
.settings(warnUnusedImport: _*)
.settings(publishSettings: _*)
lazy val cats = project
.settings(name := "frameless-cats")
.settings(framelessSettings: _*)
.settings(warnUnusedImport: _*)
.settings(publishSettings: _*)
.settings(libraryDependencies ++= Seq(
"org.typelevel" %% "cats" % catsv,
"org.apache.spark" %% "spark-core" % sparkVersion))
lazy val dataset = project
.settings(name := "frameless-dataset")
.settings(framelessSettings: _*)
.settings(warnUnusedImport: _*)
.settings(framelessTypedDatasetREPL: _*)
.settings(publishSettings: _*)
.settings(libraryDependencies ++= Seq(
"org.apache.spark" %% "spark-core" % sparkVersion,
"org.apache.spark" %% "spark-sql" % sparkVersion
))
.dependsOn(core % "test->test;compile->compile")
lazy val docs = project
.settings(framelessSettings: _*)
.settings(noPublishSettings: _*)
.settings(tutSettings: _*)
.settings(crossTarget := file(".") / "docs" / "target")
.dependsOn(dataset)
lazy val framelessSettings = Seq(
organization := "io.github.adelbertc",
scalaVersion := "2.11.8",
scalacOptions ++= commonScalacOptions,
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"),
fork in Test := false,
parallelExecution in Test := false
)
lazy val commonScalacOptions = Seq(
"-deprecation",
"-encoding", "UTF-8",
"-feature",
"-unchecked",
"-Xfatal-warnings",
"-Xlint:-missing-interpolator,_",
"-Yinline-warnings",
"-Yno-adapted-args",
"-Ywarn-dead-code",
"-Ywarn-numeric-widen",
"-Ywarn-value-discard",
"-language:existentials",
"-language:experimental.macros",
"-language:implicitConversions",
"-language:higherKinds",
"-Xfuture")
lazy val warnUnusedImport = Seq(
scalacOptions ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 10)) =>
Seq()
case Some((2, n)) if n >= 11 =>
Seq("-Ywarn-unused-import")
}
},
scalacOptions in (Compile, console) ~= {_.filterNot("-Ywarn-unused-import" == _)},
scalacOptions in (Test, console) <<= (scalacOptions in (Compile, console))
)
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._
|
|val conf = new SparkConf().setMaster("local[*]").setAppName("frameless repl").set("spark.ui.enabled", "false")
|val spark = SparkSession.builder().config(conf).appName("REPL").getOrCreate()
|
|import spark.implicits._
|
|spark.sparkContext.setLogLevel("WARN")
|
|import frameless.TypedDataset
|implicit val sqlContenxt = spark.sqlContext
""".stripMargin,
cleanupCommands in console :=
"""
|spark.stop()
""".stripMargin
)
lazy val publishSettings = Seq(
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/adelbertc/frameless</url>
<scm>
<url>[email protected]:adelbertc/frameless.git</url>
<connection>scm:git:[email protected]:adelbertc/frameless.git</connection>
</scm>
<developers>
<developer>
<id>adelbertc</id>
<name>Adelbert Chang</name>
<url>https://github.com/adelbertc/</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
)