Skip to content

Commit 98e0875

Browse files
authored
Merge pull request #5093 from sjrd/ignore-deprecation-of-anyrefmap
Ignore the deprecation of mutable.AnyRefMap in Scala 2.13.16+.
2 parents 25b2725 + cebcd0a commit 98e0875

File tree

1 file changed

+23
-11
lines changed

1 file changed

+23
-11
lines changed

project/Build.scala

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,20 @@ object Build {
482482
},
483483
)
484484

485+
def addWconfSettingIf2_13(conf: String): Def.Setting[_] = {
486+
scalacOptions ++= {
487+
/* We exclude 2.13.0 and 2.13.1 because they did not support -Wconf yet.
488+
* Fortunately, our use cases for -Wconf are only triggered with later
489+
* versions.
490+
*/
491+
val v = scalaVersion.value
492+
if (v.startsWith("2.13.") && v != "2.13.0" && v != "2.13.1")
493+
List("-Wconf:" + conf)
494+
else
495+
Nil
496+
}
497+
}
498+
485499
val commonSettings = Seq(
486500
organization := "org.scala-js",
487501
version := scalaJSVersion,
@@ -517,6 +531,14 @@ object Build {
517531
"-encoding", "utf8"
518532
),
519533

534+
/* Ignore the deprecation of mutable.AnyRefMap in Scala 2.13.16+.
535+
* It was deprecated because mutable.HashMap is just as fast, starting
536+
* from 2.13.0. However we still use it for performance in Scala 2.12.x,
537+
* which is important because that's the version of the linker used by
538+
* the sbt plugin.
539+
*/
540+
addWconfSettingIf2_13("cat=deprecation&origin=scala\\.collection\\.mutable\\.AnyRefMap.*:s"),
541+
520542
scalastyleCheck := Def.task {
521543
val _ = (scalastyle in Compile).toTask("").value
522544
(scalastyle in Test).toTask("").value
@@ -1816,17 +1838,7 @@ object Build {
18161838
/* Silence a Scala 2.13.13+ warning that we cannot address without breaking our API.
18171839
* See `js.WrappedDictionary.keys` and `js.WrappedMap.keys`.
18181840
*/
1819-
scalacOptions ++= {
1820-
/* We only need the option in 2.13.13+, but listing all previous 2.13.x
1821-
* versions is cumberson. We only exclude 2.13.0 and 2.13.1 because
1822-
* they did not support -Wconf at all.
1823-
*/
1824-
val v = scalaVersion.value
1825-
if (v.startsWith("2.13.") && v != "2.13.0" && v != "2.13.1")
1826-
List("-Wconf:msg=overriding method keys in trait MapOps is deprecated:s")
1827-
else
1828-
Nil
1829-
},
1841+
addWconfSettingIf2_13("msg=overriding method keys in trait MapOps is deprecated:s"),
18301842

18311843
test in Test := {
18321844
streams.value.log.warn("Skipping library/test. Run testSuite/test to test library.")

0 commit comments

Comments
 (0)