forked from krzyzanowskim/CryptoSwift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-framework.sh
executable file
·119 lines (97 loc) · 4.13 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
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
#!/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="-project ${SCRIPT_DIR}/../CryptoSwift.xcodeproj -scheme CryptoSwift -configuration Release -quiet SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES"
# macOS
DERIVED_DATA_PATH=$( mktemp -d )
xcrun xcodebuild build \
$COMMON_SETUP \
-derivedDataPath "${DERIVED_DATA_PATH}" \
-destination 'generic/platform=macOS'
mkdir -p "${OUTPUT_DIR}/macos"
ditto "${DERIVED_DATA_PATH}/Build/Products/Release/CryptoSwift.framework" "${OUTPUT_DIR}/macos/CryptoSwift.framework"
rm -rf "${DERIVED_DATA_PATH}"
# macOS Catalyst
DERIVED_DATA_PATH=$( mktemp -d )
xcrun xcodebuild build \
$COMMON_SETUP \
-derivedDataPath "${DERIVED_DATA_PATH}" \
-destination 'generic/platform=macOS,variant=Mac Catalyst'
mkdir -p "${OUTPUT_DIR}/maccatalyst"
ditto "${DERIVED_DATA_PATH}/Build/Products/Release-maccatalyst/CryptoSwift.framework" "${OUTPUT_DIR}/maccatalyst/CryptoSwift.framework"
rm -rf "${DERIVED_DATA_PATH}"
# iOS
DERIVED_DATA_PATH=$( mktemp -d )
xcrun xcodebuild build \
$COMMON_SETUP \
-derivedDataPath "${DERIVED_DATA_PATH}" \
-destination 'generic/platform=iOS'
mkdir -p "${OUTPUT_DIR}/iphoneos"
ditto "${DERIVED_DATA_PATH}/Build/Products/Release-iphoneos/CryptoSwift.framework" "${OUTPUT_DIR}/iphoneos/CryptoSwift.framework"
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"
ditto "${DERIVED_DATA_PATH}/Build/Products/Release-iphonesimulator/CryptoSwift.framework" "${OUTPUT_DIR}/iphonesimulator/CryptoSwift.framework"
rm -rf "${DERIVED_DATA_PATH}"
# tvOS
DERIVED_DATA_PATH=$( mktemp -d )
xcrun xcodebuild build \
$COMMON_SETUP \
-derivedDataPath "${DERIVED_DATA_PATH}" \
-destination 'generic/platform=tvOS'
mkdir -p "${OUTPUT_DIR}/appletvos"
ditto "${DERIVED_DATA_PATH}/Build/Products/Release-appletvos/CryptoSwift.framework" "${OUTPUT_DIR}/appletvos/CryptoSwift.framework"
rm -rf "${DERIVED_DATA_PATH}"
# tvOS Simulator
DERIVED_DATA_PATH=$( mktemp -d )
xcrun xcodebuild build \
$COMMON_SETUP \
-derivedDataPath "${DERIVED_DATA_PATH}" \
-destination 'generic/platform=tvOS Simulator'
mkdir -p "${OUTPUT_DIR}/appletvsimulator"
ditto "${DERIVED_DATA_PATH}/Build/Products/Release-appletvsimulator/CryptoSwift.framework" "${OUTPUT_DIR}/appletvsimulator/CryptoSwift.framework"
rm -rf "${DERIVED_DATA_PATH}"
# watchOS
DERIVED_DATA_PATH=$( mktemp -d )
xcrun xcodebuild build \
$COMMON_SETUP \
-derivedDataPath "${DERIVED_DATA_PATH}" \
-destination 'generic/platform=watchOS'
mkdir -p "${OUTPUT_DIR}/watchos"
ditto "${DERIVED_DATA_PATH}/Build/Products/Release-watchos/CryptoSwift.framework" "${OUTPUT_DIR}/watchos/CryptoSwift.framework"
rm -rf "${DERIVED_DATA_PATH}"
# watchOS Simulator
DERIVED_DATA_PATH=$( mktemp -d )
xcrun xcodebuild build \
$COMMON_SETUP \
-derivedDataPath "${DERIVED_DATA_PATH}" \
-destination 'generic/platform=watchOS Simulator'
mkdir -p "${OUTPUT_DIR}/watchsimulator"
ditto "${DERIVED_DATA_PATH}/Build/Products/Release-watchsimulator/CryptoSwift.framework" "${OUTPUT_DIR}/watchsimulator/CryptoSwift.framework"
rm -rf "${DERIVED_DATA_PATH}"
# XCFRAMEWORK
rm -rf ${SCRIPT_DIR}/../CryptoSwift.xcframework
xcrun xcodebuild -quiet -create-xcframework \
-framework "${OUTPUT_DIR}/iphoneos/CryptoSwift.framework" \
-framework "${OUTPUT_DIR}/iphonesimulator/CryptoSwift.framework" \
-framework "${OUTPUT_DIR}/appletvos/CryptoSwift.framework" \
-framework "${OUTPUT_DIR}/appletvsimulator/CryptoSwift.framework" \
-framework "${OUTPUT_DIR}/watchos/CryptoSwift.framework" \
-framework "${OUTPUT_DIR}/watchsimulator/CryptoSwift.framework" \
-framework "${OUTPUT_DIR}/macos/CryptoSwift.framework" \
-framework "${OUTPUT_DIR}/maccatalyst/CryptoSwift.framework" \
-output ${SCRIPT_DIR}/../CryptoSwift.xcframework
# pushd ${OUTPUT_DIR}
# xcrun zip --symlinks -r -o ${BASE_PWD}/CryptoSwift.xcframework.zip CryptoSwift.xcframework
# popd
echo "✔️ CryptoSwift.xcframework"
echo ${OUTPUT_DIR}
rm -rf ${OUTPUT_DIR}
cd ${BASE_PWD}