From 478f5157f406bfd474e430bd72785c5c3df295d7 Mon Sep 17 00:00:00 2001 From: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Date: Fri, 12 Jan 2024 23:43:45 -0800 Subject: [PATCH 1/2] Add `zig.exe` as a symlink of `zig` on posix --- scripts/download-zig.sh | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/scripts/download-zig.sh b/scripts/download-zig.sh index 41f7442fe81877..03c1b74ef877f2 100755 --- a/scripts/download-zig.sh +++ b/scripts/download-zig.sh @@ -16,30 +16,30 @@ fi case $(uname -ms) in 'Darwin x86_64') - target='macos' - arch='x86_64' - ;; + target='macos' + arch='x86_64' + ;; 'Darwin arm64') - target='macos' - arch='aarch64' - ;; + target='macos' + arch='aarch64' + ;; 'Linux aarch64' | 'Linux arm64') - target='linux' - arch='aarch64' - ;; + target='linux' + arch='aarch64' + ;; 'Linux x86_64') - target='linux' - arch='x86_64' - ;; + target='linux' + arch='x86_64' + ;; *) - printf "error: cannot get platform name from '%s'\n" "${unamestr}" - exit 1 - ;; + printf "error: cannot get platform name from '%s'\n" "${unamestr}" + exit 1 + ;; esac url="https://ziglang.org/builds/zig-${target}-${arch}-${zig_version}.tar.xz" -dest=".cache/zig-${zig_version}.tar.xz" -extract_at=".cache/zig" +dest="$(pwd)/.cache/zig-${zig_version}.tar.xz" +extract_at="$(pwd)/.cache/zig" mkdir -p ".cache" @@ -50,7 +50,7 @@ update_repo_if_needed() { Dockerfile scripts/download-zig.ps1 .github/workflows/* - ); + ) zig_version_previous=$(grep 'recommended_zig_version = "' "build.zig" | cut -d'"' -f2) @@ -59,6 +59,11 @@ update_repo_if_needed() { done printf "Zig was updated to ${zig_version}. Please commit new files." + + # symlink extracted zig to extracted zig.exe + ln -sf "${extract_at}/zig" "${extract_at}/zig.exe" + chmod +x "${extract_at}/zig.exe" + fi } From 0cdc26016555772978cafe30a5c00cbf80c0ea4b Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Fri, 12 Jan 2024 23:52:02 -0800 Subject: [PATCH 2/2] Update scripts/download-zig.sh Co-authored-by: dave caruso --- scripts/download-zig.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/download-zig.sh b/scripts/download-zig.sh index 03c1b74ef877f2..cec996d47d7005 100755 --- a/scripts/download-zig.sh +++ b/scripts/download-zig.sh @@ -61,6 +61,7 @@ update_repo_if_needed() { printf "Zig was updated to ${zig_version}. Please commit new files." # symlink extracted zig to extracted zig.exe + # TODO: Workaround for https://github.com/ziglang/vscode-zig/issues/164 ln -sf "${extract_at}/zig" "${extract_at}/zig.exe" chmod +x "${extract_at}/zig.exe"