-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.sbt
133 lines (125 loc) · 5.67 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
import Dependencies._
import sbt.Keys.{fork, resolvers}
import sbt.url
import sbtrelease.ReleaseStateTransformations.{checkSnapshotDependencies, commitNextVersion, commitReleaseVersion, inquireVersions, publishArtifacts, pushChanges, runClean, runTest, setNextVersion, setReleaseVersion, tagRelease}
crossScalaVersions := Nil
lazy val basicSettings = Seq(
ThisBuild / organization := "org.tupol",
ThisBuild / name := "spark-utils",
ThisBuild / scalaVersion := Versions.scala,
ThisBuild / crossScalaVersions := Versions.crossScala,
ThisBuild / scalacOptions ++= Seq(
"-feature",
"-deprecation",
"-unchecked",
s"-target:jvm-${Versions.jvm}",
),
ThisBuild / updateOptions := updateOptions.value.withCachedResolution(true),
ThisBuild / libraryDependencies ++= CoreTestDependencies,
ThisBuild / dependencyOverrides ++= NettyOverrides,
ThisBuild / resolvers += "Sonatype OSS Releases" at "https://oss.sonatype.org/content/repositories/releases",
ThisBuild / resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots",
Test / parallelExecution := false,
Test / fork := true,
Test / javaOptions ++= Seq(
"base/java.lang", "base/java.lang.invoke", "base/java.lang.reflect", "base/java.io", "base/java.net", "base/java.nio",
"base/java.util", "base/java.util.concurrent", "base/java.util.concurrent.atomic",
"base/sun.nio.ch", "base/sun.nio.cs", "base/sun.security.action",
"base/sun.util.calendar", "security.jgss/sun.security.krb5",
).map("--add-opens=java." + _ + "=ALL-UNNAMED"),
)
lazy val publishSettings = Seq(
isSnapshot := version.value.trim.endsWith("SNAPSHOT"),
// Nexus (see https://www.scala-sbt.org/1.x/docs/Using-Sonatype.html)
ThisBuild / publishTo in ThisBuild := {
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")
},
ThisBuild / publishArtifact in Test := true,
ThisBuild / publishMavenStyle := true,
ThisBuild / pomIncludeRepository := { _ => false },
ThisBuild / licenses := Seq("MIT-style" -> url("https://opensource.org/licenses/MIT")),
ThisBuild / homepage := Some(url("https://github.com/tupol/spark-utils")),
ThisBuild / scmInfo := Some(
ScmInfo(
url("https://github.com/tupol/spark-utils.git"),
"scm:[email protected]:tupol/spark-utils.git"
)
),
ThisBuild / developers := List(
Developer(
id = "tupol",
name = "Tupol",
email = "[email protected]",
url = url("https://github.com/tupol")
)
),
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
setReleaseVersion,
commitReleaseVersion, // performs the initial git checks
tagRelease,
publishArtifacts, // checks whether `publishTo` is properly set up
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
)
)
lazy val coverageSettings = Seq(
coverageEnabled in Test := true,
coverageMinimumStmtTotal in Test := 80,
coverageMinimumBranchTotal in Test := 80,
coverageFailOnMinimum in Test := true,
coverageExcludedPackages := "org.apache.spark.ml.param.shared.*;.*BuildInfo.*;org.tupol.spark.Logging.*"
)
val commonSettings = basicSettings ++ coverageSettings ++ publishSettings
lazy val `spark-utils-core` = (project in file("utils-core"))
.enablePlugins(BuildInfoPlugin)
.settings(commonSettings: _*)
.settings(
name := "spark-utils-core",
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion),
buildInfoOptions := Seq[BuildInfoOption](BuildInfoOption.BuildTime, BuildInfoOption.ToMap, BuildInfoOption.ToJson),
buildInfoPackage := "org.tupol.spark.info",
libraryDependencies ++= ProvidedSparkCoreDependencies,
libraryDependencies ++= CoreDependencies,
Test / publishArtifact := true
)
lazy val `spark-utils-io` = (project in file("utils-io"))
.enablePlugins(BuildInfoPlugin)
.settings(commonSettings: _*)
.settings(
name := "spark-utils-io",
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion),
buildInfoOptions := Seq[BuildInfoOption](BuildInfoOption.BuildTime, BuildInfoOption.ToMap, BuildInfoOption.ToJson),
buildInfoPackage := "org.tupol.spark.io.info",
libraryDependencies ++= ProvidedSparkCoreDependencies,
libraryDependencies ++= ProvidedSparkKafkaDependencies,
libraryDependencies ++= CoreDependencies,
libraryDependencies ++= IoTestDependencies,
Test / publishArtifact := true
)
.dependsOn(`spark-utils-core` % "test->test;compile->compile")
lazy val `spark-utils-io-pureconfig` = (project in file("utils-io-pureconfig"))
.enablePlugins(BuildInfoPlugin)
.settings(commonSettings: _*)
.settings(
name := "spark-utils-io-pureconfig",
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion),
buildInfoOptions := Seq[BuildInfoOption](BuildInfoOption.BuildTime, BuildInfoOption.ToMap, BuildInfoOption.ToJson),
buildInfoPackage := "org.tupol.spark.io.pureconf.info",
libraryDependencies ++= ProvidedSparkCoreDependencies,
libraryDependencies ++= ProvidedSparkKafkaDependencies,
libraryDependencies ++= CoreDependencies,
libraryDependencies ++= IoPureconfigDependencies,
libraryDependencies ++= IoTestDependencies,
Test / publishArtifact := true
)
.dependsOn(`spark-utils-io` % "test->test;compile->compile")