Skip to content

Commit

Permalink
chore: Fix listing release versions for bisect script. (#19356)
Browse files Browse the repository at this point in the history
Use `maven-metadata.xml` to list released Scala versions instead of parsing HTML of Maven index.
  • Loading branch information
WojciechMazur authored Jan 9, 2024
1 parent 65fca39 commit 5346c99
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions project/scripts/bisect.scala
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,13 @@ class Releases(val releases: Vector[Release])

object Releases:
lazy val allReleases: Vector[Release] =
val re = raw"""(?<=title=")(.+-bin-\d{8}-\w{7}-NIGHTLY)(?=/")""".r
val html = Source.fromURL("https://repo1.maven.org/maven2/org/scala-lang/scala3-compiler_3/")
re.findAllIn(html.mkString).map(Release.apply).toVector
val re = raw"<version>(.+-bin-\d{8}-\w{7}-NIGHTLY)</version>".r
val xml = io.Source.fromURL(
"https://repo1.maven.org/maven2/org/scala-lang/scala3-compiler_3/maven-metadata.xml"
)
re.findAllMatchIn(xml.mkString)
.flatMap{ m => Option(m.group(1)).map(Release.apply) }
.toVector

def fromRange(range: ReleasesRange): Vector[Release] = range.filter(allReleases)

Expand Down

0 comments on commit 5346c99

Please sign in to comment.