Files
runner-images/images/linux/scripts/installers/swift.sh
T

34 lines
1.3 KiB
Bash
Raw Normal View History

2020-10-07 13:49:40 +05:00
#!/bin/bash -e
2020-03-24 09:27:15 +03:00
################################################################################
## File: swift.sh
## Desc: Installs Swift
################################################################################
2021-03-30 15:23:57 +03:00
# Source the helpers for use with the script
source $HELPER_SCRIPTS/install.sh
2020-12-29 10:02:46 +03:00
2020-03-27 13:55:47 +03:00
# Install
2020-03-24 09:27:15 +03:00
image_label="$(lsb_release -rs)"
2021-11-07 16:07:58 +00:00
swift_version=$(curl -s "https://api.github.com/repos/apple/swift/releases/latest" | jq -r '.tag_name | match("[0-9.]+").string')
2020-03-24 15:56:42 +03:00
2021-03-30 15:23:57 +03:00
swift_tar_name="swift-$swift_version-RELEASE-ubuntu$image_label.tar.gz"
swift_tar_url="https://swift.org/builds/swift-$swift_version-release/ubuntu${image_label//./}/swift-$swift_version-RELEASE/$swift_tar_name"
download_with_retries $swift_tar_url "/tmp" "$swift_tar_name"
2020-10-07 13:49:40 +05:00
2021-03-30 15:23:57 +03:00
tar xzf /tmp/$swift_tar_name
2020-03-24 15:56:42 +03:00
SWIFT_INSTALL_ROOT="/usr/share/swift"
SWIFT_BIN_ROOT="$SWIFT_INSTALL_ROOT/usr/bin"
SWIFT_LIB_ROOT="$SWIFT_INSTALL_ROOT/usr/lib"
mv swift-$swift_version-RELEASE-ubuntu$image_label $SWIFT_INSTALL_ROOT
mkdir -p /usr/local/lib
ln -s "$SWIFT_BIN_ROOT/swift" /usr/local/bin/swift
ln -s "$SWIFT_BIN_ROOT/swiftc" /usr/local/bin/swiftc
ln -s "$SWIFT_LIB_ROOT/libsourcekitdInProc.so" /usr/local/lib/libsourcekitdInProc.so
echo "SWIFT_PATH=$SWIFT_BIN_ROOT" | tee -a /etc/environment
2020-03-24 09:27:15 +03:00
2021-11-07 16:07:58 +00:00
invoke_tests "Common" "Swift"