Skip to content

Commit 6deec07

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 cfbb7b7 commit 6deec07

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()
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"))
@@ -32,7 +34,7 @@ lazy val jobServer = Project(id = "job-server", base = file("job-server"))
3234
test in assembly := {},
3335
fork in Test := true
3436
)
35-
.settings(publishSettings)
37+
.settings(noPublishSettings)
3638
.dependsOn(akkaApp, jobServerApi)
3739
.disablePlugins(SbtScalariform)
3840

@@ -251,9 +253,36 @@ lazy val scoverageSettings = {
251253
coverageExcludedPackages := ".+Benchmark.*"
252254
}
253255

256+
/** Used for publishing `extras`, `api` and `python` jars. Main Spark Job Server assembly is published
257+
* as always. */
254258
lazy val publishSettings = Seq(
259+
autoScalaLibrary := false,
260+
credentials += Credentials(Path.userHome / ".sbt" / ".credentials"),
261+
publishMavenStyle := true,
262+
publishTo := Some(sys.env("MVN_PUBLISH_REPO") at sys.env("MVN_PUBLISH_URL")),
255263
licenses += ("Apache-2.0", url("http://choosealicense.com/licenses/apache/")),
256-
bintrayOrganization := Some("spark-jobserver")
264+
pomIncludeRepository := { _ => false },
265+
/** Since users are encouraged to use dse-spark-dependencies, which provides most of the needed
266+
* dependencies, we remove most of the Spark Job Server deps here. Provided, test and blacklisted
267+
* deps are removed from resulting poms. */
268+
pomPostProcess := { (node: XmlNode) =>
269+
new RuleTransformer(new RewriteRule {
270+
val pomDependencyBlacklist = Seq("job-server_", "joda-convert", "joda-time")
271+
val emptyElement = Text("")
272+
273+
def hasTestOrProvidedScope(e: Elem): Boolean = e.child.exists(child =>
274+
child.label == "scope" && (child.text == "provided" || child.text == "test"))
275+
276+
def isBlacklisted(e: Elem): Boolean = e.child.exists(child =>
277+
child.label == "artifactId" && pomDependencyBlacklist.exists(child.text.startsWith))
278+
279+
override def transform(node: XmlNode): XmlNodeSeq = node match {
280+
case e: Elem if e.label == "dependency" && (hasTestOrProvidedScope(e) || isBlacklisted(e)) =>
281+
emptyElement
282+
case _ => node
283+
}
284+
}).transform(node).head
285+
}
257286
)
258287

259288
// 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
@@ -13,8 +13,6 @@ addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "0.8.0")
1313

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

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

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

0 commit comments

Comments
 (0)