Skip to content

Hotfix for SBT plugin #6560

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 24, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions sbt-dotty/src/dotty/tools/sbtplugin/DottyPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,18 @@ object DottyPlugin extends AutoPlugin {
val nightly = try {
// get majorVersion from dotty.epfl.ch
val source0 = Source.fromURL("http://dotty.epfl.ch/versions/latest-nightly-base")
val majorVersion = source0.getLines().toSeq.head
val majorVersionFromWebsite = source0.getLines().toSeq.head
source0.close()

// get latest nightly version from maven
val source1 =
Source.fromURL(s"http://repo1.maven.org/maven2/ch/epfl/lamp/dotty_$majorVersion/maven-metadata.xml")
def fetchSource(version: String): (scala.io.BufferedSource, String) =
try Source.fromURL(s"http://repo1.maven.org/maven2/ch/epfl/lamp/dotty_$version/maven-metadata.xml") -> version
catch { case t: java.io.FileNotFoundException =>
val major :: minor :: Nil = version.split('.').toList
if (minor.toInt <= 0) throw t
else fetchSource(s"$major.${minor.toInt - 1}")
}
val (source1, majorVersion) = fetchSource(majorVersionFromWebsite)
val Version = s" <version>($majorVersion\\..*-bin.*)</version>".r
val nightly = source1
.getLines()
Expand Down