-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sbt
More file actions
139 lines (111 loc) · 4.3 KB
/
Copy pathbuild.sbt
File metadata and controls
139 lines (111 loc) · 4.3 KB
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
name := "spark-tools"
organization := "org.tupol"
scalaVersion := "2.12.12"
crossScalaVersions := Seq("2.11.12", "2.12.12")
val sparkUtilsVersion = "0.4.2"
val sparkVersion = "2.4.6"
val sparkXmlVersion = "0.10.0"
val deltaVersion = "0.6.1"
// ------------------------------
// DEPENDENCIES AND RESOLVERS
updateOptions := updateOptions.value.withCachedResolution(true)
resolvers += "Sonatype OSS Releases" at "https://oss.sonatype.org/content/repositories/releases"
resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"
lazy val providedDependencies = Seq(
"org.apache.spark" %% "spark-core" % sparkVersion force(),
"org.apache.spark" %% "spark-sql" % sparkVersion force(),
"org.apache.spark" %% "spark-mllib" % sparkVersion force(),
"org.apache.spark" %% "spark-streaming" % sparkVersion force(),
"org.apache.spark" %% "spark-sql-kafka-0-10" % sparkVersion,
"org.apache.spark" %% "spark-streaming-kafka-0-10" % sparkVersion
)
libraryDependencies ++= providedDependencies.map(_ % "provided")
// Jackson dependencies over Spark and Kafka Versions can be tricky; for Spark 2.4.x we need this override
dependencyOverrides += "com.fasterxml.jackson.core" % "jackson-databind" % "2.6.7"
libraryDependencies ++= Seq(
"org.json4s" %% "json4s-native" % "3.5.5",
"org.tupol" %% "spark-utils" % sparkUtilsVersion,
"org.tupol" %% "spark-utils" % sparkUtilsVersion % "test" classifier "tests",
"net.manub" %% "scalatest-embedded-kafka" % "2.0.0" % "test",
"org.scalacheck" %% "scalacheck" % "1.14.0" % "test",
"org.scalatest" %% "scalatest" % "3.0.5" % "test",
"org.apache.spark" %% "spark-avro" % sparkVersion % "test",
"com.databricks" %% "spark-xml" % sparkXmlVersion % "test",
"io.delta" %% "delta-core" % deltaVersion % "test"
)
// ------------------------------
// TESTING
parallelExecution in Test := false
fork in Test := true
publishArtifact in Test := true
// ------------------------------
// TEST COVERAGE
scoverage.ScoverageKeys.coverageExcludedPackages := "org.apache.spark.ml.param.shared.*"
scoverage.ScoverageKeys.coverageExcludedFiles := ".*BuildInfo.*"
// ------------------------------
// PUBLISHING
isSnapshot := version.value.trim.endsWith("SNAPSHOT")
useGpg := true
// Nexus (see https://www.scala-sbt.org/1.x/docs/Using-Sonatype.html)
publishTo := {
val repo = "https://oss.sonatype.org/"
if (isSnapshot.value)
Some("snapshots" at repo + "content/repositories/snapshots")
else
Some("releases" at repo + "service/local/staging/deploy/maven2")
}
publishArtifact in Test := true
publishMavenStyle := true
pomIncludeRepository := { _ => false }
licenses := Seq("MIT-style" -> url("https://opensource.org/licenses/MIT"))
homepage := Some(url("https://github.com/tupol/spark-tools"))
scmInfo := Some(
ScmInfo(
url("https://github.com/tupol/spark-tools.git"),
"scm:git@github.com:tupol/spark-tools.git"
)
)
developers := List(
Developer(
id = "tupol",
name = "Tupol",
email = "tupol.github@gmail.com",
url = url("https://github.com/tupol")
)
)
releasePublishArtifactsAction := PgpKeys.publishSigned.value
import ReleaseTransformations._
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
setReleaseVersion,
commitReleaseVersion, // performs the initial git checks
tagRelease,
releaseStepCommand(s"""sonatypeOpen "${organization.value}" "${name.value} v${version.value}""""),
releaseStepCommand("publishSigned"),
releaseStepCommand("sonatypeRelease"),
setNextVersion,
commitNextVersion,
pushChanges // also checks that an upstream branch is properly configured
)
// ------------------------------
// BUILD-INFO
lazy val root = (project in file(".")).
enablePlugins(BuildInfoPlugin).
settings(
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion),
buildInfoPackage := "org.tupol.spark.tools.info"
)
buildInfoKeys ++= Seq[BuildInfoKey](
resolvers,
libraryDependencies in Test,
BuildInfoKey.map(name) { case (k, v) => "project" + k.capitalize -> v.capitalize },
BuildInfoKey.action("buildTime") {
System.currentTimeMillis
} // re-computed each time at compile
)
buildInfoOptions += BuildInfoOption.BuildTime
buildInfoOptions += BuildInfoOption.ToMap
buildInfoOptions += BuildInfoOption.ToJson