@@ -57,21 +57,33 @@ lazy val esClient = {
5757}
5858
5959lazy val NightlyReleases = {
60- val re = raw " (?<=title= $" ) (.+-bin-\d{8}-\w{7}-NIGHTLY)(?=/ $" ) " .r
61- val html = Source .fromURL(
62- " https://repo1.maven.org/maven2/org/scala-lang/scala3-compiler_3/"
60+ val regex = raw " <version> (.+-bin-\d{8}-\w{7}-NIGHTLY)</version> " .r
61+ val xml = io. Source .fromURL(
62+ " https://repo1.maven.org/maven2/org/scala-lang/scala3-compiler_3/maven-metadata.xml "
6363 )
64- re.findAllIn(html .mkString).toVector
64+ regex.findAllMatchIn(xml .mkString).map(_.group( 1 )).filter(_ != null ).toVector
6565}
6666
6767lazy val StableScalaVersions = {
68- val re = raw " (?<=title= $" ) (\d+\.\d+\.\d+(-RC\d+)?)(?=/ $" ) " .r
69- val html = Source .fromURL(
70- " https://repo1.maven.org/maven2/org/scala-lang/scala3-compiler_3/"
68+ val regex = raw " <version> (\d+\.\d+\.\d+(-RC\d+)?)</version> " .r
69+ val xml = io. Source .fromURL(
70+ " https://repo1.maven.org/maven2/org/scala-lang/scala3-compiler_3/maven-metadata.xml "
7171 )
72- re.findAllIn(html .mkString).toVector
72+ regex.findAllMatchIn(xml .mkString).map(_.group( 1 )).filter(_ != null ).toVector
7373}
74- lazy val PreviousScalaReleases = (StableScalaVersions ++ NightlyReleases ).sorted
74+ object ScalaVersionOrdering extends Ordering [String ] {
75+ object StableVersion {
76+ def unapply (v : String ): Option [String ] =
77+ if ! v.contains('-' ) && v.split('.' ).size == 3 then Some (v) else None
78+ }
79+ override def compare (x : String , y : String ): Int = (x, y) match {
80+ case (StableVersion (stable), other) if other.startsWith(stable) => 1
81+ case (other, StableVersion (stable)) if other.startsWith(stable) => - 1
82+ case _ => Ordering .String .compare(x, y)
83+ }
84+ }
85+ lazy val PreviousScalaReleases =
86+ (StableScalaVersions ++ NightlyReleases ).sorted(using ScalaVersionOrdering )
7587
7688// Report all community build filures for given Scala version
7789@ main def raportForScalaVersion (opts : String * ) = try {
0 commit comments