Skip to content

Commit 9b8433b

Browse files
authored
Add optimizations during compilation
1 parent 080b9ab commit 9b8433b

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

build.sbt

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ lazy val commonSettings = Seq(
2727
"-unchecked",
2828
"-Xmacro-settings:" + sys.props.getOrElse("macro.settings", "none")
2929
) ++ (CrossVersion.partialVersion(scalaVersion.value) match {
30-
case Some((2, 12)) => Seq("-language:higherKinds")
31-
case Some((3, _)) => Seq("-Xcheck-macros", "-explain")
32-
case _ => Seq()
30+
case Some((2, 12)) => Seq("-language:higherKinds", "-opt:l:method")
31+
case Some((2, 13)) => Seq("-opt:l:method")
32+
case _ => Seq("-Xcheck-macros", "-explain")
3333
}),
3434
compileOrder := CompileOrder.JavaThenScala,
3535
Test / testOptions += Tests.Argument("-oDF"),
@@ -51,14 +51,19 @@ lazy val commonSettings = Seq(
5151
)
5252

5353
lazy val jsSettings = Seq(
54-
scalacOptions += {
54+
scalacOptions ++= {
5555
val localSourcesPath = (LocalRootProject / baseDirectory).value.toURI
5656
val remoteSourcesPath = s"https://raw.githubusercontent.com/plokhotnyuk/jsoniter-scala/${git.gitHeadCommit.value.get}/"
57-
val sourcesOptionName = CrossVersion.partialVersion(scalaVersion.value) match {
58-
case Some((2, _)) => "-P:scalajs:mapSourceURI"
59-
case _ => "-scalajs-mapSourceURI"
57+
CrossVersion.partialVersion(scalaVersion.value) match {
58+
case Some((2, _)) => Seq(
59+
s"-P:scalajs:mapSourceURI:$localSourcesPath->$remoteSourcesPath",
60+
"-P:scalajs:genStaticForwardersForNonTopLevelObjects"
61+
)
62+
case _ => Seq(
63+
s"-scalajs-mapSourceURI:$localSourcesPath->$remoteSourcesPath",
64+
"-scalajs-genStaticForwardersForNonTopLevelObjects"
65+
)
6066
}
61-
s"$sourcesOptionName:$localSourcesPath->$remoteSourcesPath"
6267
},
6368
libraryDependencies ++= Seq(
6469
"io.github.cquiroz" %%% "scala-java-time-tzdb" % "2.5.0" % Test
@@ -81,6 +86,10 @@ lazy val jsSettings = Seq(
8186
)
8287

8388
lazy val nativeSettings = Seq(
89+
scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match {
90+
case Some((2, _)) => Seq("-P:scalanative:genStaticForwardersForNonTopLevelObjects")
91+
case _ => Seq("-scalanative-genStaticForwardersForNonTopLevelObjects")
92+
}),
8493
libraryDependencies ++= Seq(
8594
"io.github.cquiroz" %%% "scala-java-time-tzdb" % "2.5.0" % Test
8695
),

0 commit comments

Comments
 (0)