Skip to content

Commit 3d00c6e

Browse files
committed
Fix sourceMaps urls with Scala 3
1 parent 6b2733a commit 3d00c6e

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

build.sbt

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,24 @@
11
import scalatex.ScalatexReadme
22

3-
lazy val root = project.in(file(".")).
4-
enablePlugins(ScalaJSPlugin)
3+
def sourceMapsToGithub: Project => Project =
4+
p => p.settings(
5+
scalacOptions ++= {
6+
val isDotty = scalaVersion.value startsWith "3"
7+
val ver = version.value
8+
if (isSnapshot.value)
9+
Nil
10+
else {
11+
val a = p.base.toURI.toString.replaceFirst("[^/]+/?$", "")
12+
val g = s"https://raw.githubusercontent.com/scala-js/scala-js-dom"
13+
val flag = if (isDotty) "-scalajs-mapSourceURI" else "-P:scalajs:mapSourceURI"
14+
s"$flag:$a->$g/v$ver/" :: Nil
15+
}
16+
}
17+
)
18+
19+
lazy val root = project.in(file("."))
20+
.enablePlugins(ScalaJSPlugin)
21+
.configure(sourceMapsToGithub)
522

623
name := "Scala.js DOM"
724

@@ -22,16 +39,6 @@ homepage := Some(url("http://scala-js.org/"))
2239

2340
licenses += ("MIT", url("http://opensource.org/licenses/mit-license.php"))
2441

25-
scalacOptions ++= {
26-
if (isSnapshot.value)
27-
Seq.empty
28-
else {
29-
val a = baseDirectory.value.toURI
30-
val g = "https://raw.githubusercontent.com/scala-js/scala-js-dom"
31-
Seq(s"-P:scalajs:mapSourceURI:$a->$g/v${version.value}/")
32-
}
33-
}
34-
3542
def hasNewCollections(version: String): Boolean = {
3643
!version.startsWith("2.11.") &&
3744
!version.startsWith("2.12.")

0 commit comments

Comments
 (0)