Skip to content

Commit b294d4c

Browse files
committed
chore: drop org.scala-js:scalajs-library when generating the pom
1 parent eda9562 commit b294d4c

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

project/Build.scala

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ import sbttastymima.TastyMiMaPlugin.autoImport._
4040

4141
import scala.util.Properties.isJavaAtLeast
4242

43+
import scala.xml.{Node => XmlNode, NodeSeq => XmlNodeSeq, _}
44+
import scala.xml.transform.{RewriteRule, RuleTransformer}
45+
4346
import org.portablescala.sbtplatformdeps.PlatformDepsPlugin.autoImport._
4447

4548
object Build {
@@ -1893,14 +1896,15 @@ object Build {
18931896
|| file._2.endsWith("UnitOps.tasty") || file._2.endsWith("UnitOps.class") || file._2.endsWith("UnitOps$.class")
18941897
|| file._2.endsWith("AnonFunctionXXL.tasty") || file._2.endsWith("AnonFunctionXXL.class"))
18951898
},
1896-
libraryDependencies += ("org.scala-js" %% "scalajs-library" % scalaJSVersion).cross(CrossVersion.for3Use2_13),
1899+
libraryDependencies += ("org.scala-js" %% "scalajs-library" % scalaJSVersion % Provided).cross(CrossVersion.for3Use2_13),
18971900
libraryDependencies += ("org.scala-js" % "scalajs-javalib" % scalaJSVersion),
18981901
// Project specific target folder. sbt doesn't like having two projects using the same target folder
18991902
target := target.value / "scala-library",
19001903
// we need to have the `scala-library` artifact in the classpath for `ScalaLibraryPlugin` to work
19011904
// this was the only way to not get the artifact evicted by sbt. Even a custom configuration didn't work
19021905
// NOTE: true is the default value, just making things clearer here
19031906
managedScalaInstance := true,
1907+
autoScalaLibrary := false,
19041908
// Configure the nonbootstrapped compiler
19051909
scalaInstance := {
19061910
val externalCompilerDeps = (`scala3-compiler-nonbootstrapped` / Compile / externalDependencyClasspath).value.map(_.data).toSet
@@ -1927,6 +1931,16 @@ object Build {
19271931
scalaCompilerBridgeBinaryJar := {
19281932
Some((`scala3-sbt-bridge-nonbootstrapped` / Compile / packageBin).value)
19291933
},
1934+
// See https://stackoverflow.com/a/51416386
1935+
pomPostProcess := { (node: XmlNode) =>
1936+
new RuleTransformer(new RewriteRule {
1937+
override def transform(node: XmlNode): XmlNodeSeq = node match {
1938+
case e: Elem if e.label == "dependency" && e.child.exists(child => child.label == "artifactId" && child.text == "scalajs-library_2.13") =>
1939+
XmlNodeSeq.Empty
1940+
case _ => node
1941+
}
1942+
}).transform(node).head
1943+
},
19301944
)
19311945

19321946
/* Configuration of the org.scala-lang:scala3-library_sjs1_3:*.**.**-bootstrapped project */

0 commit comments

Comments
 (0)