forked from twosigma/flint
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sbt
125 lines (115 loc) · 4.58 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
/*
* Copyright 2017-2018 TWO SIGMA OPEN SOURCE, LLC
*
* Licensed 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 de.heikoseeberger.sbtheader.HeaderPattern
import com.typesafe.sbt.SbtScalariform.ScalariformKeys
import scalariform.formatter.preferences._
import com.typesafe.sbt.SbtScalariform
import BuildUtil._
lazy val formattingPreferences = {
import scalariform.formatter.preferences._
FormattingPreferences().
setPreference(AlignParameters, false).
setPreference(PreserveSpaceBeforeArguments, true).
setPreference(SpacesAroundMultiImports, true)
}
lazy val compilationSettings = scalariformSettings ++ Seq(
version := "0.6.0-SNAPSHOT",
organization := "com.twosigma",
scalaVersion := "2.11.8",
assemblyOption in assembly := (assemblyOption in assembly).value.copy(includeScala = false),
javacOptions ++= Seq("-source", "1.7", "-target", "1.7"),
compileOrder in Compile := CompileOrder.JavaThenScala,
scalacOptions ++= Seq(
"-deprecation",
"-encoding", "UTF-8",
"-feature",
"-language:existentials",
"-language:higherKinds",
"-language:implicitConversions",
"-unchecked",
"-Ywarn-dead-code",
"-Ywarn-numeric-widen"
),
resolvers ++= Seq(
"Local Maven Repository" at "file://" + Path.userHome.absolutePath + "/.m2/repository",
"Typesafe Repo" at "http://repo.typesafe.com/typesafe/releases/"
),
ScalariformKeys.preferences := formattingPreferences
)
lazy val versions = new {
val play_json = "2.5.0"
val commons_math = "3.5"
val joda_time = "2.9.4"
val httpclient = "4.3.2" // Note that newer versions need to be configured
val spark = sys.props.getOrElse("spark.version", default = "2.3.0")
val scalatest = "2.2.4"
val scalacheck = "1.12.6"
val grizzled_slf4j = "1.3.0"
val arrow = "0.8.0"
val jackson_module = "2.7.2"
}
lazy val lazyDependencies = new {
val sparkCore = "org.apache.spark" %% "spark-core" % versions.spark % "provided"
val sparkML = "org.apache.spark" %% "spark-mllib" % versions.spark % "provided"
val sparkSQL = "org.apache.spark" %% "spark-sql" % versions.spark % "provided"
}
lazy val dependencySettings = libraryDependencies ++= Seq(
"com.typesafe.play" %% "play-json" % versions.play_json % "test",
"org.apache.commons" % "commons-math3" % versions.commons_math,
"joda-time" % "joda-time" % versions.joda_time,
"org.apache.httpcomponents" % "httpclient" % versions.httpclient,
"org.clapper" %% "grizzled-slf4j" % versions.grizzled_slf4j,
lazyDependencies.sparkCore,
lazyDependencies.sparkML,
lazyDependencies.sparkSQL,
"org.scalatest" %% "scalatest" % versions.scalatest % "test",
"org.scalacheck" %% "scalacheck" % versions.scalacheck % "test",
// These jackson modules are not directly used by Flint. We need to put it
// there because Spark 2.3 uses Jackson 2.6 and Arrow uses Jackson
// 2.7. We should be able to remove these once we moved to newer Spark
// version.
"com.fasterxml.jackson.module" % "jackson-module-parameter-names" % versions.jackson_module,
"com.fasterxml.jackson.module" %% "jackson-module-scala" % versions.jackson_module
)
lazy val flint = project
.in(file("."))
.enablePlugins(AutomateHeaderPlugin)
.settings(compilationSettings)
.settings(dependencySettings)
.settings(parallelExecution in Test := false)
.settings(testOptions in Test += Tests.Argument("-oDF"))
.settings(apiMappings ++= DocumentationMapping.mapJarToDocURL(
(managedClasspath in (Compile, doc)).value,
Seq(
DocumentationMapping(url(s"http://spark.apache.org/docs/${versions.spark}/api/scala/"),
lazyDependencies.sparkCore, lazyDependencies.sparkML, lazyDependencies.sparkSQL
)
)
))
mergeStrategy in assembly <<= (mergeStrategy in assembly) { (old) =>
{
case m if m.startsWith("META-INF/services") => MergeStrategy.filterDistinctLines
case m if m.startsWith("META-INF") => MergeStrategy.discard
case m if m.startsWith("git.properties") => MergeStrategy.discard
case _ => MergeStrategy.deduplicate
}
}
addCommandAlias(
"assemblyNoTest",
"; set test in Test := {}; assembly"
)
publishTo := sonatypePublishTo.value
crossPaths := false