From ca8b670eac0b0def66249738e52ef8137d30a8b5 Mon Sep 17 00:00:00 2001 From: Jiuyang Liu Date: Sun, 4 Apr 2021 13:32:20 +0800 Subject: Fix mill cache download (#2171) --- build.sc | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/build.sc b/build.sc index 4ac60a51..ec154b89 100644 --- a/build.sc +++ b/build.sc @@ -97,7 +97,9 @@ class firrtlCrossModule(val crossScalaVersion: String) extends CrossSbtModule wi } def downloadAntlr4Jar = T.persistent { - Util.download(s"https://www.antlr.org/download/antlr-$antlr4Version-complete.jar") + if (!os.isFile( T.ctx.dest / "antlr4" )) + Util.download(s"https://www.antlr.org/download/antlr-$antlr4Version-complete.jar", os.rel / "antlr4") + PathRef(T.ctx.dest / "antlr4") } def generatedAntlr4Source = T.sources { @@ -155,16 +157,20 @@ class firrtlCrossModule(val crossScalaVersion: String) extends CrossSbtModule wi else throw new Exception("mill cannot detect your architecture of your Windows") else throw new Exception("mill cannot detect your operation system.") - val zip = Util.downloadUnpackZip( - s"https://github.com/protocolbuffers/protobuf/releases/download/v$protocVersion/protoc-$protocVersion-$protocBinary.zip" - ) + val unpackPath = os.rel / "unpacked" + val bin = if(isWindows) - zip.path / "bin" / "protoc.exe" + T.ctx.dest / unpackPath / "bin" / "protoc.exe" else - zip.path / "bin" / "protoc" + T.ctx.dest / unpackPath / "bin" / "protoc" + if (!os.exists(bin)) + Util.downloadUnpackZip( + s"https://github.com/protocolbuffers/protobuf/releases/download/v$protocVersion/protoc-$protocVersion-$protocBinary.zip", + unpackPath + ) // Download Linux/Mac binary doesn't have x. - if (!isWindows) os.perms.set(bin, "--x------") + if (!isWindows) os.perms.set(bin, "rwx------") PathRef(bin) } -- cgit v1.2.3