Skip to content

Commit a804932

Browse files
authored
Merge pull request #21 from riptano/DSP-16002
DSP-16002 backport of DSP-14176
2 parents cfbb7b7 + 3a2b104 commit a804932

File tree

2 files changed

+38
-5
lines changed

2 files changed

+38
-5
lines changed

build.sbt

Lines changed: 38 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

@@ -109,6 +111,12 @@ lazy val jobServerTestJarSettings = Seq(
109111
exportJars := true // use the jar instead of target/classes
110112
)
111113

114+
lazy val noPublishSettings = Seq(
115+
publishTo := Some(Resolver.file("Unused repo", file("target/unusedrepo"))),
116+
publishArtifact := false,
117+
publish := {}
118+
)
119+
112120
lazy val dockerSettings = Seq(
113121
// Make the docker task depend on the assembly task, which generates a fat JAR file
114122
docker <<= (docker dependsOn (assembly in jobServerExtras)),
@@ -251,9 +259,36 @@ lazy val scoverageSettings = {
251259
coverageExcludedPackages := ".+Benchmark.*"
252260
}
253261

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

259294
// 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)