forked from JohnSnowLabs/spark-nlp
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sbt
244 lines (194 loc) · 8.26 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
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
import sbtassembly.MergeStrategy
val is_gpu = System.getProperty("is_gpu","false")
val is_spark23 = System.getProperty("is_spark23","false")
val spark23Ver = "2.3.4"
val spark24Ver = "2.4.7"
val sparkVer = if(is_spark23=="false") spark24Ver else spark23Ver
val scalaVer = "2.11.12"
val scalaTestVersion = "3.0.0"
/** Package attributes */
if (is_gpu.equals("true") && is_spark23.equals("true")){
name:="spark-nlp-gpu-spark23"
}else if (is_gpu.equals("true") && is_spark23.equals("false")){
name:="spark-nlp-gpu"
}else if (is_gpu.equals("false") && is_spark23.equals("true")){
name:="spark-nlp-spark23"
}else{
name:="spark-nlp"
}
organization:= "com.johnsnowlabs.nlp"
version := "2.7.4"
scalaVersion in ThisBuild := scalaVer
sparkVersion in ThisBuild := sparkVer
/** Spark-Package attributes */
spName in ThisBuild := "JohnSnowLabs/spark-nlp"
sparkComponents in ThisBuild ++= Seq("mllib")
licenses += "Apache-2.0" -> url("http://opensource.org/licenses/Apache-2.0")
spIncludeMaven in ThisBuild:= false
spAppendScalaVersion := false
resolvers in ThisBuild += "Maven Central" at "https://central.maven.org/maven2/"
resolvers in ThisBuild += "Spring Plugins" at "http://repo.spring.io/plugins-release/"
assemblyShadeRules in assembly := Seq(
ShadeRule.rename("org.apache.http.**" -> "org.apache.httpShaded@1").inAll
)
assemblyOption in assembly := (assemblyOption in assembly).value.copy(
includeScala = false
)
credentials += Credentials(Path.userHome / ".ivy2" / ".sbtcredentials")
ivyScala := ivyScala.value map {
_.copy(overrideScalaVersion = true)
}
/** Bintray settings */
bintrayPackageLabels := Seq("nlp", "nlu",
"natural-language-processing", "natural-language-understanding",
"spark", "spark-ml", "pyspark", "machine-learning",
"named-entity-recognition", "sentiment-analysis", "lemmatizer", "spell-checker",
"tokenizer", "stemmer", "part-of-speech-tagger", "annotation-framework")
bintrayRepository := "spark-nlp"
bintrayOrganization:= Some("johnsnowlabs")
sonatypeProfileName := "com.johnsnowlabs"
publishTo := Some(
if (isSnapshot.value)
Opts.resolver.sonatypeSnapshots
else
Opts.resolver.sonatypeStaging
)
homepage:= Some(url("https://nlp.johnsnowlabs.com"))
scmInfo:= Some(
ScmInfo(
url("https://github.com/JohnSnowLabs/spark-nlp"),
"scm:[email protected]:JohnSnowLabs/spark-nlp.git"
)
)
developers in ThisBuild:= List(
Developer(id="saifjsl", name="Saif Addin", email="[email protected]", url=url("https://github.com/saifjsl")),
Developer(id="maziyarpanahi", name="Maziyar Panahi", email="[email protected]", url=url("https://github.com/maziyarpanahi")),
Developer(id="albertoandreottiATgmail", name="Alberto Andreotti", email="[email protected]", url=url("https://github.com/albertoandreottiATgmail")),
Developer(id="danilojsl", name="Danilo Burbano", email="[email protected]", url=url("https://github.com/danilojsl")),
Developer(id="rohit13k", name="Rohit Kumar", email="[email protected]", url=url("https://github.com/rohit13k")),
Developer(id="aleksei-ai", name="Aleksei Alekseev", email="[email protected]", url=url("https://github.com/aleksei-ai")),
Developer(id="showy", name="Eduardo Muñoz", email="[email protected]", url=url("https://github.com/showy")),
Developer(id="C-K-Loan", name="Christian Kasim Loan", email="[email protected]", url=url("https://github.com/C-K-Loan")),
Developer(id="wolliq", name="Stefano Lori", email="[email protected]", url=url("https://github.com/wolliq")),
Developer(id="vankov", name="Ivan Vankov", email="[email protected]", url=url("https://github.com/vankov"))
)
scalacOptions in (Compile, doc) ++= Seq(
"-doc-title",
"Spark NLP " + version.value + " ScalaDoc"
)
target in Compile in doc := baseDirectory.value / "docs/api"
lazy val analyticsDependencies =
if(is_spark23=="false"){
Seq(
"org.apache.spark" %% "spark-core" % sparkVer % "provided",
"org.apache.spark" %% "spark-mllib" % sparkVer % "provided"
)
}else{
Seq(
"org.apache.spark" %% "spark-core" % spark23Ver % "provided",
"org.apache.spark" %% "spark-mllib" % spark23Ver % "provided"
)
}
lazy val testDependencies = Seq(
"org.scalatest" %% "scalatest" % scalaTestVersion % "test"
)
lazy val utilDependencies = Seq(
"com.typesafe" % "config" % "1.3.0",
"org.rocksdb" % "rocksdbjni" % "6.5.3",
"org.apache.hadoop" % "hadoop-aws" % "2.7.3"
exclude("com.fasterxml.jackson.core", "jackson-annotations")
exclude("com.fasterxml.jackson.core", "jackson-databind")
exclude("com.fasterxml.jackson.core", "jackson-core")
exclude("commons-configuration","commons-configuration")
exclude("com.amazonaws","aws-java-sdk-bundle")
exclude("com.amazonaws","aws-java-sdk")
exclude("org.apache.hadoop" ,"hadoop-common"),
"com.amazonaws" % "aws-java-sdk" % "1.7.4"
exclude("com.fasterxml.jackson.core", "jackson-annotations")
exclude("com.fasterxml.jackson.core", "jackson-databind")
exclude("com.fasterxml.jackson.core", "jackson-core")
exclude("commons-configuration","commons-configuration"),
"com.github.universal-automata" % "liblevenshtein" % "3.0.0"
exclude("com.google.guava", "guava")
exclude("org.apache.commons", "commons-lang3"),
"com.navigamez" % "greex" % "1.0",
"org.json4s" %% "json4s-ext" % "3.5.3"
)
lazy val typedDependencyParserDependencies = Seq(
"net.sf.trove4j" % "trove4j" % "3.0.3",
"junit" % "junit" % "4.10" % Test
)
val tensorflowDependencies: Seq[sbt.ModuleID] =
if (is_gpu.equals("true"))
Seq(
"org.tensorflow" % "libtensorflow" % "1.15.0",
"org.tensorflow" % "libtensorflow_jni_gpu" % "1.15.0"
)
else
Seq(
"org.tensorflow" % "tensorflow" % "1.15.0"
)
lazy val root = (project in file("."))
.settings(
libraryDependencies ++=
analyticsDependencies ++
testDependencies ++
utilDependencies ++
tensorflowDependencies++
typedDependencyParserDependencies
)
assemblyMergeStrategy in assembly := {
case PathList("apache.commons.lang3", _ @ _*) => MergeStrategy.discard
case PathList("org.apache.hadoop", xs @ _*) => MergeStrategy.first
case PathList("com.amazonaws", xs @ _*) => MergeStrategy.last
case PathList("com.fasterxml.jackson") => MergeStrategy.first
case PathList("META-INF", "io.netty.versions.properties") => MergeStrategy.first
case PathList("org", "tensorflow", _ @ _*) => MergeStrategy.first
case x =>
val oldStrategy = (assemblyMergeStrategy in assembly).value
oldStrategy(x)
}
/** Test tagging start */
// Command line fast:test
lazy val FastTest = config("fast") extend Test
// Command line slow:test
lazy val SlowTest = config("slow") extend Test
configs(FastTest, SlowTest)
parallelExecution in Test := false
logBuffered in Test := false
testOptions in Test := Seq(Tests.Argument("-l", "com.johnsnowlabs.tags.SlowTest")) // exclude
inConfig(FastTest)(Defaults.testTasks)
testOptions in FastTest := Seq(Tests.Argument("-l", "com.johnsnowlabs.tags.SlowTest")) // exclude
parallelExecution in FastTest := false
inConfig(SlowTest)(Defaults.testTasks)
testOptions in SlowTest := Seq(Tests.Argument("-n", "com.johnsnowlabs.tags.SlowTest")) // include
parallelExecution in SlowTest := false
/** Test tagging end */
scalacOptions ++= Seq(
"-feature",
"-language:implicitConversions"
)
scalacOptions in(Compile, doc) ++= Seq(
"-groups"
)
/** Enable for debugging */
testOptions in Test += Tests.Argument("-oF")
/** Disables tests in assembly */
test in assembly := {}
/** Publish test artificat **/
publishArtifact in Test := true
/** Copies the assembled jar to the pyspark/lib dir **/
lazy val copyAssembledJar = taskKey[Unit]("Copy assembled jar to pyspark/lib")
lazy val copyAssembledJarForPyPi = taskKey[Unit]("Copy assembled jar to pyspark/sparknlp/lib")
copyAssembledJar := {
val jarFilePath = (assemblyOutputPath in assembly).value
val newJarFilePath = baseDirectory( _ / "python" / "lib" / "sparknlp.jar").value
IO.copyFile(jarFilePath, newJarFilePath)
println(s"[info] $jarFilePath copied to $newJarFilePath ")
}
copyAssembledJarForPyPi := {
val jarFilePath = (assemblyOutputPath in assembly).value
val newJarFilePath = baseDirectory( _ / "python" / "sparknlp" / "lib" / "sparknlp.jar").value
IO.copyFile(jarFilePath, newJarFilePath)
println(s"[info] $jarFilePath copied to $newJarFilePath ")
}