From d2a1876faff39f75ee678dc0874bb0222a78c10b Mon Sep 17 00:00:00 2001 From: Saif Addin Date: Fri, 28 Jun 2019 13:51:53 -0300 Subject: [PATCH] Build updates --- .sbtrc | 4 ++-- build.sbt | 26 ++++++++++++++++++++++++-- python/run-tests.py | 1 - python/test/misc.py | 9 --------- 4 files changed, 26 insertions(+), 14 deletions(-) diff --git a/.sbtrc b/.sbtrc index bcb7d9e3074521..7fb3473271c82e 100644 --- a/.sbtrc +++ b/.sbtrc @@ -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 \ No newline at end of file diff --git a/build.sbt b/build.sbt index 5247fb25842d78..12e3270854762a 100644 --- a/build.sbt +++ b/build.sbt @@ -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) @@ -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 @@ -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 @@ -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 ") } diff --git a/python/run-tests.py b/python/run-tests.py index 57d4584a4856fe..99db3d6201119a 100644 --- a/python/run-tests.py +++ b/python/run-tests.py @@ -29,6 +29,5 @@ # Misc tests unittest.TextTestRunner().run(UtilitiesTestSpec()) -unittest.TextTestRunner().run(ConfigPathTestSpec()) unittest.TextTestRunner().run(SerializersTestSpec()) unittest.TextTestRunner().run(OcrTestSpec()) \ No newline at end of file diff --git a/python/test/misc.py b/python/test/misc.py index 92772739052fbc..dfd1d15f0a9308 100644 --- a/python/test/misc.py +++ b/python/test/misc.py @@ -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()