From fc0a2c8db8813d346f88fa43075bff19d875e59a Mon Sep 17 00:00:00 2001
From: Ismael Juma <ismael@juma.me.uk>
Date: Thu, 21 Jul 2011 01:04:29 +0100
Subject: [PATCH] Add and configure junit_xml_listener as a replacement for
 XmlTestReport.

---
 project/SparkBuild.scala                      | 26 +------------------
 .../plugins/project/SparkPluginBuild.scala    |  7 +++++
 2 files changed, 8 insertions(+), 25 deletions(-)
 create mode 100644 project/plugins/project/SparkPluginBuild.scala

diff --git a/project/SparkBuild.scala b/project/SparkBuild.scala
index 22279b7919..456c0da0db 100644
--- a/project/SparkBuild.scala
+++ b/project/SparkBuild.scala
@@ -21,6 +21,7 @@ object SparkBuild extends Build {
     unmanagedJars in Compile <<= baseDirectory map { base => (base ** "*.jar").classpath },
     retrieveManaged := true,
     transitiveClassifiers in Scope.GlobalScope := Seq("sources"),
+    testListeners <<= target.map(t => Seq(new eu.henkelmann.sbt.JUnitXmlTestsListener(t.getAbsolutePath))),
     libraryDependencies ++= Seq(
       "org.eclipse.jetty" % "jetty-server" % "7.4.2.v20110526",
       "org.scalatest" % "scalatest_2.9.0" % "1.6.1" % "test",
@@ -30,7 +31,6 @@ object SparkBuild extends Build {
 
   val slf4jVersion = "1.6.1"
 
-  //FIXME XmlTestReport
   def coreSettings = sharedSettings ++ Seq(libraryDependencies ++= Seq(
     "com.google.guava" % "guava" % "r09",
     "log4j" % "log4j" % "1.2.16",
@@ -41,35 +41,11 @@ object SparkBuild extends Build {
     "asm" % "asm-all" % "3.3.1"
   )) ++ DepJarPlugin.depJarSettings
 
-  //FIXME XmlTestReport
   def replSettings = sharedSettings ++
       Seq(libraryDependencies <+= scalaVersion("org.scala-lang" % "scala-compiler" % _)) ++
       DepJarPlugin.depJarSettings
 
   def examplesSettings = sharedSettings ++ Seq(libraryDependencies += "colt" % "colt" % "1.2.0")
 
-  //FIXME XmlTestReport
   def bagelSettings = sharedSettings ++ DepJarPlugin.depJarSettings
 }
-
-// Project mixin for an XML-based ScalaTest report. Unfortunately
-// there is currently no way to call this directly from SBT without
-// executing a subprocess.
-//trait XmlTestReport extends BasicScalaProject {
-//  def testReportDir = outputPath / "test-report"
-//
-//  lazy val testReport = task {
-//    log.info("Creating " + testReportDir + "...")
-//    if (!testReportDir.exists) {
-//      testReportDir.asFile.mkdirs()
-//    }
-//    log.info("Executing org.scalatest.tools.Runner...")
-//    val command = ("scala -classpath " + testClasspath.absString +
-//                   " org.scalatest.tools.Runner -o " +
-//                   " -u " + testReportDir.absolutePath +
-//                   " -p " + (outputPath / "test-classes").absolutePath)
-//    Process(command, path("."), "JAVA_OPTS" -> "-Xmx500m") !
-//
-//    None
-//  }.dependsOn(compile, testCompile).describedAs("Generate XML test report.")
-//}
diff --git a/project/plugins/project/SparkPluginBuild.scala b/project/plugins/project/SparkPluginBuild.scala
new file mode 100644
index 0000000000..999611982a
--- /dev/null
+++ b/project/plugins/project/SparkPluginBuild.scala
@@ -0,0 +1,7 @@
+import sbt._
+
+object SparkPluginDef extends Build {
+  lazy val root = Project("plugins", file(".")) dependsOn(junitXmlListener)
+  /* This is not published in a Maven repository, so we get it from GitHub directly */
+  lazy val junitXmlListener = uri("git://github.com/ijuma/junit_xml_listener.git#fe434773255b451a38e8d889536ebc260f4225ce")
+}
\ No newline at end of file
-- 
GitLab