File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
sbt-dotty/src/dotty/tools/sbtplugin Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff 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()
You can’t perform that action at this time.
0 commit comments