Skip to content

Commit fdb3caa

Browse files
Duhemmallanrenucci
authored andcommitted
Address review comments
1 parent e3dcf66 commit fdb3caa

File tree

2 files changed

+32
-32
lines changed

2 files changed

+32
-32
lines changed

project/Build.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ object Build {
212212

213213
// Avoid having to run `dotty-sbt-bridge/publishLocal` before compiling a bootstrapped project
214214
scalaCompilerBridgeSource :=
215-
(dottyOrganization %% "dotty-sbt-bridge" % "NOT_PUBLISHED")
215+
(dottyOrganization %% "dotty-sbt-bridge" % dottyVersion)
216216
.artifacts(Artifact.sources("dotty-sbt-bridge").withUrl(
217217
// We cannot use the `packageSrc` task because a setting cannot depend
218218
// on a task. Instead, we make `compile` below depend on the bridge `packageSrc`
@@ -251,7 +251,7 @@ object Build {
251251
Seq(
252252
dottyOrganization % "dotty-library_2.11" % dottyNonBootstrappedVersion % Configurations.ScalaTool.name,
253253
dottyOrganization % "dotty-compiler_2.11" % dottyNonBootstrappedVersion % Configurations.ScalaTool.name
254-
)//.map(_.withDottyCompat(scalaVersion.value))
254+
).map(_.withDottyCompat(scalaVersion.value))
255255
else
256256
Seq()
257257
},

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

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -51,43 +51,43 @@ object DottyPlugin extends AutoPlugin {
5151
nightly
5252
}
5353

54-
implicit class DottyCompatModuleID(moduleID: ModuleID) {
55-
/** If this ModuleID cross-version is a Dotty version, replace it
56-
* by the Scala 2.x version that the Dotty version is retro-compatible with,
57-
* otherwise do nothing.
58-
*
59-
* This setting is useful when your build contains dependencies that have only
60-
* been published with Scala 2.x, if you have:
61-
* {{{
62-
* libraryDependencies += "a" %% "b" % "c"
63-
* }}}
64-
* you can replace it by:
65-
* {{{
66-
* libraryDependencies += ("a" %% "b" % "c").withDottyCompat(scalaVersion.value)
67-
* }}}
68-
* This will have no effect when compiling with Scala 2.x, but when compiling
69-
* with Dotty this will change the cross-version to a Scala 2.x one. This
70-
* works because Dotty is currently retro-compatible with Scala 2.x.
71-
*
72-
* NOTE: Dotty's retro-compatibility with Scala 2.x will be dropped before
73-
* Dotty is released, you should not rely on it.
74-
*/
75-
def withDottyCompat(scalaVersion: String): ModuleID =
76-
moduleID.crossVersion match {
77-
case _: librarymanagement.Binary if scalaVersion.startsWith("0.") =>
78-
moduleID.cross(CrossVersion.constant("2.12"))
79-
case _ =>
80-
moduleID
81-
}
82-
}
54+
implicit class DottyCompatModuleID(moduleID: ModuleID) {
55+
/** If this ModuleID cross-version is a Dotty version, replace it
56+
* by the Scala 2.x version that the Dotty version is retro-compatible with,
57+
* otherwise do nothing.
58+
*
59+
* This setting is useful when your build contains dependencies that have only
60+
* been published with Scala 2.x, if you have:
61+
* {{{
62+
* libraryDependencies += "a" %% "b" % "c"
63+
* }}}
64+
* you can replace it by:
65+
* {{{
66+
* libraryDependencies += ("a" %% "b" % "c").withDottyCompat(scalaVersion.value)
67+
* }}}
68+
* This will have no effect when compiling with Scala 2.x, but when compiling
69+
* with Dotty this will change the cross-version to a Scala 2.x one. This
70+
* works because Dotty is currently retro-compatible with Scala 2.x.
71+
*
72+
* NOTE: Dotty's retro-compatibility with Scala 2.x will be dropped before
73+
* Dotty is released, you should not rely on it.
74+
*/
75+
def withDottyCompat(scalaVersion: String): ModuleID =
76+
moduleID.crossVersion match {
77+
case _: librarymanagement.Binary if scalaVersion.startsWith("0.") =>
78+
moduleID.cross(CrossVersion.constant("2.12"))
79+
case _ =>
80+
moduleID
81+
}
82+
}
8383
}
8484

8585
import autoImport._
8686

8787
override def requires: Plugins = plugins.JvmPlugin
8888
override def trigger = allRequirements
8989

90-
// Adapted from CrossVersioconstant nUtil#sbtApiVersion
90+
// Adapted from CrossVersionUtil#sbtApiVersion
9191
private def sbtFullVersion(v: String): Option[(Int, Int, Int)] =
9292
{
9393
val ReleaseV = """(\d+)\.(\d+)\.(\d+)(-\d+)?""".r

0 commit comments

Comments
 (0)