-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathbuild-framework.sh
executable file
·44 lines (33 loc) · 1.43 KB
/
build-framework.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
#!/usr/bin/env bash
set -e
BASE_PWD="$PWD"
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
OUTPUT_DIR=$( mktemp -d )
COMMON_SETUP="-workspace ${SCRIPT_DIR}/../SwiftyMessenger.xcworkspace -scheme SwiftyMessenger-iOS -configuration Release -quiet SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES"
# iOS
DERIVED_DATA_PATH=$( mktemp -d )
xcrun xcodebuild build \
$COMMON_SETUP \
-derivedDataPath "${DERIVED_DATA_PATH}" \
-destination 'generic/platform=iOS'
mkdir -p "${OUTPUT_DIR}/iphoneos"
cp -r "${DERIVED_DATA_PATH}/Build/Products/Release-iphoneos/SwiftyMessenger.framework" "${OUTPUT_DIR}/iphoneos"
rm -rf "${DERIVED_DATA_PATH}"
# iOS Simulator
DERIVED_DATA_PATH=$( mktemp -d )
xcrun xcodebuild build \
$COMMON_SETUP \
-derivedDataPath "${DERIVED_DATA_PATH}" \
-destination 'generic/platform=iOS Simulator'
mkdir -p "${OUTPUT_DIR}/iphonesimulator"
cp -r "${DERIVED_DATA_PATH}/Build/Products/Release-iphonesimulator/SwiftyMessenger.framework" "${OUTPUT_DIR}/iphonesimulator"
rm -rf "${DERIVED_DATA_PATH}"
# XCFRAMEWORK
xcrun xcodebuild -create-xcframework \
-framework "${OUTPUT_DIR}/iphoneos/SwiftyMessenger.framework" \
-framework "${OUTPUT_DIR}/iphonesimulator/SwiftyMessenger.framework" \
-output ${OUTPUT_DIR}/SwiftyMessenger.xcframework
ditto -c -k --keepParent ${OUTPUT_DIR}/SwiftyMessenger.xcframework SwiftyMessenger.xcframework.zip
echo "✔️ SwiftyMessenger.xcframework"
rm -rf ${OUTPUT_DIR}
cd ${BASE_PWD}