Skip to content

Commit b8e56b7

Browse files
committed
Make withDottyCompat() the identity on non-crossversioned ModuleIDs
This way you can do for example: libraryDependencies ~= (_.map(_.withDottyCompat()))
1 parent 4035706 commit b8e56b7

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

sbt-dotty/src/dotty/tools/sbtplugin/DottyPlugin.scala

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ object DottyPlugin extends AutoPlugin {
2727

2828
implicit class DottyCompatModuleID(moduleID: ModuleID) {
2929
/** If this ModuleID cross-version is a Dotty version, replace it
30-
* by the Scala 2.x version that the Dotty version is retro-compatible with.
30+
* by the Scala 2.x version that the Dotty version is retro-compatible with,
31+
* otherwise do nothing.
3132
*
3233
* This setting is useful when your build contains dependencies that have only
3334
* been published with Scala 2.x, if you have:
@@ -46,10 +47,15 @@ object DottyPlugin extends AutoPlugin {
4647
* Dotty is released, you should not rely on it.
4748
*/
4849
def withDottyCompat(): ModuleID =
49-
moduleID.cross(CrossVersion.binaryMapped {
50-
case version if version.startsWith("0.") => "2.11"
51-
case version => version
52-
})
50+
moduleID.crossVersion match {
51+
case _: CrossVersion.Binary =>
52+
moduleID.cross(CrossVersion.binaryMapped {
53+
case version if version.startsWith("0.") => "2.11"
54+
case version => version
55+
})
56+
case _ =>
57+
moduleID
58+
}
5359
}
5460
}
5561

0 commit comments

Comments
 (0)