Skip to content

Commit ec4bb76

Browse files
committed
[TECH] Enchance swiftormat script
1 parent efca4fd commit ec4bb76

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

scripts/runSwiftFormat.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ SWIFT_VERSION=5.9
55
cd "$(dirname "$0")"
66

77
function downloadAndUnzip {
8-
curl -L -o tool.zip $2
8+
echo "Downloading SwiftFormat from: $2"
9+
curl -L -f --retry 3 --retry-delay 1 -o tool.zip "$2"
10+
echo "Downloaded file size: $(ls -lh tool.zip | awk '{print $5}')"
911
unzip -o -d $1/ tool.zip
1012
rm tool.zip
1113
}
@@ -18,12 +20,24 @@ if ! which bin/swiftformat >/dev/null; then
1820
rm -r ./*
1921

2022
downloadAndUnzip "SwiftFormatTmp" "https://github.com/nicklockwood/SwiftFormat/releases/download/0.57.2/swiftformat.artifactbundle.zip"
23+
24+
# Verify the correct version was downloaded
25+
if [ ! -d "./SwiftFormatTmp/swiftformat.artifactbundle/swiftformat-0.57.2-macos" ]; then
26+
echo "ERROR: Expected SwiftFormat 0.57.2 but got different version!"
27+
echo "Available versions in bundle:"
28+
find ./SwiftFormatTmp -name "swiftformat-*" -type d
29+
exit 1
30+
fi
31+
2132
mv -f ./SwiftFormatTmp/swiftformat.artifactbundle/swiftformat-0.57.2-macos/bin/swiftformat .
2233
find . -name "*Tmp" -type d -prune -exec rm -rf '{}' +
2334
for entry in ./*
2435
do
2536
chmod +x "$entry"
2637
done
38+
39+
# Verify the installed version
40+
echo "Installed SwiftFormat version: $(./swiftformat --version)"
2741
cd ../
2842
fi
2943

0 commit comments

Comments
 (0)