diff --git a/project/deps.sc b/project/deps.sc index 7c1db6568b..50506c0bc6 100644 --- a/project/deps.sc +++ b/project/deps.sc @@ -278,9 +278,9 @@ def buildCsVersion = Deps.Versions.coursierCli def buildCsM1Version = Deps.Versions.coursierM1Cli // Native library used to encrypt GitHub secrets -def libsodiumVersion = "1.0.18" +def libsodiumVersion = "1.0.20" // Using the libsodium static library from this Alpine version (in the static launcher) -def alpineVersion = "3.15" +def alpineVersion = "3.21" object Docker { def customMuslBuilderImageName = "scala-cli-base-musl" diff --git a/project/settings.sc b/project/settings.sc index ff6a6278a9..a40ad54ccf 100644 --- a/project/settings.sc +++ b/project/settings.sc @@ -231,12 +231,29 @@ trait CliLaunchers extends SbtModule { self => os.copy.over(libPath, destDir / s"${prefix}sodiumjni.$ext") } private def copyLibsodiumStaticTo(cs: String, destDir: os.Path): Unit = { - val dirRes = os.proc( - cs, - "get", - "--archive", - "https://download.libsodium.org/libsodium/releases/libsodium-1.0.18-stable-msvc.zip" - ).call() + val dirRes = { + val stable = os.proc( + cs, + "get", + "--archive", + s"https://download.libsodium.org/libsodium/releases/libsodium-$libsodiumVersion-stable-msvc.zip" + ).call(check = false) + if (stable.exitCode == 0) stable + else { + System.err.println( + s"Failed to download stable libsodium $libsodiumVersion from https://download.libsodium.org/libsodium/releases" + ) + System.err.println( + "falling back to https://github.com/jedisct1/libsodium/releases *-RELEASE" + ) + os.proc( // fallback to GitHuB *-RELEASE version + cs, + "get", + "--archive", + s"https://github.com/jedisct1/libsodium/releases/download/$libsodiumVersion-RELEASE/libsodium-$libsodiumVersion-msvc.zip" + ).call() + } + } val dir = os.Path(dirRes.out.trim(), os.pwd) os.copy.over( dir / "libsodium" / "x64" / "Release" / "v143" / "static" / "libsodium.lib",