Dotty: sbt-dotty does not load on sbt 1.3.0-SNAPSHOT

Created on 3 Jan 2019  路  8Comments  路  Source: lampepfl/dotty

steps

  1. Use addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.2.6") with sbt 1.3.0-SNAPSHOT.

problem

[error] java.lang.RuntimeException: The sbt-dotty plugin cannot work with this version of sbt (1.3.0-SNAPSHOT), sbt >= 1.1.5 is required.

expectation

sbt-dotty works with any sbt 1.x >= 1.1.5.

notes

https://github.com/lampepfl/dotty/blob/bcccb2f3ce83bb6bf12559c7ae018e0f12042d32/sbt-dotty/src/dotty/tools/sbtplugin/DottyPlugin.scala#L92-L104

NonReleaseV requires z to be > 0.

bug

All 8 comments

This is very weird, dotty itself and https://github.com/lampepfl/dotty-example-project use sbt 1.2.x without issues. In fact, I just tried changing the version that dotty-example-project uses to 1.2.8 and I did not encounter the error you're reporting, can you share the project ?

In there sbtMinor is hardcoded to 1.

It's not, if sbtMinor > 1 then the error is not displayed, so 1.2.x is fine.

Where I actually saw this was in scripted test. I figured it was anything above sbt 1.1.x, but maybe the problem is with -SNAPSHOT?

ah indeed, looks like sbtFullVersion will return None for 1.3.0-SNAPSHOT, the error should not be emitted if we couldn't parse the version number.

By the way it'd be nice if sbt provided something like sbtFullVersion so that I wouldn't have to implement it myself badly :).

Or maybe just a high-level mechanism to enforce that this plugin requires a particular minimum version of sbt.

I think https://github.com/sbt/librarymanagement/blob/develop/core/src/main/scala/sbt/librarymanagement/VersionNumber.scala has semver check.

scala> import sbt.librarymanagement.{ VersionNumber, SemanticSelector }
import sbt.librarymanagement.{VersionNumber, SemanticSelector}

scala> VersionNumber("2.12.5").matchesSemVer(SemanticSelector(">=2.12"))
res1: Boolean = true
scala> import sbt.librarymanagement.{ VersionNumber, SemanticSelector }
import sbt.librarymanagement.{VersionNumber, SemanticSelector}

scala> VersionNumber("1.3.0-SNAPSHOT").matchesSemVer(SemanticSelector(">=1.1.5"))
res0: Boolean = true

scala> VersionNumber("1.1.0").matchesSemVer(SemanticSelector(">=1.1.5"))
res1: Boolean = false

please do not use sbt any more .please change to gradle or maven .it will be better than stb....

Was this page helpful?
0 / 5 - 0 ratings