Skip to content

Commit 6234cd9

Browse files
committed
[build] Update scalajs to 1.20.1
Make Name lazy on JS to help js linker
1 parent 3e60227 commit 6234cd9

File tree

3 files changed

+44
-13
lines changed

3 files changed

+44
-13
lines changed

Base/src/main/scala-2/package.scala

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package name.rayrobdod
33
import scala.reflect.api.Universe
44
import scala.reflect.macros.blackbox.Context
55
import scala.Predef._
6+
import com.eed3si9n.ifdef.ifdef
7+
import com.eed3si9n.ifdef.ifndef
68

79
/**
810
* A library for implementing custom string interpolation implementations using Parser Combinators
@@ -14,9 +16,26 @@ package object stringContextParserCombinator {
1416
type IdToExpr[A] = =:=[A, A]
1517
implicit val given_IdCtx: IdCtx = new IdCtx()
1618

19+
@scala.annotation.nowarn("msg=unused")
20+
@ifdef("always")
21+
private def __do_not_warn_about_unused_ifdef = 0
22+
23+
@scala.annotation.nowarn("msg=unused")
24+
@ifndef("never")
25+
private def __do_not_warn_about_unused_ifndef = 0
26+
27+
@ifndef("platform:js")
28+
private[stringContextParserCombinator]
29+
val Name: Unapply.Fixed[Universe#Name, String] = {
30+
(input:Universe#Name) => Option(input.decodedName.toString)
31+
}
32+
33+
// needs to be lazy so that the js linker can elide the calls to the
34+
// "non-existent method scala.reflect.api.Names$NameApi.decodedName()"
35+
@ifdef("platform:js")
1736
private[stringContextParserCombinator]
18-
val Name = new Unapply.Fixed[Universe#Name, String] {
19-
def unapply(input:Universe#Name):Option[String] = Option(input.decodedName.toString)
37+
lazy val Name: Unapply.Fixed[Universe#Name, String] = {
38+
(input:Universe#Name) => Option(input.decodedName.toString)
2039
}
2140

2241
private[stringContextParserCombinator]

build.sbt

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ lazy val sharedSettings = Seq(
3838
org.typelevel.scalacoptions.ScalacOptions.warnUnusedNoWarn,
3939
org.typelevel.scalacoptions.ScalacOptions.privateWarnUnusedNoWarn,
4040
),
41+
Compile / ifDefDeclarations ++= Seq("always"),
4142
Compile / ifDefDeclarations ++= (scalaBinaryVersion.value match {
4243
case "2.12" | "2.13" =>
4344
Seq("scalaEpochVersion:2")
@@ -98,6 +99,7 @@ lazy val sharedJsSettings = Seq(
9899
),
99100
)
100101
},
102+
Compile / ifDefDeclarations ++= Seq("platform:js"),
101103
)
102104

103105
lazy val base = (projectMatrix in file("Base"))
@@ -167,11 +169,16 @@ lazy val base = (projectMatrix in file("Base"))
167169
).asJava)
168170
},
169171
)
170-
.jvmPlatform(scalaVersions = Seq(
171-
scala212Ver,
172-
scala213Ver,
173-
scala3Ver,
174-
))
172+
.jvmPlatform(
173+
scalaVersions = Seq(
174+
scala212Ver,
175+
scala213Ver,
176+
scala3Ver,
177+
),
178+
Seq(
179+
Compile / ifDefDeclarations ++= Seq("platform:jvm"),
180+
),
181+
)
175182
.jsPlatform(
176183
scalaVersions = Seq(
177184
scala212Ver,
@@ -180,11 +187,16 @@ lazy val base = (projectMatrix in file("Base"))
180187
),
181188
sharedJsSettings,
182189
)
183-
.nativePlatform(scalaVersions = Seq(
184-
scala212Ver,
185-
scala213Ver,
186-
scala3Ver,
187-
))
190+
.nativePlatform(
191+
scalaVersions = Seq(
192+
scala212Ver,
193+
scala213Ver,
194+
scala3Ver,
195+
),
196+
Seq(
197+
Compile / ifDefDeclarations ++= Seq("platform:native"),
198+
),
199+
)
188200

189201
lazy val json = (projectMatrix in file("JsonParser"))
190202
.dependsOn(base)

project/plugins.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % "0.11.0")
33
addSbtPlugin("com.eed3si9n.ifdef" % "sbt-ifdef" % "0.4.1")
44
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.11.2")
55
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.4")
6-
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.18.2")
6+
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.20.1")
77
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.8")
88
addSbtPlugin("org.typelevel" % "sbt-tpolecat" % "0.5.2")

0 commit comments

Comments
 (0)