-
Notifications
You must be signed in to change notification settings - Fork 92
/
build.sbt
148 lines (133 loc) · 4.89 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
import BuildUtils._
import de.heikoseeberger.sbtheader.license.Apache2_0
import sbtdocker.DockerKeys.dockerBuildAndPush
import sbtdocker.ImageName
import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations._
// Meta
name := "sparklint"
description := "Listener and WebUI for Apache Spark performance events"
organization := "com.groupon.sparklint"
homepage := Some(url("https://github.com/groupon/sparklint"))
startYear := Some(2016)
licenses := Seq("Apache License, Version 2.0" -> url("https://www.apache.org/licenses/LICENSE-2.0.txt"))
// Compile
enablePlugins(AutomateHeaderPlugin)
name := s"sparklint-spark${getProjectNameSuffix(sparkVersion.value)}"
scalaVersion := "2.11.8"
crossScalaVersions := Seq("2.10.6", "2.11.8")
unmanagedSourceDirectories in Compile += (sourceDirectory in Compile).value / getSparkMajorVersion(sparkVersion.value)
unmanagedSourceDirectories in Test += (sourceDirectory in Test).value / getSparkMajorVersion(sparkVersion.value)
// Dependency
// Spark
lazy val sparkVersion = SettingKey[String]("spark-version", "The version of spark library to compile against")
sparkVersion := "2.0.1"
// Non-spark
lazy val http4s = "0.15.5"
lazy val optparse = "1.1.2"
lazy val scalatest = "3.0.1"
lazy val slf4j = "1.7.16"
lazy val log4j = "1.2.17"
lazy val json4s = "3.2.11"
lazy val jackson = "2.6.5"
resolvers in ThisBuild ++= Seq(
Resolver.sonatypeRepo("snapshot"),
Resolver.sonatypeRepo("releases")
)
libraryDependencies ++= Seq(
"org.apache.spark" %% "spark-core" % sparkVersion.value
exclude("com.fasterxml.jackson.module", "*"),
"org.apache.spark" %% "spark-sql" % sparkVersion.value
exclude("com.fasterxml.jackson.module", "*"),
"org.apache.spark" %% "spark-streaming" % sparkVersion.value
exclude("com.fasterxml.jackson.module", "*"),
"com.frugalmechanic" %% "scala-optparse" % optparse,
"org.http4s" %% "http4s-dsl" % http4s,
"org.http4s" %% "http4s-blaze-server" % http4s,
"org.http4s" %% "http4s-json4s-jackson" % http4s
exclude("org.json4s", "*"),
"org.http4s" %% "http4s-blaze-client" % http4s,
"org.slf4j" % "slf4j-api" % slf4j,
"org.slf4j" % "slf4j-log4j12" % slf4j,
"log4j" % "log4j" % log4j,
"com.fasterxml.jackson.module" %% "jackson-module-scala" % jackson,
"org.json4s" %% "json4s-jackson" % json4s
)
// Run
mainClass in run := Some("com.groupon.sparklint.SparklintServer")
run in Compile := Defaults.runTask(fullClasspath in Compile, mainClass in (Compile, run), runner in (Compile, run)).evaluated
runMain in Compile := Defaults.runMainTask(fullClasspath in Compile, runner in (Compile, run)).evaluated
// Test
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % scalatest
) map (_ % "test")
fork in Test := true
// Package fat jar
assemblyMergeStrategy in assembly := {
case PathList("META-INF", xs@_*) => MergeStrategy.discard
case _ => MergeStrategy.first
}
// Publish
publishMavenStyle := true
publishArtifact in Test := false
headers := Map(
"scala" -> Apache2_0(startYear.value.get.toString, "Groupon, Inc.")
)
// Publish to Docker
enablePlugins(DockerPlugin)
// Tag the docker build as latest for snapshot, concrete version number for release
// FIXME: replace roboxue with groupon after organization account has been created
imageNames in docker := Seq(new ImageName(namespace = Some("roboxue"), repository = "sparklint",
tag = if (!isSnapshot.value) Some(version.value) else Some("latest")))
dockerfile in docker := {
val artifact: File = assembly.value
val artifactTargetPath = s"/app/${artifact.name}"
new Dockerfile {
from("java")
maintainer("Robert Xue", "[email protected]")
add(artifact, artifactTargetPath)
entryPoint("java", "-jar", artifactTargetPath)
expose(23763)
}
}
// Release customization
sonatypeProfileName := "com.groupon"
deployBranch := "master"
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
mergeReleaseVersion,
setNextVersion,
commitNextVersion,
pushChanges
)
// Package Multiple Spark Version
commands += foreachSparkVersion
// One command to release everything
commands += sparklintReleaseCommand
// To sync with Maven central
pomExtra in Global := {
<scm>
<connection>scm:git:git://github.com/groupon/sparklint.git</connection>
<developerConnection>scm:git:ssh://[email protected]/groupon/sparklint.git</developerConnection>
<url>github.com/groupon/sparklint.git</url>
</scm>
<developers>
<developer>
<name>Robert Xue</name>
<email>[email protected]</email>
<organization>Groupon, Inc.</organization>
<organizationUrl>http://www.groupon.com</organizationUrl>
</developer>
<developer>
<name>Simon Whitear</name>
<email>[email protected]</email>
<organization>Groupon, Inc.</organization>
<organizationUrl>http://www.groupon.com</organizationUrl>
</developer>
</developers>
}