-
Notifications
You must be signed in to change notification settings - Fork 453
/
build-universal-xcframework.sh
executable file
·79 lines (66 loc) · 1.68 KB
/
build-universal-xcframework.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
#!/bin/sh
# build-universal-xcframework.sh
# Zip
#
# Created by Rohan on 13/01/21.
# Copyright © 2021 Roy Marmelstein. All rights reserved.
set -e
BUILD_DIR=build
NAME=Zip
# clean build folders
if [ -d ${BUILD_DIR} ]; then
rm -rf ${BUILD_DIR}
fi
if [ -d "${NAME}.xcframework" ]; then
rm -rf "${NAME}.xcframework"
fi
mkdir ${BUILD_DIR}
# iOS devices
TARGET=iphoneos
xcodebuild archive \
-scheme ${NAME} \
-archivePath "./${BUILD_DIR}/${NAME}-${TARGET}.xcarchive" \
-sdk ${TARGET} \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES
# iOS simulator
TARGET=iphonesimulator
xcodebuild archive \
-scheme ${NAME} \
-archivePath "./${BUILD_DIR}/${NAME}-${TARGET}.xcarchive" \
-sdk ${TARGET} \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES
# tvOS devices
TARGET=appletvos
xcodebuild archive \
-scheme "${NAME} tvOS" \
-archivePath "./${BUILD_DIR}/${NAME}-${TARGET}.xcarchive" \
-sdk ${TARGET} \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES
# tvOS simulator
TARGET=appletvsimulator
xcodebuild archive \
-scheme "${NAME} tvOS" \
-archivePath "./${BUILD_DIR}/${NAME}-${TARGET}.xcarchive" \
-sdk ${TARGET} \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES
# macOS devices
TARGET=macosx
xcodebuild archive \
-scheme "${NAME} OSX" \
-archivePath "./${BUILD_DIR}/${NAME}-${TARGET}.xcarchive" \
-sdk ${TARGET} \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES
# packing .framework to .xcframework
FWMK_FILES=$(find "./${BUILD_DIR}" -name "*.framework")
for FWMK_FILE in ${FWMK_FILES}
do
FWMK_FILES_CMD="-framework ${FWMK_FILE} ${FWMK_FILES_CMD}"
done
xcodebuild -create-xcframework \
${FWMK_FILES_CMD} \
-output "${NAME}.xcframework"