diff options
author | Matei Zaharia <matei@eecs.berkeley.edu> | 2010-11-14 00:46:19 -0800 |
---|---|---|
committer | Matei Zaharia <matei@eecs.berkeley.edu> | 2010-11-14 00:46:19 -0800 |
commit | dcfa2ce83bf884008b4e8c02e923da1e49027ba4 (patch) | |
tree | d754f8ce8a094f703d243004ef15ad724c28b3f7 /project/build/SparkProject.scala | |
parent | e86b620f9e6d406352140bbb1b931d8bfbafcaf5 (diff) | |
download | spark-dcfa2ce83bf884008b4e8c02e923da1e49027ba4.tar.gz spark-dcfa2ce83bf884008b4e8c02e923da1e49027ba4.tar.bz2 spark-dcfa2ce83bf884008b4e8c02e923da1e49027ba4.zip |
Further improvements -- build native stuff in target directory and add a
test-report target for XML test reports
Diffstat (limited to 'project/build/SparkProject.scala')
-rw-r--r-- | project/build/SparkProject.scala | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/project/build/SparkProject.scala b/project/build/SparkProject.scala index 35838cb35b..7ba03f6125 100644 --- a/project/build/SparkProject.scala +++ b/project/build/SparkProject.scala @@ -1,6 +1,46 @@ import sbt._ import de.element34.sbteclipsify._ +import Process._ + class SparkProject(info: ProjectInfo) -extends DefaultProject(info) with Eclipsify { +extends DefaultProject(info) with Eclipsify +{ + val TARGET = path("target") / "scala_2.8.1" + + val NATIVE_DIR = path("src") / "main" / "native" + + val NATIVE_SOURCES = NATIVE_DIR * "*.c" + + val NATIVE_LIB = { + if (System.getProperty("os.name") == "Mac OS X") + "libspark_native.dylib" + else + "libspark_native.so" + } + + lazy val native = fileTask(TARGET / NATIVE_LIB from NATIVE_SOURCES) { + val makeTarget = " ../../../target/scala_2.8.1/native/" + NATIVE_LIB + (("make -C " + NATIVE_DIR + " " + makeTarget) ! log) + None + } dependsOn(compile) describedAs("Compiles native library.") + + val TEST_REPORT_DIR = TARGET / "test-report" + + lazy val testReport = task { + log.info("Creating " + TEST_REPORT_DIR + "...") + if (!TEST_REPORT_DIR.exists) { + TEST_REPORT_DIR.asFile.mkdirs() + } + + log.info("Executing org.scalatest.tools.Runner...") + val command = ("scala -classpath " + testClasspath.absString + + " org.scalatest.tools.Runner -o " + + " -u " + TEST_REPORT_DIR.absolutePath + + " -p " + (TARGET / "test-classes").absolutePath) + val process = Process(command, path("."), "JAVA_OPTS" -> "-Xmx500m") + process ! + + None + } dependsOn(compile, testCompile) describedAs("Generate XML test report.") } |