-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathbuild.sbt
129 lines (94 loc) · 3.72 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
name := "spark-netflow"
organization := "com.github.sadikovi"
scalaVersion := "2.12.12"
spName := "sadikovi/spark-netflow"
val defaultSparkVersion = "3.0.1"
sparkVersion := sys.props.getOrElse("spark.testVersion", defaultSparkVersion)
val defaultHadoopVersion = "2.6.0"
val hadoopVersion = settingKey[String]("The version of Hadoop to test against.")
hadoopVersion := sys.props.getOrElse("hadoop.testVersion", defaultHadoopVersion)
spAppendScalaVersion := true
spIncludeMaven := true
spIgnoreProvided := true
sparkComponents := Seq("sql")
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % "3.2.0" % "test",
"com.novocode" % "junit-interface" % "0.11" % "test"
)
libraryDependencies ++= Seq(
"org.apache.hadoop" % "hadoop-client" % hadoopVersion.value % "test" exclude("javax.servlet", "servlet-api") force(),
"org.apache.spark" %% "spark-core" % sparkVersion.value % "test" exclude("org.apache.hadoop", "hadoop-client"),
"org.apache.spark" %% "spark-sql" % sparkVersion.value % "test" exclude("org.apache.hadoop", "hadoop-client")
)
// check deprecation and unchecked without manual restart
javacOptions in ThisBuild ++= Seq("-Xlint:unchecked")
scalacOptions in ThisBuild ++= Seq("-unchecked", "-deprecation", "-feature")
// Display full-length stacktraces from ScalaTest:
testOptions in Test += Tests.Argument("-oF")
testOptions in Test += Tests.Argument(TestFrameworks.JUnit, "-a", "-v", "+q")
parallelExecution in Test := false
// Skip tests during assembly
test in assembly := {}
coverageMinimum := 80
coverageHighlighting := true
coverageFailOnMinimum := true
coverageExcludedPackages := ".*.benchmark"
EclipseKeys.eclipseOutput := Some("target/eclipse")
// tasks dependencies
lazy val compileScalastyle = taskKey[Unit]("compileScalastyle")
compileScalastyle := org.scalastyle.sbt.ScalastylePlugin.scalastyle.in(Compile).toTask("").value
(compile in Compile) <<= (compile in Compile).dependsOn(compileScalastyle)
// Create a default Scala style task to run with tests
lazy val testScalastyle = taskKey[Unit]("testScalastyle")
testScalastyle := org.scalastyle.sbt.ScalastylePlugin.scalastyle.in(Test).toTask("").value
(test in Test) <<= (test in Test).dependsOn(testScalastyle)
/********************
* Release settings *
********************/
publishTo := {
val nexus = "https://oss.sonatype.org/"
if (version.value.endsWith("SNAPSHOT"))
Some("snapshots" at nexus + "content/repositories/snapshots")
else
Some("releases" at nexus + "service/local/staging/deploy/maven2")
}
publishMavenStyle := true
publishArtifact in Test := false
pomIncludeRepository := { _ => false }
releaseCrossBuild := true
licenses += ("Apache-2.0", url("http://www.apache.org/licenses/LICENSE-2.0"))
releasePublishArtifactsAction := PgpKeys.publishSigned.value
pomExtra := (
<url>https://github.com/sadikovi/spark-netflow</url>
<scm>
<url>[email protected]:sadikovi/spark-netflow.git</url>
<connection>scm:git:[email protected]:sadikovi/spark-netflow.git</connection>
</scm>
<developers>
<developer>
<id>sadikovi</id>
<name>Ivan Sadikov</name>
<url>https://github.com/sadikovi</url>
</developer>
</developers>
)
bintrayReleaseOnPublish in ThisBuild := false
import ReleaseTransformations._
// Add publishing to spark packages as another step.
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runTest,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
publishArtifacts,
setNextVersion,
commitNextVersion,
pushChanges,
releaseStepTask(spPublish)
)
// Credentials for sbt-spark-package
credentials += Credentials(Path.userHome / ".ivy2" / ".sbtcredentials")
// Credentials for publishing to sonatype
credentials += Credentials(Path.userHome / ".ivy2" / ".sonatype.sbt")