Skip to content

Commit

Permalink
Fix scala#17119: Download Coursier from GitHub directly
Browse files Browse the repository at this point in the history
git.io is a URL shortener which, it seems, is unreliable.
  • Loading branch information
anatoliykmetyuk committed Mar 23, 2023
1 parent 1f574e8 commit caa3023
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,16 @@ object CoursierScalaTests:

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

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

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

0 comments on commit caa3023

Please sign in to comment.