-
Notifications
You must be signed in to change notification settings - Fork 0
/
create-xcframework.sh
executable file
·78 lines (66 loc) · 2.16 KB
/
create-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
#!/bin/bash
set -eo pipefail
pushd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null
DERIVED_DATA_PATH=".DerivedData-Archive.noindex"
ARCHIVES_ROOT_PATH="Archives"
rm -rf "$DERIVED_DATA_PATH"
rm -rf "$ARCHIVES_ROOT_PATH"
mkdir -p "$ARCHIVES_ROOT_PATH"
CREATE_XCFRAMEWORK_ARGUMENTS=()
for PLATFORM in "macOS" "macOS,variant=Mac Catalyst" "iOS" "iOS Simulator" "tvOS" "tvOS Simulator" "watchOS" "watchOS Simulator"; do
case $PLATFORM in
"macOS")
ARCHIVE_NAME="Release-macos"
SCHEME="TypedNotificationCenter macOS"
;;
"macOS,variant=Mac Catalyst")
ARCHIVE_NAME="Release-maccatalyst"
SCHEME="TypedNotificationCenter iOS"
;;
"iOS")
ARCHIVE_NAME="Release-iphoneos"
SCHEME="TypedNotificationCenter iOS"
;;
"iOS Simulator")
ARCHIVE_NAME="Release-iphonesimulator"
SCHEME="TypedNotificationCenter iOS"
;;
"tvOS")
ARCHIVE_NAME="Release-tvos"
SCHEME="TypedNotificationCenter tvOS"
;;
"tvOS Simulator")
ARCHIVE_NAME="Release-tvossimulator"
SCHEME="TypedNotificationCenter tvOS"
;;
"watchOS")
ARCHIVE_NAME="Release-watchos"
SCHEME="TypedNotificationCenter watchOS"
;;
"watchOS Simulator")
ARCHIVE_NAME="Release-watchsimulator"
SCHEME="TypedNotificationCenter watchOS"
;;
esac
ARCHIVE_PATH="$ARCHIVES_ROOT_PATH/$ARCHIVE_NAME.xcarchive"
LOG_PATH="$ARCHIVES_ROOT_PATH/$ARCHIVE_NAME.log"
xcodebuild archive \
-project "TypedNotificationCenter.xcodeproj" \
-scheme "$SCHEME" \
-destination "generic/platform=$PLATFORM" \
-configuration "Release" \
-archivePath "$ARCHIVE_PATH" \
-derivedDataPath "$DERIVED_DATA_PATH" \
-IDEBuildLocationStyle=Unique \
SKIP_INSTALL=NO \
SWIFT_SERIALIZE_DEBUGGING_OPTIONS=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
| tee "$LOG_PATH"
CREATE_XCFRAMEWORK_ARGUMENTS+=( "-archive" "$PWD/$ARCHIVE_PATH" )
CREATE_XCFRAMEWORK_ARGUMENTS+=( "-framework" "TypedNotificationCenter.framework" )
done
xcodebuild -create-xcframework \
"${CREATE_XCFRAMEWORK_ARGUMENTS[@]}" \
-output "$ARCHIVES_ROOT_PATH/TypedNotificationCenter.xcframework"
# https://developer.apple.com/forums/thread/123253
find "$ARCHIVES_ROOT_PATH/TypedNotificationCenter.xcframework" -name "*.swiftinterface" -exec sed -i -e 's/ TypedNotificationCenter\./ /g' {} \;