Skip to content

Instantly share code, notes, and snippets.

@udalov
Last active September 3, 2023 22:12
Show Gist options
  • Save udalov/c1e811446cb9dd7f29ee10a3254576fa to your computer and use it in GitHub Desktop.
Save udalov/c1e811446cb9dd7f29ee10a3254576fa to your computer and use it in GitHub Desktop.
download-old-kotlin-compilers
#!/usr/bin/env bash
set -e
if uname | grep -q Darwin; then
# Use Homebrew's coreutils on macOS (run `brew install coreutils`).
TOUCH=gtouch
STAT=gstat
else
TOUCH=touch
STAT=stat
fi
download_old_compiler() {
echo -n "$1 "
if [ -e kotlin-$1 ]; then echo "exists"; return; fi
link="https://github.com/JetBrains/kotlin/releases/download/$2/kotlin-compiler-$1.zip"
wget --quiet $link -O kotlinc-$1.zip
if [ -e kotlinc ]; then echo "fatal: kotlinc exists."; exit 1; fi
unzip -q kotlinc-$1.zip
mv kotlinc kotlin-$1
find kotlin-$1 -exec $TOUCH -d @$($STAT -c %Y kotlinc-$1.zip) {} +
rm kotlinc-$1.zip
echo "OK"
}
versions="
1.0.3 1.0.4 1.0.5 1.0.6 1.0.7
1.1 1.1.1 1.1.2-2 1.1.3-2 1.1.4-3 1.1.51 1.1.61
1.2.0 1.2.10 1.2.21 1.2.31 1.2.41 1.2.51 1.2.61 1.2.71
1.3.0 1.3.11 1.3.21 1.3.31 1.3.41 1.3.50 1.3.61 1.3.72
1.4.0 1.4.10 1.4.21 1.4.30
1.5.0 1.5.10 1.5.20 1.5.30
1.6.0 1.6.10 1.6.21
1.7.0 1.7.10 1.7.21
1.8.0 1.8.10 1.8.21
1.9.0
"
download_old_compiler 1.0.0 build-1.0.0
download_old_compiler 1.0.1 1.0.1
download_old_compiler 1.0.2 1.0.2
for version in $versions; do download_old_compiler $version "v$version"; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment