-
Notifications
You must be signed in to change notification settings - Fork 120
/
Copy pathbuild.sbt
76 lines (71 loc) · 2.79 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
import ReleaseTransformations._
def majorVersion(version: String) = version.split('.').slice(0, 2).mkString(".")
lazy val commonSettings = Seq(
organization := "databricks",
name := "spark-corenlp",
spName := "databricks/spark-corenlp",
licenses := Seq("GPL-3.0" -> url("http://opensource.org/licenses/GPL-3.0")),
// dependency settings //
scalaVersion := "2.11.8",
sparkVersion := "2.4.0",
version := (version in ThisBuild).value +
s"-spark${majorVersion(sparkVersion.value)}" +
s"-scala${majorVersion(scalaVersion.value)}",
initialize := {
val _ = initialize.value
// require Java 8+
val required = VersionNumber("1.8")
val current = VersionNumber(sys.props("java.specification.version"))
assert(VersionNumber.Strict.isCompatible(current, required), s"Java $required required.")
},
sparkComponents += "sql",
resolvers += Resolver.mavenLocal,
// test settings //
fork in Test := true,
javaOptions in Test ++= Seq("-Xmx6g"),
// release settings //
spAppendScalaVersion := false,
// We only use sbt-release to update version numbers for now.
releaseProcess := Seq[ReleaseStep](
inquireVersions,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
setNextVersion,
commitNextVersion
),
credentials += Credentials(Path.userHome / ".ivy2" / ".sbtcredentials")
)
lazy val nlpVersion = "3.9.1"
lazy val dependenciesToShade = Seq(
("edu.stanford.nlp" % "stanford-corenlp" % nlpVersion)
.exclude("joda-time", "joda-time") // provided by Spark
.exclude("org.apache.commons", "commons-lang3") // provided by Spark
.exclude("javax.servlet", "javax.servlet-api") // provided by Spark
.exclude("org.slf4j", "slf4j-api") // provided by Spark
)
lazy val testDependencies = Seq(
"edu.stanford.nlp" % "stanford-corenlp" % nlpVersion % "test" classifier "models",
"org.scalatest" %% "scalatest" % "3.0.1" % "test"
)
// the default subproject with shading
lazy val root = project.in(file(".")).settings(
commonSettings,
libraryDependencies ++= (dependenciesToShade ++ testDependencies),
assemblyOption in assembly := (assemblyOption in assembly).value.copy(includeScala = false),
assemblyShadeRules in assembly := Seq(
// We only shade protobuf-java here.
// Unfortunately, we cannot shade stanford-corenlp because it seems using reflection.
ShadeRule.rename("com.google.protobuf.**" -> "com.databricks.spark.corenlp.shaded.@0").inAll
),
test in assembly := {},
spDist := sys.error("Use 'sbt distribution/*' instead.")
)
// a subproject for release, where we use the assembly jar and declare no dependencies
lazy val distribution = project.settings(
commonSettings,
target := target.value / "distribution",
libraryDependencies ++= testDependencies,
spShade := true,
assembly in spPackage := (assembly in root).value
)