|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# Use this script after pulling down a local copy of the AWS Swift SDK to your local machine. |
| 4 | +# Doing so will allow you to build (and modify) a local copy of the AWS Swift SDK. |
| 5 | +# |
| 6 | +# After setting this up, you can update your executable's Package.swift to depend on a local version of the SDK via: |
| 7 | +# |
| 8 | +# dependencies: [ |
| 9 | +# .package(name: "AWSSwiftSDK", path:"~/Projects/SwiftSDK_Releases/aws-sdk-swift"), |
| 10 | +# ], |
| 11 | + |
| 12 | +# |
| 13 | +# Setup Instructions |
| 14 | +# Note: Versions listed below should be updated to your preference (ideally, the latest) |
| 15 | +# |
| 16 | +# mkdir -p ~/Projects/SwiftSDK_Releases |
| 17 | +# cd ~/Projects/SwiftSDK_Releases |
| 18 | +# |
| 19 | +# git clone [email protected]:awslabs/aws-sdk-swift.git |
| 20 | +# cd aws-sdk-swift |
| 21 | +# git checkout -b 0.1.1 |
| 22 | +# cd .. |
| 23 | +# |
| 24 | +# git clone [email protected]:awslabs/smithy-swift.git |
| 25 | +# cd smithy-swift |
| 26 | +# git checkout -b 0.1.1 |
| 27 | +# cd .. |
| 28 | +# |
| 29 | +# git clone --recurse-submodules [email protected]:awslabs/aws-crt-swift.git |
| 30 | +# cd aws-crt-swift |
| 31 | +# git checkout -b 0.1.0 |
| 32 | +# cd .. |
| 33 | +# |
| 34 | +# ./aws-sdk-swift/scripts/updateReleaseToLocalDev.sh |
| 35 | +# |
| 36 | +# If this script runs successfully, you can depend on a local version of the SDK |
| 37 | + |
| 38 | + |
| 39 | +AWS_SDK_SWIFT= |
| 40 | +SMITHY_SWIFT= |
| 41 | +AWS_CRT_SWIFT= |
| 42 | + |
| 43 | +determineAbsolutePath() { |
| 44 | + SCRIPTDIR=`dirname $1` |
| 45 | + pushd ${SCRIPTDIR} > /dev/null |
| 46 | + cd ../../ |
| 47 | + AWS_SDK_SWIFT=$PWD/aws-sdk-swift |
| 48 | + SMITHY_SWIFT=$PWD/smithy-swift |
| 49 | + AWS_CRT_SWIFT=$PWD/aws-crt-swift |
| 50 | +} |
| 51 | + |
| 52 | +determineAbsolutePath $0 |
| 53 | + |
| 54 | +if [ -z ${AWS_SDK_SWIFT} ] || [ ! -d ${AWS_SDK_SWIFT} ]; then |
| 55 | + echo "Unable to detect aws-sdk-swift" |
| 56 | + exit 1 |
| 57 | +fi |
| 58 | + |
| 59 | +if [ -z ${SMITHY_SWIFT} ] || [ ! -d ${SMITHY_SWIFT} ]; then |
| 60 | + echo "Unable to detect smithy-swift" |
| 61 | + exit 1 |
| 62 | +fi |
| 63 | + |
| 64 | +if [ -z ${AWS_CRT_SWIFT} ] || [ ! -d ${AWS_CRT_SWIFT} ]; then |
| 65 | + echo "Unable to detect aws-crt-swift" |
| 66 | + exit 1 |
| 67 | +fi |
| 68 | + |
| 69 | +TEMPFILE=`mktemp` |
| 70 | +AWS_SDK_SWIFT_PACKAGE=${AWS_SDK_SWIFT}/Package.swift |
| 71 | +cat ${AWS_SDK_SWIFT_PACKAGE} |\ |
| 72 | + sed -e "s|\(.*\)url:\ \"https://github.com/awslabs/aws-crt-swift.*\"\(.*\)|\1path:\ \"$AWS_CRT_SWIFT\"\2|g" \ |
| 73 | + -e "s|\(.*\)url:\ \"https://github.com/awslabs/smithy-swift.*\"\(.*\)|\1path:\ \"$SMITHY_SWIFT\"\2|g" > ${TEMPFILE} |
| 74 | +mv ${TEMPFILE} ${AWS_SDK_SWIFT_PACKAGE} |
| 75 | +rm -f ${TEMPFILE} |
| 76 | +echo "Updated ${AWS_SDK_SWIFT_PACKAGE}" |
| 77 | + |
| 78 | +TEMPFILE=`mktemp` |
| 79 | +SMITHY_SWIFT_PACKAGE=${SMITHY_SWIFT}/Package.swift |
| 80 | +cat ${SMITHY_SWIFT_PACKAGE} |\ |
| 81 | + sed -e "s|\(.*\)url:\ \"https://github.com/awslabs/aws-crt-swift.*\"\(.*\)|\1path:\ \"$AWS_CRT_SWIFT\"\2|g" > ${TEMPFILE} |
| 82 | +mv ${TEMPFILE} ${SMITHY_SWIFT_PACKAGE} |
| 83 | +rm -f ${TEMPFILE} |
| 84 | +echo "Updated ${SMITHY_SWIFT_PACKAGE}" |
0 commit comments