Skip to content

Commit 7b7745c

Browse files
committed
DSP-14176 publishing extra jars for Spark Job Server
Extras, python and api are published by: export MVN_PUBLISH_REPO=abc export MVN_PUBLISH_URL=xyz sbt publish Most of the dependencies from poms are removed since users should use dse-spark-dependencies. Main assembly artifact is published as it used be - no changes here.
1 parent 67db0bc commit 7b7745c

File tree

2 files changed

+32
-5
lines changed

2 files changed

+32
-5
lines changed

build.sbt

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import Dependencies._
33
import JobServerRelease._
44
import sbtassembly.AssemblyPlugin.autoImport.assemblyMergeStrategy
55
import sbtassembly.MergeStrategy
6+
import scala.xml.{Node => XmlNode, NodeSeq => XmlNodeSeq, _}
7+
import scala.xml.transform.{RewriteRule, RuleTransformer}
68

79
transitiveClassifiers in Global := Seq(Artifact.SourceClassifier)
810
lazy val dirSettings = Seq()
@@ -11,7 +13,7 @@ lazy val akkaApp = Project(id = "akka-app", base = file("akka-app"))
1113
.settings(description := "Common Akka application stack: metrics, tracing, logging, and more.")
1214
.settings(commonSettings)
1315
.settings(libraryDependencies ++= coreTestDeps ++ akkaDeps)
14-
.settings(publishSettings)
16+
.settings(noPublishSettings)
1517
.disablePlugins(SbtScalariform)
1618

1719
lazy val jobServer = Project(id = "job-server", base = file("job-server"))
@@ -36,7 +38,7 @@ lazy val jobServer = Project(id = "job-server", base = file("job-server"))
3638
test in assembly := {},
3739
fork in Test := true
3840
)
39-
.settings(publishSettings)
41+
.settings(noPublishSettings)
4042
.dependsOn(akkaApp, jobServerApi)
4143
.disablePlugins(SbtScalariform)
4244

@@ -283,9 +285,36 @@ lazy val scoverageSettings = {
283285
coverageExcludedPackages := ".+Benchmark.*"
284286
}
285287

288+
/** Used for publishing `extras`, `api` and `python` jars. Main Spark Job Server assembly is published
289+
* as always. */
286290
lazy val publishSettings = Seq(
291+
autoScalaLibrary := false,
292+
credentials += Credentials(Path.userHome / ".sbt" / ".credentials"),
293+
publishMavenStyle := true,
294+
publishTo := Some(sys.env("MVN_PUBLISH_REPO") at sys.env("MVN_PUBLISH_URL")),
287295
licenses += ("Apache-2.0", url("http://choosealicense.com/licenses/apache/")),
288-
bintrayOrganization := Some("spark-jobserver")
296+
pomIncludeRepository := { _ => false },
297+
/** Since users are encouraged to use dse-spark-dependencies, which provides most of the needed
298+
* dependencies, we remove most of the Spark Job Server deps here. Provided, test and blacklisted
299+
* deps are removed from resulting poms. */
300+
pomPostProcess := { (node: XmlNode) =>
301+
new RuleTransformer(new RewriteRule {
302+
val pomDependencyBlacklist = Seq("job-server_", "joda-convert", "joda-time")
303+
val emptyElement = Text("")
304+
305+
def hasTestOrProvidedScope(e: Elem): Boolean = e.child.exists(child =>
306+
child.label == "scope" && (child.text == "provided" || child.text == "test"))
307+
308+
def isBlacklisted(e: Elem): Boolean = e.child.exists(child =>
309+
child.label == "artifactId" && pomDependencyBlacklist.exists(child.text.startsWith))
310+
311+
override def transform(node: XmlNode): XmlNodeSeq = node match {
312+
case e: Elem if e.label == "dependency" && (hasTestOrProvidedScope(e) || isBlacklisted(e)) =>
313+
emptyElement
314+
case _ => node
315+
}
316+
}).transform(node).head
317+
}
289318
)
290319

291320
// This is here so we can easily switch back to Logback when Spark fixes its log4j dependency.

project/plugins.sbt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "0.8.0")
1212

1313
addSbtPlugin("org.scoverage" %% "sbt-scoverage" % "1.3.5")
1414

15-
addSbtPlugin("me.lessis" % "bintray-sbt" % "0.3.0")
16-
1715
addSbtPlugin("me.lessis" % "ls-sbt" % "0.1.3")
1816

1917
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.3")

0 commit comments

Comments
 (0)