@@ -4,77 +4,64 @@ set -euo pipefail
44pushd " $( dirname " $0 " ) " > /dev/null
55cd ../modules/sentry-cocoa
66
7- SHA=$( git rev-parse HEAD)
8- SHAFILE=./Carthage/.built-from-sha
9- if [[ -f $SHAFILE ]]; then
10- SHAFROMFILE=$( < $SHAFILE )
11- else
12- SHAFROMFILE=" "
13- fi
14- VERSION=" $( git describe --tags) ($( git rev-parse --short HEAD) )"
7+ rm -rf Carthage
158
16- if [ " $SHA " == " $SHAFROMFILE " ] ; then
17- echo " Sentry Cocoa SDK $VERSION was already built "
18- else
19- echo " Building Sentry Cocoa SDK $VERSION "
20- rm -rf Carthage
9+ # Grabbing the first SDK versions
10+ sdks= $( xcodebuild -showsdks )
11+ ios_sdk= $( echo " $sdks " | awk ' /iOS SDKs/{getline; print $NF} ' )
12+ ios_simulator_sdk= $( echo " $sdks " | awk ' /iOS Simulator SDKs/{getline; print $NF} ' )
13+ macos_sdk= $( echo " $sdks " | awk ' /macOS SDKs/{getline; print $NF} ' )
2114
22- # Grabbing the first SDK versions
23- sdks=$( xcodebuild -showsdks)
24- ios_sdk=$( echo " $sdks " | awk ' /iOS SDKs/{getline; print $NF}' )
25- ios_simulator_sdk=$( echo " $sdks " | awk ' /iOS Simulator SDKs/{getline; print $NF}' )
26- macos_sdk=$( echo " $sdks " | awk ' /macOS SDKs/{getline; print $NF}' )
15+ # Note - We keep the build output in separate directories so that .NET
16+ # bundles iOS with net6.0-ios and Mac Catalyst with net6.0-maccatalyst.
17+ # The lack of symlinks in the ios builds, means we should also be able
18+ # to use the package on Windows with "Pair to Mac".
2719
28- # Note - We keep the build output in separate directories so that .NET
29- # bundles iOS with net6.0-ios and Mac Catalyst with net6.0-maccatalyst.
30- # The lack of symlinks in the ios builds, means we should also be able
31- # to use the package on Windows with "Pair to Mac".
20+ # Build for iOS and iOS simulator.
21+ xcodebuild -project Sentry.xcodeproj \
22+ -scheme Sentry \
23+ -configuration Release \
24+ -sdk " $ios_sdk " \
25+ -derivedDataPath ./Carthage/output-ios
26+ xcodebuild -project Sentry.xcodeproj \
27+ -scheme Sentry \
28+ -configuration Release \
29+ -sdk " $ios_simulator_sdk " \
30+ -derivedDataPath ./Carthage/output-ios
31+ xcodebuild -create-xcframework \
32+ -framework ./Carthage/output-ios/Build/Products/Release-iphoneos/Sentry.framework \
33+ -framework ./Carthage/output-ios/Build/Products/Release-iphonesimulator/Sentry.framework \
34+ -output ./Carthage/Build-ios/Sentry.xcframework
3235
33- # Build for iOS and iOS simulator.
34- xcodebuild -project Sentry.xcodeproj \
35- -scheme Sentry \
36- -configuration Release \
37- -sdk " $ios_sdk " \
38- -derivedDataPath ./Carthage/output-ios
39- xcodebuild -project Sentry.xcodeproj \
40- -scheme Sentry \
41- -configuration Release \
42- -sdk " $ios_simulator_sdk " \
43- -derivedDataPath ./Carthage/output-ios
44- xcodebuild -create-xcframework \
45- -framework ./Carthage/output-ios/Build/Products/Release-iphoneos/Sentry.framework \
46- -framework ./Carthage/output-ios/Build/Products/Release-iphonesimulator/Sentry.framework \
47- -output ./Carthage/Build-ios/Sentry.xcframework
36+ # Build for macOS.
37+ xcodebuild -project Sentry.xcodeproj \
38+ -scheme Sentry \
39+ -configuration Release \
40+ -sdk " $macos_sdk " \
41+ -derivedDataPath ./Carthage/output-macos
42+ xcodebuild -create-xcframework \
43+ -framework ./Carthage/output-macos/Build/Products/Release/Sentry.framework \
44+ -output ./Carthage/Build-macos/Sentry.xcframework
4845
49- # Build for macOS.
50- xcodebuild -project Sentry.xcodeproj \
51- -scheme Sentry \
52- -configuration Release \
53- -sdk " $macos_sdk " \
54- -derivedDataPath ./Carthage/output-macos
55- xcodebuild -create-xcframework \
56- -framework ./Carthage/output-macos /Build/Products/Release/Sentry.framework \
57- -output ./Carthage/Build-macos /Sentry.xcframework
46+ # Separately, build for Mac Catalyst
47+ xcodebuild -project Sentry.xcodeproj \
48+ -scheme Sentry \
49+ -configuration Release \
50+ -destination ' platform=macOS,variant=Mac Catalyst ' \
51+ -derivedDataPath ./Carthage/output-maccatalyst
52+ xcodebuild -create-xcframework \
53+ -framework ./Carthage/output-maccatalyst /Build/Products/Release-maccatalyst /Sentry.framework \
54+ -output ./Carthage/Build-maccatalyst /Sentry.xcframework
5855
59- # Separately, build for Mac Catalyst
60- xcodebuild -project Sentry.xcodeproj \
61- -scheme Sentry \
62- -configuration Release \
63- -destination ' platform=macOS,variant=Mac Catalyst' \
64- -derivedDataPath ./Carthage/output-maccatalyst
65- xcodebuild -create-xcframework \
66- -framework ./Carthage/output-maccatalyst/Build/Products/Release-maccatalyst/Sentry.framework \
67- -output ./Carthage/Build-maccatalyst/Sentry.xcframework
68-
69- # Copy headers - used for generating bindings
70- mkdir Carthage/Headers
71- find Carthage/Build-ios/Sentry.xcframework/ios-arm64 -name ' *.h' -exec cp {} Carthage/Headers \;
72-
73- echo " $SHA " > " $SHAFILE "
74- echo " "
75- fi
56+ # Copy headers - used for generating bindings
57+ mkdir Carthage/Headers
58+ find Carthage/Build-ios/Sentry.xcframework/ios-arm64 -name ' *.h' -exec cp {} Carthage/Headers \;
7659
7760# Remove anything we don't want to bundle in the nuget package.
7861find Carthage/Build* \( -name Headers -o -name PrivateHeaders -o -name Modules \) -exec rm -rf {} +
62+ rm -rf Carthage/output-*
63+
64+ cp ../../.git/modules/modules/sentry-cocoa/HEAD Carthage/.built-from-sha
65+ echo " "
7966
8067popd > /dev/null
0 commit comments