File tree 1 file changed +9
-3
lines changed
sbt-dotty/src/dotty/tools/sbtplugin 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 {
28
28
val nightly = try {
29
29
// get majorVersion from dotty.epfl.ch
30
30
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
32
32
source0.close()
33
33
34
34
// 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)
37
43
val Version = s " <version>( $majorVersion\\ ..*-bin.*)</version> " .r
38
44
val nightly = source1
39
45
.getLines()
You can’t perform that action at this time.
0 commit comments