Skip to content

Commit bb582e3

Browse files
anton-plebanovichfreak4pc
authored andcommitted
- Carthage build fix
- Carthage rebuild on Swift version change
1 parent a18544b commit bb582e3

File tree

2 files changed

+38
-3
lines changed

2 files changed

+38
-3
lines changed

scripts/bootstrap-if-needed.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,24 @@
11
#!/bin/sh
22

3+
set -e
4+
35
RED='\033[1;31m'
46
GREEN='\033[1;32m'
57
NC='\033[0m' # No Color
68

7-
if ! cmp -s Cartfile.resolved Carthage/Cartfile.resolved; then
9+
# Get previous checksum
10+
mkdir -p "Carthage"
11+
touch "Carthage/cartSum.txt"
12+
if [ ! -f "Carthage/cartSum.txt" ]; then
13+
prevSum="null";
14+
else
15+
prevSum=`cat Carthage/cartSum.txt`;
16+
fi
17+
18+
# Get checksum
19+
cartSum=`{ cat Cartfile.resolved; xcrun swift -version; } | md5`
20+
21+
if [ "$prevSum" != "$cartSum" ] || [ ! -d "Carthage/Build/iOS" ]; then
822
printf "${RED}Dependencies out of date with cache.${NC} Bootstrapping...\n"
923
scripts/bootstrap.sh
1024
else

scripts/bootstrap.sh

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,25 @@
11
#!/bin/sh
22

3-
carthage bootstrap
4-
cp Cartfile.resolved Carthage
3+
set -e
4+
5+
# https://github.com/mapbox/mapbox-navigation-ios/blob/master/scripts/wcarthage.sh
6+
applyXcode12Workaround() {
7+
echo "Applying Xcode 12 workaround..."
8+
9+
xcconfig=$(mktemp /tmp/static.xcconfig.XXXXXX)
10+
trap 'rm -f "${xcconfig}"' INT TERM HUP EXIT
11+
12+
# For Xcode 12 make sure EXCLUDED_ARCHS is set to arm architectures otherwise
13+
# the build will fail on lipo due to duplicate architectures.
14+
echo 'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200 = arm64 arm64e armv7 armv7s armv6 armv8' >> $xcconfig
15+
echo 'EXCLUDED_ARCHS = $(inherited) $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT)__XCODE_$(XCODE_VERSION_MAJOR))' >> $xcconfig
16+
17+
export XCODE_XCCONFIG_FILE="${xcconfig}"
18+
echo "Workaround applied. xcconfig here: ${XCODE_XCCONFIG_FILE}"
19+
}
20+
21+
applyXcode12Workaround
22+
carthage bootstrap --cache-builds
23+
24+
cartSum=`{ cat Cartfile.resolved; xcrun swift -version; } | md5`
25+
echo $cartSum > Carthage/cartSum.txt

0 commit comments

Comments
 (0)