Skip to content
This repository was archived by the owner on Sep 1, 2020. It is now read-only.

Commit 81a67ee

Browse files
authored
Merge pull request scala#5199 from dwijnand/remove-scala-lang
Make removing forkjoin dependant on the organization key
2 parents aeb01c8 + ad77623 commit 81a67ee

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

build.sbt

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ lazy val commonSettings = clearSourceAndResourceDirectories ++ publishSettings +
220220
// directly to stdout
221221
outputStrategy in run := Some(StdoutOutput),
222222
Quiet.silenceScalaBinaryVersionWarning
223-
)
223+
) ++ removePomDependencies
224224

225225
/** Extra post-processing for the published POM files. These are needed to create POMs that
226226
* are equivalent to the ones from the ANT build. In the long term this should be removed and
@@ -249,10 +249,16 @@ def fixPom(extra: (String, scala.xml.Node)*): Setting[_] = {
249249
) ++ extra) }
250250
}
251251

252+
val pomDependencyExclusions =
253+
settingKey[Seq[(String, String)]]("List of (groupId, artifactId) pairs to exclude from the POM and ivy.xml")
254+
255+
pomDependencyExclusions in Global := Nil
256+
252257
/** Remove unwanted dependencies from the POM and ivy.xml. */
253-
def removePomDependencies(deps: (String, String)*): Seq[Setting[_]] = Seq(
258+
lazy val removePomDependencies: Seq[Setting[_]] = Seq(
254259
pomPostProcess := { n =>
255260
val n2 = pomPostProcess.value.apply(n)
261+
val deps = pomDependencyExclusions.value
256262
import scala.xml._
257263
import scala.xml.transform._
258264
new RuleTransformer(new RewriteRule {
@@ -270,6 +276,7 @@ def removePomDependencies(deps: (String, String)*): Seq[Setting[_]] = Seq(
270276
import scala.xml._
271277
import scala.xml.transform._
272278
val f = deliverLocal.value
279+
val deps = pomDependencyExclusions.value
273280
val e = new RuleTransformer(new RewriteRule {
274281
override def transform(node: Node) = node match {
275282
case e: Elem if e.label == "dependency" && {
@@ -366,10 +373,10 @@ lazy val library = configureAsSubproject(project)
366373
"/project/name" -> <name>Scala Library</name>,
367374
"/project/description" -> <description>Standard library for the Scala Programming Language</description>,
368375
"/project/packaging" -> <packaging>jar</packaging>
369-
)
376+
),
377+
// Remove the dependency on "forkjoin" from the POM because it is included in the JAR:
378+
pomDependencyExclusions += ((organization.value, "forkjoin"))
370379
)
371-
// Remove the dependency on "forkjoin" from the POM because it is included in the JAR:
372-
.settings(removePomDependencies(("org.scala-lang", "forkjoin")): _*)
373380
.settings(filterDocSources("*.scala" -- (regexFileFilter(".*/runtime/.*\\$\\.scala") ||
374381
regexFileFilter(".*/runtime/ScalaRunTime\\.scala") ||
375382
regexFileFilter(".*/runtime/StringAdd\\.scala"))): _*)
@@ -451,12 +458,9 @@ lazy val compiler = configureAsSubproject(project)
451458
"/project/description" -> <description>Compiler for the Scala Programming Language</description>,
452459
"/project/packaging" -> <packaging>jar</packaging>
453460
),
454-
apiURL := None
461+
apiURL := None,
462+
pomDependencyExclusions ++= List(("org.apache.ant", "ant"), ("org.scala-lang.modules", "scala-asm"))
455463
)
456-
.settings(removePomDependencies(
457-
("org.apache.ant", "ant"),
458-
("org.scala-lang.modules", "scala-asm")
459-
): _*)
460464
.dependsOn(library, reflect)
461465

462466
lazy val interactive = configureAsSubproject(project)

0 commit comments

Comments
 (0)