You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@predictionio.apache.org by do...@apache.org on 2017/03/16 14:52:20 UTC

[7/7] incubator-predictionio git commit: Fix SBT tests

Fix SBT tests


Project: http://git-wip-us.apache.org/repos/asf/incubator-predictionio/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-predictionio/commit/d051216a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-predictionio/tree/d051216a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-predictionio/diff/d051216a

Branch: refs/heads/feature/xbuild
Commit: d051216a7cea133ba24c470d7e2a03f07a1ae5cf
Parents: f928333
Author: Donald Szeto <do...@apache.org>
Authored: Thu Mar 16 07:51:53 2017 -0700
Committer: Donald Szeto <do...@apache.org>
Committed: Thu Mar 16 07:51:53 2017 -0700

----------------------------------------------------------------------
 build.sbt              | 47 +++++++++++++++++++--------------------------
 core/build.sbt         |  3 ++-
 storage/jdbc/build.sbt |  2 +-
 tools/build.sbt        |  1 +
 4 files changed, 24 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/d051216a/build.sbt
----------------------------------------------------------------------
diff --git a/build.sbt b/build.sbt
index 16ce10e..38b5f9e 100644
--- a/build.sbt
+++ b/build.sbt
@@ -18,7 +18,7 @@
 import PIOBuild._
 import UnidocKeys._
 
-lazy val scalaSparkDependenciesVersion = Map(
+lazy val scalaSparkDepsVersion = Map(
   "2.10" -> Map(
     "1.6" -> Map(
       "akka" -> "2.3.15",
@@ -69,17 +69,17 @@ sparkVersion in ThisBuild := sys.props.getOrElse("spark.version", "1.6.3")
 
 akkaVersion in ThisBuild := sys.props.getOrElse(
   "akka.version",
-  scalaSparkDependenciesVersion(versionPrefix(scalaVersion.value))(versionPrefix(sparkVersion.value))("akka"))
+  scalaSparkDepsVersion(versionPrefix(scalaVersion.value))(versionPrefix(sparkVersion.value))("akka"))
 
 lazy val es = sys.props.getOrElse("elasticsearch.version", "1.7.6")
 
 elasticsearchVersion in ThisBuild := es
 
-json4sVersion in ThisBuild := scalaSparkDependenciesVersion(versionPrefix(scalaVersion.value))(versionPrefix(sparkVersion.value))("json4s")
+json4sVersion in ThisBuild := scalaSparkDepsVersion(versionPrefix(scalaVersion.value))(versionPrefix(sparkVersion.value))("json4s")
 
 hadoopVersion in ThisBuild := sys.props.getOrElse(
   "hadoop.version",
-  scalaSparkDependenciesVersion(versionPrefix(scalaVersion.value))(versionPrefix(sparkVersion.value))("hadoop"))
+  scalaSparkDepsVersion(versionPrefix(scalaVersion.value))(versionPrefix(sparkVersion.value))("hadoop"))
 
 val pioBuildInfoSettings = buildInfoSettings ++ Seq(
   sourceGenerators in Compile <+= buildInfo,
@@ -97,33 +97,12 @@ val genjavadocSettings: Seq[sbt.Def.Setting[_]] = Seq(
   libraryDependencies += compilerPlugin("com.typesafe.genjavadoc" %% "genjavadoc-plugin" % "0.10" cross CrossVersion.full),
     scalacOptions <+= target map (t => "-P:genjavadoc:out=" + (t / "java")))
 
-// Paths specified below are required for the tests, since thread pools initialized
-// in unit tests of data subproject are used later in spark jobs executed in core.
-// They need to have properly configured classloaders to load core classes for spark
-// in subsequent tests.
-def coreClasses(baseDirectory: java.io.File, scalaVersion: String): Seq[File] = Seq(
-  baseDirectory / s"../core/target/scala-${versionPrefix(scalaVersion)}/classes",
-  baseDirectory / s"../core/target/scala-${versionPrefix(scalaVersion)}/test-classes")
-
 val conf = file("conf")
 
 val commonSettings = Seq(
   autoAPIMappings := true,
   unmanagedClasspath in Test += conf)
 
-val common = (project in file("common")).
-  settings(commonSettings: _*).
-  settings(genjavadocSettings: _*).
-  disablePlugins(sbtassembly.AssemblyPlugin)
-
-val data = (project in file("data")).
-  dependsOn(common).
-  settings(commonSettings: _*).
-  settings(genjavadocSettings: _*).
-  settings(unmanagedSourceDirectories in Compile +=
-    sourceDirectory.value / s"main/spark-${versionMajor(sparkVersion.value)}").
-  disablePlugins(sbtassembly.AssemblyPlugin)
-
 val dataElasticsearch1 = (project in file("storage/elasticsearch1")).
   settings(commonSettings: _*).
   settings(genjavadocSettings: _*).
@@ -154,8 +133,23 @@ val dataLocalfs = (project in file("storage/localfs")).
   settings(genjavadocSettings: _*).
   settings(publishArtifact := false)
 
+val common = (project in file("common")).
+  settings(commonSettings: _*).
+  settings(genjavadocSettings: _*).
+  disablePlugins(sbtassembly.AssemblyPlugin)
+
+val data = (project in file("data")).
+  dependsOn(common).
+  dependsOn(dataJdbc % "test->compile").
+  settings(commonSettings: _*).
+  settings(genjavadocSettings: _*).
+  settings(unmanagedSourceDirectories in Compile +=
+    sourceDirectory.value / s"main/spark-${versionMajor(sparkVersion.value)}").
+  disablePlugins(sbtassembly.AssemblyPlugin)
+
 val core = (project in file("core")).
   dependsOn(data).
+  dependsOn(dataJdbc % "test->compile").
   settings(commonSettings: _*).
   settings(genjavadocSettings: _*).
   settings(pioBuildInfoSettings: _*).
@@ -165,16 +159,15 @@ val core = (project in file("core")).
 val tools = (project in file("tools")).
   dependsOn(core).
   dependsOn(data).
+  dependsOn(dataJdbc % "test->compile").
   settings(commonSettings: _*).
   settings(genjavadocSettings: _*).
   enablePlugins(SbtTwirl).
-  settings(fullClasspath in Test ++= coreClasses(baseDirectory.value, scalaVersion.value)).
   settings(publishArtifact := false)
 
 val e2 = (project in file("e2")).
   settings(commonSettings: _*).
   settings(genjavadocSettings: _*).
-  settings(fullClasspath in Test ++= coreClasses(baseDirectory.value, scalaVersion.value)).
   disablePlugins(sbtassembly.AssemblyPlugin)
 
 val dataEs = if (versionMajor(es) == 1) dataElasticsearch1 else dataElasticsearch

http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/d051216a/core/build.sbt
----------------------------------------------------------------------
diff --git a/core/build.sbt b/core/build.sbt
index 2d2a381..c6bac3f 100644
--- a/core/build.sbt
+++ b/core/build.sbt
@@ -37,8 +37,9 @@ libraryDependencies ++= Seq(
   "org.json4s"             %% "json4s-native"    % json4sVersion.value,
   "org.json4s"             %% "json4s-ext"       % json4sVersion.value,
   "org.scalaj"             %% "scalaj-http"      % "1.1.6",
-  "org.scalatest"          %% "scalatest"        % "2.1.7" % "test",
   "org.slf4j"               % "slf4j-log4j12"    % "1.7.18",
+  "org.postgresql"          % "postgresql"       % "9.4-1204-jdbc41" % "test",
+  "org.scalatest"          %% "scalatest"        % "2.1.7" % "test",
   "org.specs2"             %% "specs2"           % "2.3.13" % "test")
 
 parallelExecution in Test := false

http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/d051216a/storage/jdbc/build.sbt
----------------------------------------------------------------------
diff --git a/storage/jdbc/build.sbt b/storage/jdbc/build.sbt
index 905ed53..b0ff2fd 100644
--- a/storage/jdbc/build.sbt
+++ b/storage/jdbc/build.sbt
@@ -23,8 +23,8 @@ libraryDependencies ++= Seq(
   "org.apache.predictionio" %% "apache-predictionio-core" % version.value % "provided",
   "org.apache.predictionio" %% "apache-predictionio-data" % version.value % "provided",
   "org.apache.spark"        %% "spark-sql"      % sparkVersion.value % "provided",
-  "org.postgresql"           % "postgresql"     % "9.4-1204-jdbc41",
   "org.scalikejdbc"         %% "scalikejdbc"    % "2.3.5",
+  "org.postgresql"           % "postgresql"     % "9.4-1204-jdbc41" % "test",
   "org.scalatest"           %% "scalatest"      % "2.1.7" % "test",
   "org.specs2"              %% "specs2"         % "2.3.13" % "test")
 

http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/d051216a/tools/build.sbt
----------------------------------------------------------------------
diff --git a/tools/build.sbt b/tools/build.sbt
index 0971b62..b61a20a 100644
--- a/tools/build.sbt
+++ b/tools/build.sbt
@@ -36,6 +36,7 @@ libraryDependencies ++= Seq(
   "com.typesafe.akka"      %% "akka-actor"     % akkaVersion.value,
   "com.typesafe.akka"      %% "akka-slf4j"     % akkaVersion.value,
   "io.spray"               %% "spray-testkit"  % "1.3.3" % "test",
+  "org.postgresql"          % "postgresql"     % "9.4-1204-jdbc41" % "test",
   "org.specs2"             %% "specs2"         % "2.3.13" % "test")
 
 dependencyOverrides +=   "org.slf4j" % "slf4j-log4j12" % "1.7.18"