Skip to content

Commit 372ae42

Browse files
Merge pull request #302 from pusher/fix/290-carthage-xcode-12-workaround
Carthage Xcode 12 build failures workaround
2 parents 39d72c1 + 15f0eb6 commit 372ae42

File tree

4 files changed

+25
-2
lines changed

4 files changed

+25
-2
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Xcode 11.7
1+
Xcode 12.0.1

Consumption-Tests/Shared/carthage-checkout.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,9 @@ echo "git \"file://$REPO_ROOT_ABS_DIR_PATH\" \"$TEMP_TAG_NAME\"" > "$WORKING_DIR
128128
set +e
129129

130130
# Perform the `carthage update` (using the Cartfile we just created/updated)
131-
carthage update
131+
# (`./carthage.sh update` instead of `carthage update` as a workaround for Carthage Xcode 12 issue: https://github.com/Carthage/Carthage/issues/3019#issuecomment-665136323)
132+
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
133+
source ${DIR}/carthage.sh update
132134
CARTHAGE_UPDATE_STATUS_CODE=$?
133135
echo "CARTHAGE_UPDATE_STATUS_CODE=$CARTHAGE_UPDATE_STATUS_CODE"
134136

Consumption-Tests/Shared/carthage.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env bash
2+
3+
# carthage.sh
4+
# Usage example: ./carthage.sh build --platform iOS
5+
6+
set -euo pipefail
7+
8+
xcconfig=$(mktemp /tmp/static.xcconfig.XXXXXX)
9+
trap 'rm -f "$xcconfig"' INT TERM HUP EXIT
10+
11+
# For Xcode 12 make sure EXCLUDED_ARCHS is set to arm architectures otherwise
12+
# the build will fail on lipo due to duplicate architectures.
13+
echo 'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200 = arm64 arm64e armv7 armv7s armv6 armv8' >> $xcconfig
14+
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
15+
16+
export XCODE_XCCONFIG_FILE="$xcconfig"
17+
carthage "$@"

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ Carthage will produce a number of frameworks. Which of those you need to include
126126
- If you **are not** using the end-to-end encryption features, you need to include the following framework binaries from the `Carthage/Build` directory: `PusherSwift` and `Reachability`
127127
- If you **are** using the end-to-end encryption features, you need to include the following framework binaries from the `Carthage/Build` directory: `PusherSwiftWithEncryption`, `Sodium` and `Reachability`
128128

129+
#### Xcode 12 considerations
130+
131+
Using Carthage under Xcode 12.0 and above currently requires [a workaround](https://github.com/Carthage/Carthage/issues/3019) in order for the build to be successful. You can find an example of the workaround, which is used for running the 'Consumption-Tests' [here](Consumption-Tests/Shared/carthage.sh).
132+
129133
### Swift Package Manager
130134

131135
> Please note that if you are looking to use encrypted channels, this is not currently possible with Swift Package Manager.

0 commit comments

Comments
 (0)