-
Notifications
You must be signed in to change notification settings - Fork 224
/
Copy pathbuild.sbt
229 lines (208 loc) · 7.84 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
/*
* 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
ThisBuild / version := Properties.envOrElse("VERSION", "0.0.0-dev") +
(if ((ThisBuild / isSnapshot ).value) "-SNAPSHOT" else "")
ThisBuild / isSnapshot := Properties.envOrElse("IS_SNAPSHOT","true").toBoolean
ThisBuild / organization := "org.apache.toree.kernel"
ThisBuild / crossScalaVersions := Seq("2.12.15")
ThisBuild / scalaVersion := (ThisBuild / crossScalaVersions ).value.head
ThisBuild / Dependencies.sparkVersion := {
val envVar = "APACHE_SPARK_VERSION"
val defaultVersion = "3.3.2"
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
ThisBuild / scalacOptions ++= Seq(
"-deprecation",
"-unchecked",
"-feature",
"-Xfatal-warnings",
"-language:reflectiveCalls",
"-target:jvm-1.8"
)
// Java-based options for compilation (all tasks)
// NOTE: Providing a blank flag causes failures, only uncomment with options
// Compile / javacOptions ++= Seq(""),
// Java-based options for just the compile task
ThisBuild / javacOptions ++= 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.8",
"-target", "1.8"
)
// Options provided to forked JVMs through sbt, based on our .jvmopts file
ThisBuild / javaOptions ++= Seq(
"-Xms1024M", "-Xmx4096M", "-Xss2m", "-XX:MetaspaceSize=1024M",
"-XX:ReservedCodeCacheSize=256M", "-XX:+HeapDumpOnOutOfMemoryError"
)
// Add additional test option to show time taken per test
ThisBuild / Test / testOptions += Tests.Argument("-oDF")
// Build-wide dependencies
ThisBuild / resolvers ++= Seq(
"Apache Snapshots" at "https://repository.apache.org/snapshots/",
"Typesafe repository" at "https://repo.typesafe.com/typesafe/releases/",
"Jitpack" at "https://jitpack.io",
"bintray-sbt-plugins" at "https://dl.bintray.com/sbt/sbt-plugin-releases"
)
ThisBuild / updateOptions := updateOptions.value.withCachedResolution(true)
ThisBuild / libraryDependencies ++= Seq(
Dependencies.scalaTest % "test",
Dependencies.scalaTestMockito % "test",
Dependencies.mockitoInline % "test",
Dependencies.jacksonDatabind % "test"
)
// Publish settings
ThisBuild / pgpPassphrase := Some(Properties.envOrElse("GPG_PASSWORD","").toArray)
ThisBuild / publishTo := {
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/")
}
ThisBuild / packageBin / mappings := Seq(
file("LICENSE") -> "LICENSE",
file("NOTICE") -> "NOTICE"
)
ThisBuild / licenses := Seq("Apache 2" -> url("https://www.apache.org/licenses/LICENSE-2.0.txt"))
ThisBuild / pomExtra := {
<parent>
<groupId>org.apache</groupId>
<artifactId>apache</artifactId>
<version>23</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://gitbox.apache.org/repos/asf/incubator-toree.git
</developerConnection>
<tag>HEAD</tag>
</scm>
}
ThisBuild / credentials += Credentials(Path.userHome / ".ivy2" / ".credentials")
// Project structure
/** Root Toree project. */
lazy val root = (project in file("."))
.settings(name := "toree", crossScalaVersions := Nil)
.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)
(ScalaUnidoc / unidoc / scalacOptions) ++= Seq(
"-Ymacro-expand:none",
"-skip-packages", Seq(
"org.apache.pekko",
"scala"
).mkString(":"),
"-no-link-warnings" // Suppresses problems with Scaladoc @throws links
)
libraryDependencies ++= Dependencies.sparkAll.value
Compile / unmanagedResourceDirectories += { baseDirectory.value / "dist/toree-legal" }
assembly / assemblyShadeRules := Seq(
ShadeRule.rename("org.clapper.classutil.**" -> "shadeclapper.@0").inAll,
ShadeRule.rename("org.objectweb.asm.**" -> "shadeasm.@0").inAll
)
assembly / assemblyMergeStrategy := {
case "module-info.class" => MergeStrategy.discard
case x =>
val oldStrategy = (assembly / assemblyMergeStrategy).value
oldStrategy(x)
}
assembly / test := {}
assembly / assemblyOption := (assembly / assemblyOption).value.copy(includeScala = false)
assembly / aggregate := false