-
Notifications
You must be signed in to change notification settings - Fork 17
/
buildXCFramework.sh
executable file
·205 lines (179 loc) · 7.23 KB
/
buildXCFramework.sh
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
#!/bin/bash
makeXCFramework() {
FRAMEWORK_NAME=$1
BUILD_CONFIGURATION=$2
SCHEME_NAME=$1
echo "NAME: ${FRAMEWORK_NAME}"
echo "CONFIGURATION: ${BUILD_CONFIGURATION}"
echo "SCHEME: ${SCHEME_NAME}"
ARCHIVE_PATH="$(pwd)/xcarchives"
IOS_SIMULATOR_ARCHIVE_PATH="${ARCHIVE_PATH}/${SCHEME_NAME}-iphonesimulator.xcarchive"
IOS_DEVICE_ARCHIVE_PATH="${ARCHIVE_PATH}/${SCHEME_NAME}-iphoneos.xcarchive"
TV_SIMULATOR_ARCHIVE_PATH="${ARCHIVE_PATH}/${SCHEME_NAME}-appletvsimulator.xcarchive"
TV_DEVICE_ARCHIVE_PATH="${ARCHIVE_PATH}/${SCHEME_NAME}-appletvos.xcarchive"
WATCH_SIMULATOR_ARCHIVE_PATH="${ARCHIVE_PATH}/${SCHEME_NAME}-watchsimulator.xcarchive"
WATCH_DEVICE_ARCHIVE_PATH="${ARCHIVE_PATH}/${SCHEME_NAME}-watchos.xcarchive"
MACOS_ARCHIVE_PATH="${ARCHIVE_PATH}/${SCHEME_NAME}-macosx.xcarchive"
CATALYST_ARCHIVE_PATH="${ARCHIVE_PATH}/${SCHEME_NAME}-catalyst.xcarchive"
OUTPUT_FRAMEWORK_PATH="$(pwd)/xcframeworks"
printf "\n"
printf "\n"
echo "${FRAMEWORK_NAME}"
echo "Cleaning up old archives"
rm -rf "${ARCHIVE_PATH}"
printf "\n"
printf "\n"
echo "Creating xcarchives ${FRAMEWORK_NAME} using ${BUILD_CONFIGURATION} configuration"
printf "\n"
printf "\n"
echo "iOS Simulator xcarchive"
xcodebuild archive \
-project LittleBlueTooth.xcodeproj \
-scheme LittleBlueTooth \
-configuration ${BUILD_CONFIGURATION} \
-archivePath ${IOS_SIMULATOR_ARCHIVE_PATH} \
-sdk iphonesimulator \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES
printf "\n"
printf "\n"
echo "iOS Device xcarchive"
xcodebuild archive \
-project LittleBlueTooth.xcodeproj \
-scheme LittleBlueTooth \
-configuration ${BUILD_CONFIGURATION} \
-archivePath ${IOS_DEVICE_ARCHIVE_PATH} \
-sdk iphoneos \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES
printf "\n"
printf "\n"
echo "tvOS Simulator xcarchive"
xcodebuild archive \
-project LittleBlueTooth.xcodeproj \
-scheme LittleBlueTooth \
-configuration ${BUILD_CONFIGURATION} \
-archivePath ${TV_SIMULATOR_ARCHIVE_PATH} \
-sdk appletvsimulator \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES
printf "\n"
printf "\n"
echo "tvOS Device xcarchive"
xcodebuild archive \
-project LittleBlueTooth.xcodeproj \
-scheme LittleBlueTooth \
-configuration ${BUILD_CONFIGURATION} \
-archivePath ${TV_DEVICE_ARCHIVE_PATH} \
-sdk appletvos \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES
printf "\n"
printf "\n"
echo "watchOS Device xcarchive"
xcodebuild archive \
-project LittleBlueTooth.xcodeproj \
-scheme LittleBlueTooth \
-configuration ${BUILD_CONFIGURATION} \
-archivePath ${WATCH_SIMULATOR_ARCHIVE_PATH} \
-sdk watchsimulator \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES
printf "\n"
printf "\n"
echo "watchOS Simulator xcarchive"
xcodebuild archive \
-project LittleBlueTooth.xcodeproj \
-scheme LittleBlueTooth \
-configuration ${BUILD_CONFIGURATION} \
-archivePath ${WATCH_DEVICE_ARCHIVE_PATH} \
-sdk watchos \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES
printf "\n"
printf "\n"
echo "macOS catalyst xcarchive"
xcodebuild archive \
-project LittleBlueTooth.xcodeproj \
-scheme LittleBlueTooth \
-configuration ${BUILD_CONFIGURATION} \
-archivePath ${CATALYST_ARCHIVE_PATH} \
-sdk macosx \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
SUPPORTS_MACCATALYST=YES
printf "\n"
printf "\n"
echo "Cleaning up old framework"
rm -rf "${OUTPUT_FRAMEWORK_PATH}"
printf "\n"
printf "\n"
echo "Getting DWARFDUMP UUID"
# dump is made by a string we need only the first part UUID: 28FF8530-4C33-3F19-921E-748BF9DEE98D (arm64) LittleBlueTooth.framework.dSYM/Contents/Resources/DWARF/LittleBlueTooth
IOS_UUID=$(dwarfdump --uuid ${IOS_DEVICE_ARCHIVE_PATH}/dSYMs/${SCHEME_NAME}.framework.dSYM)
TVOS_UUID=$(dwarfdump --uuid ${TV_DEVICE_ARCHIVE_PATH}/dSYMs/${SCHEME_NAME}.framework.dSYM)
WATCHOS_UUID=$(dwarfdump --uuid ${WATCH_DEVICE_ARCHIVE_PATH}/dSYMs/${SCHEME_NAME}.framework.dSYM)
echo "IOS UUID: ${IOS_UUID}"
echo "TVOD UUID: ${TVOS_UUID}"
echo "WATCHOS UUID: ${WATCHOS_UUID}"
#SPLITTING
iosArray=($IOS_UUID)
tvosArray=($TVOS_UUID)
watchosArray=($WATCHOS_UUID)
IOS_UUID=${iosArray[1]}
TVOS_UUID=${tvosArray[1]}
WATCHOS_UUID=${watchosArray[1]}
echo "IOS UUID: ${IOS_UUID}"
echo "TVOS UUID: ${TVOS_UUID}"
echo "WATCHOS UUID: ${WATCHOS_UUID}"
printf "\n"
printf "\n"
echo "Creating xcframworks"
xcodebuild -create-xcframework \
-framework ${IOS_SIMULATOR_ARCHIVE_PATH}/Products/Library/Frameworks/${SCHEME_NAME}.framework \
-debug-symbols ${IOS_SIMULATOR_ARCHIVE_PATH}/dSYMs/${SCHEME_NAME}.framework.dSYM \
-framework ${IOS_DEVICE_ARCHIVE_PATH}/Products/Library/Frameworks/${SCHEME_NAME}.framework \
-debug-symbols ${IOS_DEVICE_ARCHIVE_PATH}/dSYMs/${SCHEME_NAME}.framework.dSYM \
-framework ${TV_SIMULATOR_ARCHIVE_PATH}/Products/Library/Frameworks/${SCHEME_NAME}.framework \
-debug-symbols ${TV_SIMULATOR_ARCHIVE_PATH}/dSYMs/${SCHEME_NAME}.framework.dSYM \
-framework ${TV_DEVICE_ARCHIVE_PATH}/Products/Library/Frameworks/${SCHEME_NAME}.framework \
-debug-symbols ${TV_DEVICE_ARCHIVE_PATH}/dSYMs/${SCHEME_NAME}.framework.dSYM \
-framework ${WATCH_SIMULATOR_ARCHIVE_PATH}/Products/Library/Frameworks/${SCHEME_NAME}.framework \
-debug-symbols ${WATCH_SIMULATOR_ARCHIVE_PATH}/dSYMs/${SCHEME_NAME}.framework.dSYM \
-framework ${WATCH_DEVICE_ARCHIVE_PATH}/Products/Library/Frameworks/${SCHEME_NAME}.framework \
-debug-symbols ${WATCH_DEVICE_ARCHIVE_PATH}/dSYMs/${SCHEME_NAME}.framework.dSYM \
-framework ${CATALYST_ARCHIVE_PATH}/Products/Library/Frameworks/${SCHEME_NAME}.framework \
-debug-symbols ${CATALYST_ARCHIVE_PATH}/dSYMs/${SCHEME_NAME}.framework.dSYM \
-output ${OUTPUT_FRAMEWORK_PATH}/${FRAMEWORK_NAME}.xcframework
printf "\n"
printf "\n"
echo "Copying dSYMs"
cp -a ${IOS_SIMULATOR_ARCHIVE_PATH}/dSYMs/. ${OUTPUT_FRAMEWORK_PATH}/${FRAMEWORK_NAME}-dSYMs-iphonesimulator
cp -a ${IOS_DEVICE_ARCHIVE_PATH}/dSYMs/. ${OUTPUT_FRAMEWORK_PATH}/${FRAMEWORK_NAME}-dSYMs-iphoneos
cp -a ${TV_SIMULATOR_ARCHIVE_PATH}/dSYMs/. ${OUTPUT_FRAMEWORK_PATH}/${FRAMEWORK_NAME}-dSYMs-appletvsimulator
cp -a ${TV_DEVICE_ARCHIVE_PATH}/dSYMs/. ${OUTPUT_FRAMEWORK_PATH}/${FRAMEWORK_NAME}-dSYMs-appletvos
cp -a ${WATCH_SIMULATOR_ARCHIVE_PATH}/dSYMs/. ${OUTPUT_FRAMEWORK_PATH}/${FRAMEWORK_NAME}-dSYMs-watchsimulator
cp -a ${WATCH_DEVICE_ARCHIVE_PATH}/dSYMs/. ${OUTPUT_FRAMEWORK_PATH}/${FRAMEWORK_NAME}-dSYMs-watchos
cp -a ${CATALYST_ARCHIVE_PATH}/dSYMs/. ${OUTPUT_FRAMEWORK_PATH}/${FRAMEWORK_NAME}-dSYMs-macosx
printf "\n"
printf "\n"
echo "logs successfully written out to:"
echo $(pwd)/XCFrameworkLogs.txt
}
performXCFramework() {
printf "\n"
printf "\n"
makeXCFramework "LittleBlueTooth" "Release" | tee XCFrameworkLogs.txt
}
main() {
echo " ╔═══════════════════════════════════╗"
echo " ║ Make LittleBlueTooth XCFramework! ║"
echo " ╚═══════════════════════════════════╝"
performXCFramework
echo " ╔═══════╗"
echo " ║ Done! ║"
echo " ╚═══════╝"
}
################################################################################
clear
main