Skip to content

Commit e96b422

Browse files
Fix scala#17119: Download Coursier from GitHub directly
git.io is a URL shortener which, it seems, is unreliable.
1 parent 1f574e8 commit e96b422

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

compiler/test-coursier/dotty/tools/coursier/CoursierScalaTests.scala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,16 @@ object CoursierScalaTests:
170170

171171
/** Get coursier script */
172172
@BeforeClass def setup(): Unit =
173-
val ver = execCmd("uname")._2.head.replace('L', 'l').replace('D', 'd')
173+
val launcherLocation = "https://github.com/coursier/launchers/raw/master"
174+
val launcherName = execCmd("uname")._2.head.toLowerCase match
175+
case "linux" => "cs-x86_64-pc-linux"
176+
case "darwin" => "cs-x86_64-apple-darwin"
177+
case other => fail(s"Unsupported OS for coursier launcher: $other")
174178

175179
def runAndCheckCmd(cmd: String, options: String*): Unit =
176180
val (code, out) = execCmd(cmd, options*)
177181
if code != 0 then
178182
fail(s"Failed to run $cmd ${options.mkString(" ")}, exit code: $code, output: ${out.mkString("\n")}")
179183

180-
runAndCheckCmd("curl", s"-fLo cs https://git.io/coursier-cli-$ver")
184+
runAndCheckCmd("curl", s"-fLo cs $launcherLocation/$launcherName")
181185
runAndCheckCmd("chmod", "+x cs")

0 commit comments

Comments
 (0)