Skip to content
This repository was archived by the owner on Jan 25, 2023. It is now read-only.

Commit 483cc50

Browse files
committed
Don't install a default Swift version
1 parent 253f729 commit 483cc50

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

Dockerfile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -465,12 +465,9 @@ RUN dotnet new
465465
#
466466
################################################################################
467467
USER buildbot
468-
ENV NETLIFY_BUILD_SWIFT_VERSION 5.2
469468
ENV SWIFTENV_ROOT "/opt/buildhome/.swiftenv"
470469
RUN git clone --depth 1 https://github.com/kylef/swiftenv.git "$SWIFTENV_ROOT"
471470
ENV PATH "$SWIFTENV_ROOT/bin:$SWIFTENV_ROOT/shims:$PATH"
472-
RUN swiftenv install ${NETLIFY_BUILD_SWIFT_VERSION}
473-
RUN swift --version
474471

475472
################################################################################
476473
#

run-build-functions.sh

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -415,9 +415,6 @@ install_dependencies() {
415415
echo "Attempting Swift version '$SWIFT_VERSION' from .swift-version"
416416
fi
417417

418-
swiftenv global ${SWIFT_VERSION} > /dev/null 2>&1
419-
export CUSTOM_SWIFT=$?
420-
421418
if [ -d $NETLIFY_CACHE_DIR/swift_version/$SWIFT_VERSION ]
422419
then
423420
echo "Started restoring cached Swift version"
@@ -429,12 +426,14 @@ install_dependencies() {
429426

430427
# swiftenv expects the following environment variables to refer to
431428
# swiftenv internals
432-
if PLATFORM= URL= VERSION= swiftenv install -s $SWIFT_VERSION
433-
then
434-
echo "Using Swift version $SWIFT_VERSION"
435-
else
436-
echo "Failed to install Swift version '$SWIFT_VERSION'"
437-
exit 1
429+
if [ -f .swift-version -o -f Package.swift ]
430+
if PLATFORM= URL= VERSION= swiftenv install -s $SWIFT_VERSION
431+
then
432+
echo "Using Swift version $SWIFT_VERSION"
433+
else
434+
echo "Failed to install Swift version '$SWIFT_VERSION'"
435+
exit 1
436+
fi
438437
fi
439438

440439
# SPM dependencies
@@ -700,7 +699,7 @@ cache_artifacts() {
700699
fi
701700

702701
# cache the version of Swift installed
703-
if [[ "$CUSTOM_SWIFT" -ne "0" ]]
702+
if [ -d $SWIFTENV_ROOT/versions/$SWIFT_VERSION ]
704703
then
705704
if ! [ -d $NETLIFY_CACHE_DIR/swift_version/$SWIFT_VERSION ]
706705
then

0 commit comments

Comments
 (0)