Skip to content

Commit af7a49f

Browse files
Merge pull request #6560 from dotty-staging/nightly-hotfix
Hotfix for SBT plugin
2 parents a54d6f0 + 82d4093 commit af7a49f

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,18 @@ object DottyPlugin extends AutoPlugin {
2828
val nightly = try {
2929
// get majorVersion from dotty.epfl.ch
3030
val source0 = Source.fromURL("http://dotty.epfl.ch/versions/latest-nightly-base")
31-
val majorVersion = source0.getLines().toSeq.head
31+
val majorVersionFromWebsite = source0.getLines().toSeq.head
3232
source0.close()
3333

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

0 commit comments

Comments
 (0)