From 626b91bc890ecd47b9e08dd197494d5098b55377 Mon Sep 17 00:00:00 2001 From: Dhiogo Brustolin Date: Wed, 20 Mar 2024 17:23:18 +0100 Subject: [PATCH] fix: Sentry.framework does not support the minimum OS Version specified in the Info.plist (#3774) Static framework was failing Xcode validation because of minimum os version --- CHANGELOG.md | 1 + Sentry.podspec | 3 +-- scripts/build-xcframework.sh | 24 +++++++++++++++++++++--- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a8100becf6..8fd6506b563 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Fixes +- Sentry.framework does not support the minimum OS Version specified in the Info.plist (#3774) - Add reference to Swift classes for hybrid SDKs (#3771) ## 8.22.2 diff --git a/Sentry.podspec b/Sentry.podspec index 26bc280e0aa..11e177689aa 100644 --- a/Sentry.podspec +++ b/Sentry.podspec @@ -42,8 +42,7 @@ Pod::Spec.new do |s| s.subspec 'HybridSDK' do |sp| sp.source_files = "Sources/Sentry/**/*.{h,hpp,m,mm,c,cpp}", - "Sources/SentryCrash/**/*.{h,hpp,m,mm,c,cpp}", "Sources/Swift/**/*.{swift,h,hpp,m,mm,c,cpp}", - "Sources/Sentry/include/module.modulemap" + "Sources/SentryCrash/**/*.{h,hpp,m,mm,c,cpp}", "Sources/Swift/**/*.{swift,h,hpp,m,mm,c,cpp}" sp.public_header_files = "Sources/Sentry/Public/*.h", "Sources/Sentry/include/HybridPublic/*.h" diff --git a/scripts/build-xcframework.sh b/scripts/build-xcframework.sh index 2ce08f9b2ec..f6e538bdc23 100755 --- a/scripts/build-xcframework.sh +++ b/scripts/build-xcframework.sh @@ -1,5 +1,7 @@ #!/bin/bash +set -eou pipefail + sdks=( iphoneos iphonesimulator macosx appletvos appletvsimulator watchos watchsimulator xros xrsimulator ) rm -rf Carthage/ @@ -18,9 +20,20 @@ generate_xcframework() { for sdk in "${sdks[@]}"; do if [[ -n "$(grep "${sdk}" <<< "$ALL_SDKS")" ]]; then - xcodebuild archive -project Sentry.xcodeproj/ -scheme "$scheme" -configuration Release -sdk "$sdk" -archivePath ./Carthage/archive/${scheme}${sufix}/${sdk}.xcarchive CODE_SIGNING_REQUIRED=NO SKIP_INSTALL=NO CODE_SIGN_IDENTITY= CARTHAGE=YES MACH_O_TYPE=$MACH_O_TYPE - + xcodebuild archive -project Sentry.xcodeproj/ -scheme "$scheme" -configuration Release -sdk "$sdk" -archivePath ./Carthage/archive/${scheme}${sufix}/${sdk}.xcarchive CODE_SIGNING_REQUIRED=NO SKIP_INSTALL=NO CODE_SIGN_IDENTITY= CARTHAGE=YES MACH_O_TYPE=$MACH_O_TYPE ENABLE_CODE_COVERAGE=NO + createxcframework+="-framework Carthage/archive/${scheme}${sufix}/${sdk}.xcarchive/Products/Library/Frameworks/${scheme}.framework " + + if [ "$MACH_O_TYPE" = "staticlib" ]; then + local infoPlist="Carthage/archive/${scheme}${sufix}/${sdk}.xcarchive/Products/Library/Frameworks/${scheme}.framework/Info.plist" + + if [ ! -e "$infoPlist" ]; then + infoPlist="Carthage/archive/${scheme}${sufix}/${sdk}.xcarchive/Products/Library/Frameworks/${scheme}.framework/Resources/Info.plist" + fi + # This workaround is necessary to make Sentry Static framework to work + #More information in here: https://github.com/getsentry/sentry-cocoa/issues/3769 + plutil -replace "MinimumOSVersion" -string "9999" "$infoPlist" + fi if [ -d "Carthage/archive/${scheme}${sufix}/${sdk}.xcarchive/dSYMs/${scheme}.framework.dSYM" ]; then # Has debug symbols @@ -32,7 +45,12 @@ generate_xcframework() { done #Create framework for mac catalyst - xcodebuild -project Sentry.xcodeproj/ -scheme "$scheme" -configuration Release -sdk macosx -destination 'platform=macOS,variant=Mac Catalyst' -derivedDataPath ./Carthage/DerivedData CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES MACH_O_TYPE=$MACH_O_TYPE SUPPORTS_MACCATALYST=YES + xcodebuild -project Sentry.xcodeproj/ -scheme "$scheme" -configuration Release -sdk macosx -destination 'platform=macOS,variant=Mac Catalyst' -derivedDataPath ./Carthage/DerivedData CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES MACH_O_TYPE=$MACH_O_TYPE SUPPORTS_MACCATALYST=YES ENABLE_CODE_COVERAGE=NO + + if [ "$MACH_O_TYPE" = "staticlib" ]; then + local infoPlist="Carthage/DerivedData/Build/Products/Release-maccatalyst/${scheme}.framework/Resources/Info.plist" + plutil -replace "MinimumOSVersion" -string "9999" "$infoPlist" + fi createxcframework+="-framework Carthage/DerivedData/Build/Products/Release-maccatalyst/${scheme}.framework " if [ -d "Carthage/DerivedData/Build/Products/Release-maccatalyst/${scheme}.framework.dSYM" ]; then