Skip to content

Commit c28ea78

Browse files
authored
Merge pull request #4327 from dotty-staging/sbt-plugin
Exit sbt when Dotty plugin is incompatible with sbt version
2 parents 72dfefb + c44ba4f commit c28ea78

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

project/Build.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,7 @@ object Build {
864864
settings(commonSettings).
865865
settings(
866866
version := {
867-
val base = "0.2.0"
867+
val base = "0.2.1"
868868
if (isRelease) base else base + "-SNAPSHOT"
869869
},
870870

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

+12
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,18 @@ object DottyPlugin extends AutoPlugin {
141141
incOptions.withExternalHooks(hooks)
142142
}
143143

144+
override val globalSettings: Seq[Def.Setting[_]] = Seq(
145+
onLoad in Global := onLoad.in(Global).value.andThen { state =>
146+
val sbtV = sbtVersion.value
147+
sbtFullVersion(sbtV) match {
148+
case Some((1, sbtMinor, sbtPatch)) if sbtMinor > 1 || (sbtMinor == 1 && sbtPatch >= 4) =>
149+
case _ =>
150+
sys.error(s"The sbt-dotty plugin cannot work with this version of sbt ($sbtV), sbt >= 1.1.4 is required.")
151+
}
152+
state
153+
}
154+
)
155+
144156
override def projectSettings: Seq[Setting[_]] = {
145157
Seq(
146158
isDotty := scalaVersion.value.startsWith("0."),

0 commit comments

Comments
 (0)