forked from Stratio/incubator-toree
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
225 lines (205 loc) · 7.78 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
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License
*/
import scala.util.Properties
// Version settings
version in ThisBuild := Properties.envOrElse("VERSION", "0.0.0-dev") +
(if ((isSnapshot in ThisBuild).value) "-SNAPSHOT" else "")
isSnapshot in ThisBuild := Properties.envOrElse("IS_SNAPSHOT","true").toBoolean
organization in ThisBuild := "org.apache.toree.kernel"
crossScalaVersions in ThisBuild := Seq("2.11.12")
scalaVersion in ThisBuild := (crossScalaVersions in ThisBuild).value.head
Dependencies.sparkVersion in ThisBuild := {
val envVar = "APACHE_SPARK_VERSION"
val defaultVersion = "2.0.0"
Properties.envOrNone(envVar) match {
case None =>
sLog.value.info(s"Using default Apache Spark version $defaultVersion!")
defaultVersion
case Some(version) =>
sLog.value.info(s"Using Apache Spark version $version, provided from $envVar")
version
}
}
// Compiler settings
scalacOptions in ThisBuild ++= Seq(
"-deprecation",
"-unchecked",
"-feature",
"-Xfatal-warnings",
"-language:reflectiveCalls",
"-target:jvm-1.6",
"-Xlint" // Scala 2.11.x only
)
// Java-based options for compilation (all tasks)
// NOTE: Providing a blank flag causes failures, only uncomment with options
//javacOptions in Compile ++= Seq(""),
// Java-based options for just the compile task
javacOptions in ThisBuild ++= Seq(
"-Xlint:all", // Enable all Java-based warnings
"-Xlint:-path", // Suppress path warnings since we get tons of them
"-Xlint:-options",
"-Xlint:-processing",
"-Werror", // Treat warnings as errors
"-source", "1.6",
"-target", "1.6"
)
// Options provided to forked JVMs through sbt, based on our .jvmopts file
javaOptions in ThisBuild ++= Seq(
"-Xms1024M", "-Xmx4096M", "-Xss2m", "-XX:MaxPermSize=1024M",
"-XX:ReservedCodeCacheSize=256M", "-XX:+TieredCompilation",
"-XX:+CMSPermGenSweepingEnabled", "-XX:+CMSClassUnloadingEnabled",
"-XX:+UseConcMarkSweepGC", "-XX:+HeapDumpOnOutOfMemoryError"
)
// Add additional test option to show time taken per test
testOptions in (ThisBuild, Test) += Tests.Argument("-oDF")
// Build-wide dependencies
resolvers in ThisBuild ++= Seq(
"Apache Snapshots" at "http://repository.apache.org/snapshots/",
"Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/",
"Jitpack" at "https://jitpack.io",
"bintray-sbt-plugins" at "http://dl.bintray.com/sbt/sbt-plugin-releases"
)
updateOptions in ThisBuild := updateOptions.value.withCachedResolution(true)
libraryDependencies in ThisBuild ++= Seq(
Dependencies.scalaTest % "test",
Dependencies.mockito % "test",
Dependencies.jacksonDatabind % "test"
)
// Publish settings
useGpg in ThisBuild := true
pgpPassphrase in ThisBuild := Some(Properties.envOrElse("GPG_PASSWORD","").toArray)
publishTo in ThisBuild := {
if (isSnapshot.value)
Some("Apache Staging Repo" at "https://repository.apache.org/content/repositories/snapshots/")
else
Some("Apache Staging Repo" at "https://repository.apache.org/content/repositories/staging/")
}
mappings in packageBin in ThisBuild := Seq(
file("LICENSE") -> "LICENSE",
file("NOTICE") -> "NOTICE"
)
licenses in ThisBuild := Seq("Apache 2" -> url("http://www.apache.org/licenses/LICENSE-2.0.txt"))
pomExtra in ThisBuild := {
<parent>
<groupId>org.apache</groupId>
<artifactId>apache</artifactId>
<version>10</version>
</parent>
<url>http://toree.incubator.apache.org/</url>
<scm>
<url>[email protected]:apache/incubator-toree.git</url>
<connection>scm:git:[email protected]:apache/incubator-toree.git</connection>
<developerConnection>
scm:git:https://git-wip-us.apache.org/repos/asf/incubator-toree.git
</developerConnection>
<tag>HEAD</tag>
</scm>
}
credentials in ThisBuild+= Credentials(Path.userHome / ".ivy2" / ".credentials")
// Project structure
/** Root Toree project. */
lazy val root = (project in file("."))
.settings(name := "toree")
.aggregate(
macros,protocol,plugins,communication,kernelApi,client,scalaInterpreter,sqlInterpreter,kernel
)
.dependsOn(
macros,protocol,communication,kernelApi,client,scalaInterpreter,sqlInterpreter,kernel
)
/**
* Project representing macros in Scala that must be compiled separately from
* any other project using them.
*/
lazy val macros = (project in file("macros"))
.settings(name := "toree-macros")
/**
* Project representing the IPython kernel message protocol in Scala. Used
* by the client and kernel implementations.
*/
lazy val protocol = (project in file("protocol"))
.settings(name := "toree-protocol")
.dependsOn(macros)
/**
* Project representing base plugin system for the Toree infrastructure.
*/
lazy val plugins = (project in file("plugins"))
.settings(name := "toree-plugins")
.dependsOn(macros)
/**
* Project representing forms of communication used as input/output for the
* client/kernel.
*/
lazy val communication = (project in file("communication"))
.settings(name := "toree-communication")
.dependsOn(macros, protocol)
/**
* Project representing the kernel-api code used by the Spark Kernel. Others can
* import this to implement their own magics and plugins.
*/
lazy val kernelApi = (project in file("kernel-api"))
.settings(name := "toree-kernel-api")
.dependsOn(macros, plugins)
/**
* Project representing the client code for connecting to the kernel backend.
*/
lazy val client = (project in file("client"))
.settings(name := "toree-client")
.dependsOn(macros, protocol, communication)
/**
* Project represents the scala interpreter used by the Spark Kernel.
*/
lazy val scalaInterpreter = (project in file("scala-interpreter"))
.settings(name := "toree-scala-interpreter")
.dependsOn(plugins, protocol, kernelApi)
/**
* Project represents the SQL interpreter used by the Spark Kernel.
*/
lazy val sqlInterpreter = (project in file("sql-interpreter"))
.settings(name := "toree-sql-interpreter")
.dependsOn(plugins, protocol, kernelApi, scalaInterpreter)
/**
* Project representing the kernel code for the Spark Kernel backend.
*/
lazy val kernel = (project in file("kernel"))
.settings(name := "toree-kernel")
.dependsOn(
macros % "test->test;compile->compile",
protocol % "test->test;compile->compile",
communication % "test->test;compile->compile",
kernelApi % "test->test;compile->compile",
scalaInterpreter % "test->test;compile->compile",
sqlInterpreter % "test->test;compile->compile"
)
// Root project settings
enablePlugins(ScalaUnidocPlugin)
scalacOptions in (ScalaUnidoc, unidoc) ++= Seq(
"-Ymacro-expand:none",
"-skip-packages", Seq(
"akka",
"scala"
).mkString(":"),
"-no-link-warnings" // Suppresses problems with Scaladoc @throws links
)
libraryDependencies ++= Dependencies.sparkAll.value
unmanagedResourceDirectories in Compile += { baseDirectory.value / "dist/toree-legal" }
assemblyShadeRules in assembly := Seq(
ShadeRule.rename("org.clapper.classutil.**" -> "shadeclapper.@0").inAll,
ShadeRule.rename("org.objectweb.asm.**" -> "shadeasm.@0").inAll
)
test in assembly := {}
assemblyOption in assembly := (assemblyOption in assembly).value.copy(includeScala = false)
aggregate in assembly := false