-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
134 lines (108 loc) · 5.56 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
organization in ThisBuild := "me.amanj"
version in ThisBuild := "0.0.6"
scalacOptions in ThisBuild ++= Seq(
"-deprecation", // Emit warning and location for usages of deprecated APIs.
"-explaintypes", // Explain type errors in more detail.
"-feature", // Emit warning and location for usages of features that should be imported explicitly.
"-unchecked", // Enable additional warnings where generated code depends on assumptions.
)
licenses in ThisBuild += ("Apache-2.0", url("https://opensource.org/licenses/Apache-2.0"))
crossPaths in ThisBuild := true
fork in Test in ThisBuild := true
disablePlugins(BintrayPlugin)
coverageEnabled in ThisBuild := false
skip in publish := true
val SCALA_211 = "2.11.12"
val SCALA_210 = "2.10.7"
javaOptions in ThisBuild ++= Seq("-Xms512M", "-Xmx2048M", "-XX:MaxPermSize=2048M", "-XX:+CMSClassUnloadingEnabled")
def getSparkDependencies(sparkVersion: String, scalaVersionFull: String) = {
val scalaVersion = scalaVersionFull.replaceAll("\\.[0-9]+$", "")
sparkVersion match {
case "2.4"=>
Seq("org.apache.spark" % s"spark-core_$scalaVersion" % "2.4.3",
"com.holdenkarau" % s"spark-testing-base_$scalaVersion" % "2.4.2_0.12.0" % Test)
case "2.3"=>
Seq("org.apache.spark" % s"spark-core_$scalaVersion" % "2.3.3",
"com.holdenkarau" % s"spark-testing-base_$scalaVersion" % "2.3.2_0.12.0" % Test)
case "2.2"=>
Seq("org.apache.spark" % s"spark-core_$scalaVersion" % "2.2.3",
"com.holdenkarau" % s"spark-testing-base_$scalaVersion" % "2.2.2_0.12.0" % Test)
case "2.1"=>
Seq("org.apache.spark" % s"spark-core_$scalaVersion" % "2.1.3",
"com.holdenkarau" % s"spark-testing-base_$scalaVersion" % "2.1.3_0.12.0" % Test)
case "2.0"=>
Seq("org.apache.spark" % s"spark-core_$scalaVersion" % "2.0.2",
"com.holdenkarau" % s"spark-testing-base_$scalaVersion" % "2.0.2_0.12.0" % Test)
case "1.6"=>
Seq("org.apache.spark" % s"spark-core_$scalaVersion" % "1.6.3",
"com.holdenkarau" % s"spark-testing-base_$scalaVersion" % "1.6.3_0.12.0" % Test)
}
}
def mkSparkProject(sparkVersion: String, scalaVersionStr: String) = {
val scalaMajorMinor = scalaVersionStr.replaceAll("\\.[0-9]+$", "")
val projectId = s"spark_${sparkVersion.replaceAll("[.]", "_")}_${scalaMajorMinor.replaceAll("[.]", "_")}"
val projectBase = s"spark_${sparkVersion.replaceAll("[.]", "_")}"
val projectName = s"spark_${sparkVersion}_$scalaMajorMinor"
val projectTarget = s"target-${sparkVersion}_$scalaMajorMinor"
val proj = Project(id = projectId, base = file(projectBase)).settings(Seq(
name := projectName,
skip in publish := true,
target := baseDirectory.value / projectTarget,
libraryDependencies ++= getSparkDependencies(sparkVersion, scalaVersionStr)
)).disablePlugins(BintrayPlugin)
proj.settings( scalaVersion in proj := scalaVersionStr )
}
def mkProtoProject(sparkVersion: String, scalaVersionStr: String) = {
val scalaMajorMinor = scalaVersionStr.replaceAll("\\.[0-9]+$", "")
val projectName = s"spark-proto_${sparkVersion}"
val projectId = s"${projectName.replaceAll("[.]", "_")}_${scalaMajorMinor.replaceAll("[.]", "_")}"
val projectTarget = s"target-${sparkVersion}_$scalaMajorMinor"
val proj = Project(id = projectId, base = file("proto")).settings(Seq(
name := projectName,
skip in publish := false,
sourceDirectory in ProtobufConfig := (sourceDirectory in Test).value / "protobuf",
protobufIncludePaths in ProtobufConfig += (sourceDirectory in ProtobufConfig).value,
version in ProtobufConfig := "3.9.1",
coverageEnabled := true,
coverageMinimum := 80,
coverageFailOnMinimum := true,
target := baseDirectory.value / projectTarget,
bintrayRepository := "maven",
bintrayOrganization in bintray := None,
parallelExecution in Test := false,
libraryDependencies ++= Seq(
"com.google.protobuf" % "protobuf-java" % "3.9.1") ++
getSparkDependencies(sparkVersion, scalaVersionStr)
)).enablePlugins(ProtobufPlugin, BintrayPlugin)
proj.settings( scalaVersion in proj := scalaVersionStr )
}
// Scala 2.10 only
// Spark 1.6.x, 2.10
lazy val spark_1_6 = mkSparkProject("1.6", SCALA_210)
lazy val proto_1_6 = mkProtoProject("1.6", SCALA_210).dependsOn(spark_1_6)
// Scala 2.10 and 2.11
// Spark 2.0.x, 2.10
lazy val spark_2_0_210 = mkSparkProject("2.0", SCALA_210)
lazy val proto_2_0_210 = mkProtoProject("2.0", SCALA_210).dependsOn(spark_2_0_210)
// Spark 2.0.x, 2.11
lazy val spark_2_0_211 = mkSparkProject("2.0", SCALA_211)
lazy val proto_2_0_211 = mkProtoProject("2.0", SCALA_211).dependsOn(spark_2_0_211)
// Spark 2.1.x, 2.10
lazy val spark_2_1_210 = mkSparkProject("2.1", SCALA_210)
lazy val proto_2_1_210 = mkProtoProject("2.1", SCALA_210).dependsOn(spark_2_1_210)
// Spark 2.1.x, 2.11
lazy val spark_2_1_211 = mkSparkProject("2.1", SCALA_211)
lazy val proto_2_1_211 = mkProtoProject("2.1", SCALA_211).dependsOn(spark_2_1_211)
// Spark 2.2.x, 2.10
lazy val spark_2_2_210 = mkSparkProject("2.2", SCALA_210)
lazy val proto_2_2_210 = mkProtoProject("2.2", SCALA_210).dependsOn(spark_2_2_210)
// Spark 2.2.x, 2.11
lazy val spark_2_2_211 = mkSparkProject("2.2", SCALA_211)
lazy val proto_2_2_211 = mkProtoProject("2.2", SCALA_211).dependsOn(spark_2_2_211)
// Scala 2.11 only
// Spark 2.3.x, 2.11
lazy val spark_2_3 = mkSparkProject("2.3", SCALA_211)
lazy val proto_2_3 = mkProtoProject("2.3", SCALA_211).dependsOn(spark_2_3)
// Spark 2.4.x, 2.11
lazy val spark_2_4 = mkSparkProject("2.4", SCALA_211)
lazy val proto_2_4 = mkProtoProject("2.4", SCALA_211).dependsOn(spark_2_4)