Brought in some reorganization of build file from Hive branch
This commit is contained in:
parent
e8df4bbd40
commit
d3df963a13
|
@ -15,58 +15,62 @@ extends ParentProject(info) with IdeaProject
|
||||||
project("examples", "Spark Examples", new ExamplesProject(_), core)
|
project("examples", "Spark Examples", new ExamplesProject(_), core)
|
||||||
|
|
||||||
class CoreProject(info: ProjectInfo)
|
class CoreProject(info: ProjectInfo)
|
||||||
extends DefaultProject(info) with Eclipsify with IdeaProject with AssemblyBuilder
|
extends DefaultProject(info) with Eclipsify with IdeaProject with DepJar with XmlTestReport
|
||||||
{
|
{}
|
||||||
|
|
||||||
|
class ExamplesProject(info: ProjectInfo)
|
||||||
|
extends DefaultProject(info) with Eclipsify with IdeaProject
|
||||||
|
{}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 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"
|
def testReportDir = outputPath / "test-report"
|
||||||
|
|
||||||
// Create an XML test report using ScalaTest's -u option. Unfortunately
|
|
||||||
// there is currently no way to call this directly from SBT without
|
|
||||||
// executing a subprocess.
|
|
||||||
lazy val testReport = task {
|
lazy val testReport = task {
|
||||||
log.info("Creating " + testReportDir + "...")
|
log.info("Creating " + testReportDir + "...")
|
||||||
if (!testReportDir.exists) {
|
if (!testReportDir.exists) {
|
||||||
testReportDir.asFile.mkdirs()
|
testReportDir.asFile.mkdirs()
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("Executing org.scalatest.tools.Runner...")
|
log.info("Executing org.scalatest.tools.Runner...")
|
||||||
val command = ("scala -classpath " + testClasspath.absString +
|
val command = ("scala -classpath " + testClasspath.absString +
|
||||||
" org.scalatest.tools.Runner -o " +
|
" org.scalatest.tools.Runner -o " +
|
||||||
" -u " + testReportDir.absolutePath +
|
" -u " + testReportDir.absolutePath +
|
||||||
" -p " + (outputPath / "test-classes").absolutePath)
|
" -p " + (outputPath / "test-classes").absolutePath)
|
||||||
val process = Process(command, path("."), "JAVA_OPTS" -> "-Xmx500m")
|
Process(command, path("."), "JAVA_OPTS" -> "-Xmx500m") !
|
||||||
process !
|
|
||||||
|
|
||||||
None
|
None
|
||||||
}.dependsOn(compile, testCompile).describedAs("Generate XML test report.")
|
}.dependsOn(compile, testCompile).describedAs("Generate XML test report.")
|
||||||
|
}
|
||||||
|
|
||||||
def singleJarExclude(base: PathFinder) = {
|
|
||||||
(base / "scala" ** "*") +++ ( // exclude scala library
|
// Project mixin for creating a JAR with a project's dependencies. This is based
|
||||||
(base / "META-INF" ** "*") --- // generally ignore the hell out of META-INF
|
// on the AssemblyBuilder plugin, but because this plugin attempts to package Scala
|
||||||
|
// and our project too, we leave that out using our own exclude filter (depJarExclude).
|
||||||
|
trait DepJar extends AssemblyBuilder {
|
||||||
|
def depJarExclude(base: PathFinder) = {
|
||||||
|
(base / "scala" ** "*") +++ // exclude scala library
|
||||||
|
(base / "spark" ** "*") +++ // exclude Spark classes
|
||||||
|
((base / "META-INF" ** "*") --- // generally ignore the hell out of META-INF
|
||||||
(base / "META-INF" / "services" ** "*") --- // include all service providers
|
(base / "META-INF" / "services" ** "*") --- // include all service providers
|
||||||
(base / "META-INF" / "maven" ** "*")) // include all Maven POMs and such
|
(base / "META-INF" / "maven" ** "*")) // include all Maven POMs and such
|
||||||
}
|
}
|
||||||
|
|
||||||
def singleJarTempDir = outputPath / "single-jar-classes"
|
def depJarTempDir = outputPath / "dep-classes"
|
||||||
|
|
||||||
def singleJarOutputPath =
|
def depJarOutputPath =
|
||||||
outputPath / (name.toLowerCase.replace(" ", "-") + "-single-jar-" + version.toString + ".jar")
|
outputPath / (name.toLowerCase.replace(" ", "-") + "-dep-" + version.toString + ".jar")
|
||||||
|
|
||||||
// Create a JAR with Spark Core and all its dependencies. We use some methods in
|
lazy val depJar = {
|
||||||
// the AssemblyBuilder plugin, but because this plugin attempts to package Scala
|
|
||||||
// too, we leave that out using our own exclude filter (singleJarExclude).
|
|
||||||
lazy val singleJar = {
|
|
||||||
packageTask(
|
packageTask(
|
||||||
Path.lazyPathFinder(assemblyPaths(singleJarTempDir,
|
Path.lazyPathFinder(assemblyPaths(depJarTempDir,
|
||||||
assemblyClasspath,
|
assemblyClasspath,
|
||||||
assemblyExtraJars,
|
assemblyExtraJars,
|
||||||
singleJarExclude)),
|
depJarExclude)),
|
||||||
singleJarOutputPath,
|
depJarOutputPath,
|
||||||
packageOptions)
|
packageOptions)
|
||||||
}.dependsOn(compile).describedAs("Build a single JAR with project and its dependencies")
|
}.dependsOn(compile).describedAs("Bundle project's dependencies into a JAR.")
|
||||||
}
|
|
||||||
|
|
||||||
class ExamplesProject(info: ProjectInfo)
|
|
||||||
extends DefaultProject(info) with Eclipsify with IdeaProject
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue