Skip to content

Commit

Permalink
Add workaround to build MessageKit
Browse files Browse the repository at this point in the history
  • Loading branch information
manicmaniac committed Aug 24, 2023
1 parent c08c3dc commit 86bccf0
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 2 deletions.
4 changes: 2 additions & 2 deletions GitHubActions/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ MODE="$1"

if [ "$MODE" = "tests" -o "$MODE" = "all" ]; then
echo "Running MessageKit tests."
carthage bootstrap --platform ios
carthage checkout && ./GitHubActions/install-dependencies.sh
set -o pipefail && xcodebuild test -project MessageKit.xcodeproj -scheme MessageKitTests -destination "platform=iOS Simulator,name=iPhone 11 Pro" CODE_SIGNING_REQUIRED=NO | xcpretty -c
success="1"
fi

if [ "$MODE" = "framework" -o "$MODE" = "all" ]; then
echo "Building MessageKit Framework."
carthage bootstrap --platform ios
carthage checkout && ./GitHubActions/install-dependencies.sh
set -o pipefail && xcodebuild build -project MessageKit.xcodeproj -scheme MessageKit -destination "platform=iOS Simulator,name=iPhone 11 Pro" CODE_SIGNING_REQUIRED=NO | xcpretty -c
success="1"
fi
Expand Down
40 changes: 40 additions & 0 deletions GitHubActions/install-dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/sh

# Workaround to build MessageKit avoiding problems caused by the old libraries and recent Xcode.
# - carthage build fails on M1 Mac
# - Nimble cannot be built on Xcode 12 or above

set -e

# carthage checkout

derived_data_dir="$(mktemp -d -t DerivedData)"
trap "rm -rf '$derived_data_dir'" EXIT

# Workaround for https://github.com/Quick/Nimble/issues/855
sed -i '' -e 's/swiftXCTest/XCTestSwiftSupport/g' Carthage/Checkouts/Nimble/Nimble.xcodeproj/project.pbxproj

build_framework() {
project="$1"
scheme="$2"
name="$3"

rm -rf "Carthage/Build/iOS/${name}.framework"
mkdir -p Carthage/Build/iOS
xcodebuild build \
-project "$project" \
-scheme "$scheme" \
-configuration Debug \
-derivedDataPath "$derived_data_dir" \
-sdk iphonesimulator \
-quiet \
ONLY_ACTIVE_ARCH=YES \
CODE_SIGNING_REQUIRED=NO \
CODE_SIGN_IDENTITY= \
CARTHAGE=YES
mv "${derived_data_dir}/Build/Products/Debug-iphonesimulator/${name}.framework" Carthage/Build/iOS/
}

build_framework Carthage/Checkouts/InputBarAccessoryView/InputBarAccessoryView.xcodeproj InputBarAccessoryView InputBarAccessoryView
build_framework Carthage/Checkouts/Nimble/Nimble.xcodeproj Nimble-iOS Nimble
build_framework Carthage/Checkouts/Quick/Quick.xcodeproj Quick-iOS Quick

0 comments on commit 86bccf0

Please sign in to comment.