-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathbuild.sbt
71 lines (58 loc) · 2.68 KB
/
build.sbt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import com.typesafe.sbt.packager.MappingsHelper._
name := "wasp"
scalaVersion := "2.10.6"
// populate spark-lib
libraryDependencies ++= Dependencies.sparkLibJava ++ Dependencies.sparkLibScala
// define task
lazy val populateSparkLib = taskKey[Seq[File]]("Populates the spark-lib directory")
populateSparkLib := {
val log = streams.value.log
val sparkLibPath = "spark-lib/managed/"
log.info("Populating spark-lib directory: \"" + sparkLibPath + "\".")
log.info("Cleaning spark-lib... ")
IO.delete(new File(sparkLibPath))
log.info("Done cleaning.")
log.info("Adding dependency jars to spark-lib...")
val sparkLibModules = Dependencies.sparkLibJava.map(m => (m.organization, m.name)).toSet ++
Dependencies.sparkLibScala.map(m => (m.organization, m.name + "_2.10")).toSet // TODO fix hardcoded scala version
val dummyModuleID = new ModuleID("", "", "", None)
val sparkLibDependencies = (dependencyClasspath in Compile).value.filter {
dep =>
val m = dep.metadata.get(AttributeKey[ModuleID]("module-id")).getOrElse(dummyModuleID)
sparkLibModules((m.organization, m.name))
}
val sparkLibJarFiles = sparkLibDependencies.map {
dep => dep.data.getAbsoluteFile
}
log.info("Adding: " + sparkLibJarFiles.mkString(","))
IO.copy(sparkLibJarFiles.map(jar => (jar, new File(sparkLibPath + jar.getName))))
log.info("Done adding dependency jars.")
log.info("Adding WASP jars to spark-lib...")
val waspProducts = (exportedProducts in Compile in Core).value ++
(exportedProducts in Compile in Consumers).value ++
(exportedProducts in Compile in Producers).value
val waspJarFiles = waspProducts.map {
dep => dep.data.getAbsoluteFile
}
log.info("Adding: " + waspJarFiles.mkString(","))
IO.copy(waspJarFiles.map(jar => (jar, new File(sparkLibPath + jar.getName))))
log.info("Done adding WASP jars.")
Seq.empty[File]
}
// add task to resource generators
resourceGenerators in Compile += populateSparkLib.taskValue
// force order
packageBin in Universal <<= (packageBin in Universal).dependsOn(populateSparkLib)
// add the spark-lib directory to the zip
mappings in Universal ++= directory("spark-lib/")
// set the main class to the framework default launcher
//mainClass in Compile := Some("it.agilelab.bigdata.wasp.launcher.FrameworkLauncher")
mainClass in Compile := Some("it.agilelab.bigdata.wasp.pipegraph.metro.launchers.MetroLauncher")
// append hadoop and spark conf dirs environment variables to classpath
scriptClasspath += ":$HADOOP_CONF_DIR:$YARN_CONF_DIR"
// set the name of the zip file
packageName in Universal := name.value
fork in run := true
dependencyOverrides ++= Set(
"com.fasterxml.jackson.core" % "jackson-databind" % "2.4.4"
)