Skip to content

Commit 08dda0d

Browse files
authored
Merge pull request #12195 from smarter/require-sbt-1.5
sbt-dotty: Require sbt >= 1.5.0, deprecate withDottyCompat
2 parents 10b6ba5 + 2f40747 commit 08dda0d

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

project/Build.scala

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ abstract class DottyJSPlugin(settings: Seq[Setting[_]]) extends AutoPlugin {
5151
_.filter(!_.name.startsWith("junit-interface"))
5252
},
5353
libraryDependencies +=
54-
("org.scala-js" %% "scalajs-junit-test-runtime" % scalaJSVersion % "test").withDottyCompat(scalaVersion.value),
54+
("org.scala-js" %% "scalajs-junit-test-runtime" % scalaJSVersion % "test").cross(CrossVersion.for3Use2_13),
5555

5656
// Typecheck the Scala.js IR found on the classpath
5757
scalaJSLinkerConfig ~= (_.withCheckIR(true)),
@@ -610,7 +610,7 @@ object Build {
610610
ivyConfigurations += SourceDeps.hide,
611611
transitiveClassifiers := Seq("sources"),
612612
libraryDependencies +=
613-
("org.scala-js" %% "scalajs-ir" % scalaJSVersion % "sourcedeps").withDottyCompat(scalaVersion.value),
613+
("org.scala-js" %% "scalajs-ir" % scalaJSVersion % "sourcedeps").cross(CrossVersion.for3Use2_13),
614614
(Compile / sourceGenerators) += Def.task {
615615
val s = streams.value
616616
val cacheDir = s.cacheDirectory
@@ -720,9 +720,9 @@ object Build {
720720
enablePlugins(NonBootstrappedDottyJSPlugin).
721721
settings(
722722
libraryDependencies +=
723-
("org.scala-js" %% "scalajs-library" % scalaJSVersion).withDottyCompat(scalaVersion.value),
724-
unmanagedSourceDirectories in Compile :=
725-
(unmanagedSourceDirectories in (`scala3-library`, Compile)).value
723+
("org.scala-js" %% "scalajs-library" % scalaJSVersion).cross(CrossVersion.for3Use2_13),
724+
Compile / unmanagedSourceDirectories :=
725+
(`scala3-library` / Compile / unmanagedSourceDirectories).value
726726
)
727727

728728
/** The dotty standard library compiled with the Scala.js back-end, to produce
@@ -739,7 +739,7 @@ object Build {
739739
enablePlugins(BootstrappedDottyJSPlugin).
740740
settings(
741741
libraryDependencies +=
742-
("org.scala-js" %% "scalajs-library" % scalaJSVersion).withDottyCompat(scalaVersion.value),
742+
("org.scala-js" %% "scalajs-library" % scalaJSVersion).cross(CrossVersion.for3Use2_13),
743743
Compile / unmanagedSourceDirectories ++=
744744
(`scala3-library-bootstrapped` / Compile / unmanagedSourceDirectories).value,
745745

@@ -1071,7 +1071,7 @@ object Build {
10711071

10721072
// We need JUnit in the Compile configuration
10731073
libraryDependencies +=
1074-
("org.scala-js" %% "scalajs-junit-test-runtime" % scalaJSVersion).withDottyCompat(scalaVersion.value),
1074+
("org.scala-js" %% "scalajs-junit-test-runtime" % scalaJSVersion).cross(CrossVersion.for3Use2_13),
10751075

10761076
(Compile / sourceGenerators) += Def.task {
10771077
import org.scalajs.linker.interface.CheckedBehavior
@@ -1740,7 +1740,7 @@ object Build {
17401740
pr.settings(
17411741
Test / fork := false,
17421742
scalaJSUseMainModuleInitializer := true,
1743-
libraryDependencies += ("org.scala-js" %%% "scalajs-dom" % "1.1.0").withDottyCompat(scalaVersion.value)
1743+
libraryDependencies += ("org.scala-js" %%% "scalajs-dom" % "1.1.0").cross(CrossVersion.for3Use2_13)
17441744
)
17451745
}
17461746

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import java.util.Optional
1616
import java.util.{Enumeration, Collections}
1717
import java.net.URL
1818
import scala.util.Properties.isJavaAtLeast
19-
19+
import scala.annotation.nowarn
2020

2121
object DottyPlugin extends AutoPlugin {
2222
object autoImport {
@@ -106,6 +106,7 @@ object DottyPlugin extends AutoPlugin {
106106
* libraryDependencies ~= (_.map(_.withDottyCompat(scalaVersion.value)))
107107
* }}}
108108
*/
109+
@deprecated("Use `.cross(CrossVersion.for3Use2_13)` instead, available in sbt >= 1.5.0 (cf https://eed3si9n.com/sbt-1.5.0)", "0.5.5")
109110
def withDottyCompat(scalaVersion: String): ModuleID = {
110111
val name = moduleID.name
111112
if (name != "scala3-library" && name != "scala3-compiler" &&
@@ -181,10 +182,12 @@ object DottyPlugin extends AutoPlugin {
181182
if (!VersionNumber(sbtV).matchesSemVer(SemanticSelector(requiredVersion)))
182183
sys.error(s"The sbt-dotty plugin cannot work with this version of sbt ($sbtV), sbt $requiredVersion is required.")
183184

184-
val deprecatedVersion = ">=1.5.0-RC2"
185+
val deprecatedVersion = ">=1.5.0"
185186
val logger = sLog.value
186-
if (VersionNumber(sbtV).matchesSemVer(SemanticSelector(deprecatedVersion)))
187-
logger.warn(s"The sbt-dotty plugin is no longer neeeded with sbt >= 1.5, please remove it from your build.")
187+
if (VersionNumber(sbtV).matchesSemVer(SemanticSelector(deprecatedVersion))) {
188+
logger.warn(s"The sbt-dotty plugin is no longer neeeded with sbt >= 1.5.0, please remove it from your build.")
189+
logger.warn(s"For more information, see https://eed3si9n.com/sbt-1.5.0")
190+
}
188191

189192
state
190193
}
@@ -434,7 +437,7 @@ object DottyPlugin extends AutoPlugin {
434437
// Apply withDottyCompat to the dependency on scalajs-test-bridge
435438
.map { moduleID =>
436439
if (moduleID.organization == "org.scala-js" && moduleID.name == "scalajs-test-bridge")
437-
moduleID.withDottyCompat(scalaVersion.value)
440+
moduleID.withDottyCompat(scalaVersion.value): @nowarn
438441
else
439442
moduleID
440443
}

0 commit comments

Comments
 (0)