-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_xcframework.sh
More file actions
executable file
·77 lines (62 loc) · 2.07 KB
/
build_xcframework.sh
File metadata and controls
executable file
·77 lines (62 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/bash
WORKSPACE_NAME="PackPodAsXCFrameworkDemo.xcworkspace"
# Cleanup
rm -rf build
# Fetch dependencies
pod install
if [ $? -ne 0 ]; then
echo "pod install failed. Exiting..."
exit 1
fi
build_xcframework() {
# Build for iOS Device
xcodebuild archive \
-workspace $WORKSPACE_NAME \
-scheme $1 \
-destination "generic/platform=iOS Simulator" \
-configuration Release only_active_arch=no \
-sdk iphoneos \
-archivePath build/ios_devices.xcarchive \
SKIP_INSTALL=NO \
BUILD_LIBRARIES_FOR_DISTRIBUTION=YES \
OTHER_SWIFT_FLAGS="-Xfrontend -module-interface-preserve-types-as-written"
if [ $? -ne 0 ]; then
echo "Build $1 for iOS Device failed. Exiting..."
exit 1
fi
# Build for iOS Simulator
xcodebuild archive \
-workspace $WORKSPACE_NAME \
-scheme $1 \
-destination "generic/platform=iOS" \
-configuration Release only_active_arch=no \
-sdk iphonesimulator \
-archivePath build/ios_simulator.xcarchive \
SKIP_INSTALL=NO \
BUILD_LIBRARIES_FOR_DISTRIBUTION=YES \
OTHER_SWIFT_FLAGS="-Xfrontend -module-interface-preserve-types-as-written"
if [ $? -ne 0 ]; then
echo "Build $1 for iOS Simulator failed. Exiting..."
exit 1
fi
# Create XCFramework
xcodebuild -create-xcframework \
-framework build/ios_devices.xcarchive/Products/Library/Frameworks/$1.framework \
-framework build/ios_simulator.xcarchive/Products/Library/Frameworks/$1.framework \
-output build/$1.xcframework
# Remove archives
rm -rf build/ios_devices.xcarchive
rm -rf build/ios_simulator.xcarchive
if [ $? -ne 0 ]; then
echo "Create $1 XCFramework failed. Exiting..."
exit 1
fi
}
build_xcframework SnapKit
build_xcframework FicowPod
# Copy pod lib which provides xcframework instead of source code
cp -R Pods/GenesysCloudMessengerTransport/MessengerTransport.xcframework build/MessengerTransport.xcframework
if [ $? -ne 0 ]; then
echo "Build for iOS Simulator failed. Exiting..."
exit 1
fi