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