Skip to content

Commit

Permalink
Build updates
Browse files Browse the repository at this point in the history
  • Loading branch information
saif-ellafi committed Jun 28, 2019
1 parent d837e84 commit d2a1876
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .sbtrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
alias assemblyAndCopy=;assembly;copyAssembledJar
alias assemblyOcrAndCopy=;ocr/assembly;copyAssembledOcrJar
alias assemblyEvalAndCopy=;evaluation/assembly;copyAssembledEvalJar
alias assemblyAllAndCopy=;assemblyAndCopy;assemblyOcrAndCopy;assemblyEvalAndCopy;copyAssembledEvalJar
alias assemblyAllAndCopy=;assemblyEvalAndCopy;assemblyOcrAndCopy
alias assemblyAndCopyForPyPi=;assembly;copyAssembledJarForPyPi
alias publishSignedOcr=;ocr/assembly;ocr/publishSigned
alias publishSignedOcr=;ocr/assembly;ocr/publishSigned
26 changes: 24 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ lazy val root = (project in file("."))


val ocrMergeRules: String => MergeStrategy = {

case "versionchanges.txt" => MergeStrategy.discard
case "StaticLoggerBinder" => MergeStrategy.discard
case PathList("META-INF", fileName)
Expand All @@ -169,6 +168,19 @@ val ocrMergeRules: String => MergeStrategy = {
case _ => MergeStrategy.deduplicate
}

val evalMergeRules: String => MergeStrategy = {
case "versionchanges.txt" => MergeStrategy.discard
case "StaticLoggerBinder" => MergeStrategy.discard
case PathList("META-INF", fileName)
if List("NOTICE", "MANIFEST.MF", "DEPENDENCIES", "INDEX.LIST").contains(fileName) || fileName.endsWith(".txt")
=> MergeStrategy.discard
case PathList("META-INF", "services", _ @ _*) => MergeStrategy.first
case PathList("META-INF", xs @ _*) => MergeStrategy.first
case PathList("org", "apache", "spark", _ @ _*) => MergeStrategy.discard
case PathList("apache", "commons", "logging", "impl", xs @ _*) => MergeStrategy.discard
case _ => MergeStrategy.deduplicate
}

assemblyMergeStrategy in assembly := {
case PathList("apache.commons.lang3", _ @ _*) => MergeStrategy.discard
case PathList("org.apache.hadoop", _ @ _*) => MergeStrategy.last
Expand All @@ -187,6 +199,15 @@ lazy val evaluation = (project in file("eval"))
name := "spark-nlp-eval",
version := "2.1.0",

assemblyMergeStrategy in assembly := evalMergeRules,

libraryDependencies ++= Seq(
"org.apache.spark" %% "spark-core" % sparkVer,
"org.apache.spark" %% "spark-mllib" % sparkVer
),

test in assembly := {},

publishTo := Some(
if (isSnapshot.value)
Opts.resolver.sonatypeSnapshots
Expand Down Expand Up @@ -292,9 +313,10 @@ copyAssembledOcrJar := {
println(s"[info] $jarFilePath copied to $newJarFilePath ")
}

// Includes spark-nlp, so use sparknlp.jar
copyAssembledEvalJar := {
val jarFilePath = (assemblyOutputPath in assembly in "evaluation").value
val newJarFilePath = baseDirectory( _ / "python" / "lib" / "sparknlp-eval.jar").value
val newJarFilePath = baseDirectory( _ / "python" / "lib" / "sparknlp.jar").value
IO.copyFile(jarFilePath, newJarFilePath)
println(s"[info] $jarFilePath copied to $newJarFilePath ")
}
Expand Down
1 change: 0 additions & 1 deletion python/run-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,5 @@

# Misc tests
unittest.TextTestRunner().run(UtilitiesTestSpec())
unittest.TextTestRunner().run(ConfigPathTestSpec())
unittest.TextTestRunner().run(SerializersTestSpec())
unittest.TextTestRunner().run(OcrTestSpec())
9 changes: 0 additions & 9 deletions python/test/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,6 @@ def runTest():
assert(regex_rule.rule() == "\w+")


class ConfigPathTestSpec(unittest.TestCase):

@staticmethod
def runTest():
assert(get_config_path() == "./application.conf")
set_config_path("./somewhere/application.conf")
assert(get_config_path() == "./somewhere/application.conf")


class SerializersTestSpec(unittest.TestCase):
def setUp(self):
self.test_dir = tempfile.mkdtemp()
Expand Down

0 comments on commit d2a1876

Please sign in to comment.