From 8adbf8ea65785d1dc3232c5d3f24ce5e693ccf2a Mon Sep 17 00:00:00 2001 From: Denis Andrasec Date: Tue, 10 Sep 2024 13:39:03 +0200 Subject: [PATCH 01/19] update folder structiure to support SPM --- flutter/.gitignore | 3 ++ flutter/example/ios/Runner/AppDelegate.swift | 2 +- flutter/ios/Assets/.gitkeep | 0 flutter/ios/sentry_flutter.podspec | 4 +-- .../contents.xcworkspacedata | 7 ++++ flutter/ios/sentry_flutter/Package.swift | 36 +++++++++++++++++++ .../sentry_flutter}/SentryFlutterPlugin.m | 2 +- .../SentryFlutterReplayBreadcrumbConverter.m | 2 +- .../SentryFlutterReplayScreenshotProvider.m | 0 .../include}/SentryFlutterPlugin.h | 0 .../SentryFlutterReplayBreadcrumbConverter.h | 0 .../SentryFlutterReplayScreenshotProvider.h | 0 .../sentry_flutter_swift}/SentryFlutter.swift | 0 .../SentryFlutterPluginApple.swift | 6 ++-- 14 files changed, 54 insertions(+), 8 deletions(-) delete mode 100644 flutter/ios/Assets/.gitkeep create mode 100644 flutter/ios/sentry_flutter/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata create mode 100644 flutter/ios/sentry_flutter/Package.swift rename flutter/ios/{Classes => sentry_flutter/Sources/sentry_flutter}/SentryFlutterPlugin.m (93%) rename flutter/ios/{Classes => sentry_flutter/Sources/sentry_flutter}/SentryFlutterReplayBreadcrumbConverter.m (98%) rename flutter/ios/{Classes => sentry_flutter/Sources/sentry_flutter}/SentryFlutterReplayScreenshotProvider.m (100%) rename flutter/ios/{Classes => sentry_flutter/Sources/sentry_flutter/include}/SentryFlutterPlugin.h (100%) rename flutter/ios/{Classes => sentry_flutter/Sources/sentry_flutter/include}/SentryFlutterReplayBreadcrumbConverter.h (100%) rename flutter/ios/{Classes => sentry_flutter/Sources/sentry_flutter/include}/SentryFlutterReplayScreenshotProvider.h (100%) rename flutter/ios/{Classes => sentry_flutter/Sources/sentry_flutter_swift}/SentryFlutter.swift (100%) rename flutter/ios/{Classes => sentry_flutter/Sources/sentry_flutter_swift}/SentryFlutterPluginApple.swift (98%) diff --git a/flutter/.gitignore b/flutter/.gitignore index 068bf84155..f2353fd551 100644 --- a/flutter/.gitignore +++ b/flutter/.gitignore @@ -11,3 +11,6 @@ build/ .vscode/launch.json cocoa_bindings_temp + +ios/sentry_flutter/Package.resolved + diff --git a/flutter/example/ios/Runner/AppDelegate.swift b/flutter/example/ios/Runner/AppDelegate.swift index a231cc9c60..c24cacbbb2 100644 --- a/flutter/example/ios/Runner/AppDelegate.swift +++ b/flutter/example/ios/Runner/AppDelegate.swift @@ -2,7 +2,7 @@ import UIKit import Flutter import Sentry -@UIApplicationMain +@main @objc class AppDelegate: FlutterAppDelegate { private let _channel = "example.flutter.sentry.io" diff --git a/flutter/ios/Assets/.gitkeep b/flutter/ios/Assets/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/flutter/ios/sentry_flutter.podspec b/flutter/ios/sentry_flutter.podspec index 86a06e8179..0be9ede4ae 100644 --- a/flutter/ios/sentry_flutter.podspec +++ b/flutter/ios/sentry_flutter.podspec @@ -14,8 +14,8 @@ Sentry SDK for Flutter with support to native through sentry-cocoa. s.authors = "Sentry" s.source = { :git => "https://github.com/getsentry/sentry-dart.git", :tag => s.version.to_s } - s.source_files = 'Classes/**/*' - s.public_header_files = 'Classes/**/*.h' + s.source_files = 'sentry_flutter/Sources/**/*' + s.public_header_files = 'sentry_flutter/Sources/**/*.h' s.dependency 'Sentry/HybridSDK', '8.36.0' s.ios.dependency 'Flutter' s.osx.dependency 'FlutterMacOS' diff --git a/flutter/ios/sentry_flutter/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata b/flutter/ios/sentry_flutter/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000000..919434a625 --- /dev/null +++ b/flutter/ios/sentry_flutter/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/flutter/ios/sentry_flutter/Package.swift b/flutter/ios/sentry_flutter/Package.swift new file mode 100644 index 0000000000..ba607ece67 --- /dev/null +++ b/flutter/ios/sentry_flutter/Package.swift @@ -0,0 +1,36 @@ +// swift-tools-version: 5.9 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "sentry_flutter", + platforms: [ + .iOS("12.0"), + .macOS("10.13") + ], + products: [ + .library(name: "sentry-flutter", targets: ["sentry_flutter", "sentry_flutter_swift"]) + ], + dependencies: [ + .package(url: "https://github.com/getsentry/sentry-cocoa", from: "8.36.0"), + ], + targets: [ + .target( + name: "sentry_flutter", + dependencies: [ + "sentry_flutter_swift", + .product(name: "Sentry", package: "sentry-cocoa") + ], + publicHeadersPath:"include" + ), + // SPM does not support mixed-language, so we need to move the swift files into a separate target + .target( + name: "sentry_flutter_swift", + dependencies: [ + .product(name: "Sentry", package: "sentry-cocoa") + ], + publicHeadersPath:"include" + ) + ] +) diff --git a/flutter/ios/Classes/SentryFlutterPlugin.m b/flutter/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.m similarity index 93% rename from flutter/ios/Classes/SentryFlutterPlugin.m rename to flutter/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.m index f541e31c0e..1510a06d55 100644 --- a/flutter/ios/Classes/SentryFlutterPlugin.m +++ b/flutter/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.m @@ -1,4 +1,4 @@ -#import "SentryFlutterPlugin.h" +#import "include/SentryFlutterPlugin.h" #if __has_include() #import #else diff --git a/flutter/ios/Classes/SentryFlutterReplayBreadcrumbConverter.m b/flutter/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutterReplayBreadcrumbConverter.m similarity index 98% rename from flutter/ios/Classes/SentryFlutterReplayBreadcrumbConverter.m rename to flutter/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutterReplayBreadcrumbConverter.m index bde889b6bf..60d32e1c82 100644 --- a/flutter/ios/Classes/SentryFlutterReplayBreadcrumbConverter.m +++ b/flutter/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutterReplayBreadcrumbConverter.m @@ -1,4 +1,4 @@ -#import "SentryFlutterReplayBreadcrumbConverter.h" +#import "include/SentryFlutterReplayBreadcrumbConverter.h" @import Sentry; diff --git a/flutter/ios/Classes/SentryFlutterReplayScreenshotProvider.m b/flutter/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutterReplayScreenshotProvider.m similarity index 100% rename from flutter/ios/Classes/SentryFlutterReplayScreenshotProvider.m rename to flutter/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutterReplayScreenshotProvider.m diff --git a/flutter/ios/Classes/SentryFlutterPlugin.h b/flutter/ios/sentry_flutter/Sources/sentry_flutter/include/SentryFlutterPlugin.h similarity index 100% rename from flutter/ios/Classes/SentryFlutterPlugin.h rename to flutter/ios/sentry_flutter/Sources/sentry_flutter/include/SentryFlutterPlugin.h diff --git a/flutter/ios/Classes/SentryFlutterReplayBreadcrumbConverter.h b/flutter/ios/sentry_flutter/Sources/sentry_flutter/include/SentryFlutterReplayBreadcrumbConverter.h similarity index 100% rename from flutter/ios/Classes/SentryFlutterReplayBreadcrumbConverter.h rename to flutter/ios/sentry_flutter/Sources/sentry_flutter/include/SentryFlutterReplayBreadcrumbConverter.h diff --git a/flutter/ios/Classes/SentryFlutterReplayScreenshotProvider.h b/flutter/ios/sentry_flutter/Sources/sentry_flutter/include/SentryFlutterReplayScreenshotProvider.h similarity index 100% rename from flutter/ios/Classes/SentryFlutterReplayScreenshotProvider.h rename to flutter/ios/sentry_flutter/Sources/sentry_flutter/include/SentryFlutterReplayScreenshotProvider.h diff --git a/flutter/ios/Classes/SentryFlutter.swift b/flutter/ios/sentry_flutter/Sources/sentry_flutter_swift/SentryFlutter.swift similarity index 100% rename from flutter/ios/Classes/SentryFlutter.swift rename to flutter/ios/sentry_flutter/Sources/sentry_flutter_swift/SentryFlutter.swift diff --git a/flutter/ios/Classes/SentryFlutterPluginApple.swift b/flutter/ios/sentry_flutter/Sources/sentry_flutter_swift/SentryFlutterPluginApple.swift similarity index 98% rename from flutter/ios/Classes/SentryFlutterPluginApple.swift rename to flutter/ios/sentry_flutter/Sources/sentry_flutter_swift/SentryFlutterPluginApple.swift index 24e50cc166..1e343209e4 100644 --- a/flutter/ios/Classes/SentryFlutterPluginApple.swift +++ b/flutter/ios/sentry_flutter/Sources/sentry_flutter_swift/SentryFlutterPluginApple.swift @@ -341,9 +341,9 @@ public class SentryFlutterPluginApple: NSObject, FlutterPlugin { #if canImport(UIKit) && !SENTRY_NO_UIKIT #if os(iOS) || os(tvOS) - let breadcrumbConverter = SentryFlutterReplayBreadcrumbConverter() - let screenshotProvider = SentryFlutterReplayScreenshotProvider(channel: self.channel) - PrivateSentrySDKOnly.configureSessionReplay(with: breadcrumbConverter, screenshotProvider: screenshotProvider) + let breadcrumbConverter = SentryFlutterReplayBreadcrumbConverter() + let screenshotProvider = SentryFlutterReplayScreenshotProvider(channel: self.channel) + PrivateSentrySDKOnly.configureSessionReplay(with: breadcrumbConverter, screenshotProvider: screenshotProvider) #endif #endif From 0ccc10ec197b3094cfcfccd731d1f3bd3f2e8874 Mon Sep 17 00:00:00 2001 From: Denis Andrasec Date: Tue, 1 Oct 2024 14:17:58 +0200 Subject: [PATCH 02/19] remove trailing comma --- flutter/ios/sentry_flutter/Package.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flutter/ios/sentry_flutter/Package.swift b/flutter/ios/sentry_flutter/Package.swift index ba607ece67..4e4dcba690 100644 --- a/flutter/ios/sentry_flutter/Package.swift +++ b/flutter/ios/sentry_flutter/Package.swift @@ -13,7 +13,7 @@ let package = Package( .library(name: "sentry-flutter", targets: ["sentry_flutter", "sentry_flutter_swift"]) ], dependencies: [ - .package(url: "https://github.com/getsentry/sentry-cocoa", from: "8.36.0"), + .package(url: "https://github.com/getsentry/sentry-cocoa", from: "8.36.0") ], targets: [ .target( From a2afc01402b73cbca30b1cf21bee50fd6a50b98a Mon Sep 17 00:00:00 2001 From: Denis Andrasec Date: Tue, 1 Oct 2024 15:12:43 +0200 Subject: [PATCH 03/19] update folder structure for mac --- flutter/macos/sentry_flutter/Package.swift | Bin 0 -> 1064 bytes .../sentry_flutter}/SentryFlutterPlugin.h | 0 .../sentry_flutter}/SentryFlutterPlugin.m | 0 .../sentry_flutter_swift}/SentryFlutter.swift | 0 .../SentryFlutterPluginApple.swift | 0 5 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 flutter/macos/sentry_flutter/Package.swift rename flutter/macos/{Classes => sentry_flutter/Sources/sentry_flutter}/SentryFlutterPlugin.h (100%) rename flutter/macos/{Classes => sentry_flutter/Sources/sentry_flutter}/SentryFlutterPlugin.m (100%) rename flutter/macos/{Classes => sentry_flutter/Sources/sentry_flutter_swift}/SentryFlutter.swift (100%) rename flutter/macos/{Classes => sentry_flutter/Sources/sentry_flutter_swift}/SentryFlutterPluginApple.swift (100%) diff --git a/flutter/macos/sentry_flutter/Package.swift b/flutter/macos/sentry_flutter/Package.swift new file mode 100644 index 0000000000000000000000000000000000000000..a9a8c115070afaeca47f285955db10d2fe045028 GIT binary patch literal 1064 zcmY+DKTH#07{ky?dX)>cHFqa}w#vll zV3gGf69Xx6k-@=%-9;mdi371d&-MKZ_a@JMzvq3w`~KYb-BPu>st`|XFKoxa z)KM$5Z81I>zdqL{`V0HnhEwWW3#u@!><4H^V;D-!`;O;>wJ$mq_q3mLo>uA4NPpj{ z1m31n=Of-M+Fqc}O0HCX76gu`I2Gq`F~WsN|A)GZ>XQ7dy}W8acCP#DZYe-+ka%a8@XVaRtoK zE!n_f;g#?#*-!76-=Cpte`I{)oKhvX?2IRq$xhUHCim=Rw-QwSmBgKC{l0p!_38)e zCu_QW?YJiU!8@b5v~?pjlQ%~*xwM%|WwK^AV~v=3Yb0&u^V2iAF-x!iIp=|X_eNXh zIDZmtnvDGwEAA4oxo5Ht-b+S!FK!_kHhlJBoPYItontckA^rg$LWesIE=w^6ek(i$ z-VweJJ`kQi#Rc$J$+skw+Lm)@2mh6P4BR349`K}a96TW03my_qfLDZv!FqgSPpLy0 ivj>b)81X&aAITdBC;ek!o-yO%QR5#VUj@IE@&5xkl5*Do literal 0 HcmV?d00001 diff --git a/flutter/macos/Classes/SentryFlutterPlugin.h b/flutter/macos/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.h similarity index 100% rename from flutter/macos/Classes/SentryFlutterPlugin.h rename to flutter/macos/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.h diff --git a/flutter/macos/Classes/SentryFlutterPlugin.m b/flutter/macos/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.m similarity index 100% rename from flutter/macos/Classes/SentryFlutterPlugin.m rename to flutter/macos/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.m diff --git a/flutter/macos/Classes/SentryFlutter.swift b/flutter/macos/sentry_flutter/Sources/sentry_flutter_swift/SentryFlutter.swift similarity index 100% rename from flutter/macos/Classes/SentryFlutter.swift rename to flutter/macos/sentry_flutter/Sources/sentry_flutter_swift/SentryFlutter.swift diff --git a/flutter/macos/Classes/SentryFlutterPluginApple.swift b/flutter/macos/sentry_flutter/Sources/sentry_flutter_swift/SentryFlutterPluginApple.swift similarity index 100% rename from flutter/macos/Classes/SentryFlutterPluginApple.swift rename to flutter/macos/sentry_flutter/Sources/sentry_flutter_swift/SentryFlutterPluginApple.swift From 9a635fafdc7b3cf67213ecc696855f9be83f971c Mon Sep 17 00:00:00 2001 From: Denis Andrasec Date: Tue, 5 Nov 2024 16:40:26 +0100 Subject: [PATCH 04/19] fix spm import --- flutter/ios/sentry_flutter/Package.swift | 3 +-- .../sentry_flutter/SentryFlutterPlugin.m | 23 +++++++++++-------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/flutter/ios/sentry_flutter/Package.swift b/flutter/ios/sentry_flutter/Package.swift index 4e4dcba690..efa2d99aff 100644 --- a/flutter/ios/sentry_flutter/Package.swift +++ b/flutter/ios/sentry_flutter/Package.swift @@ -29,8 +29,7 @@ let package = Package( name: "sentry_flutter_swift", dependencies: [ .product(name: "Sentry", package: "sentry-cocoa") - ], - publicHeadersPath:"include" + ] ) ] ) diff --git a/flutter/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.m b/flutter/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.m index 1510a06d55..a5561161c2 100644 --- a/flutter/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.m +++ b/flutter/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.m @@ -1,15 +1,20 @@ #import "include/SentryFlutterPlugin.h" -#if __has_include() -#import -#else -// Support project import fallback if the generated compatibility header -// is not copied when this plugin is created as a library. -// https://forums.swift.org/t/swift-static-libraries-dont-copy-generated-objective-c-header/19816 -#import "sentry_flutter-Swift.h" -#endif + +// TODO Check if this kind of import is requirred for cocoapods + +//#if __has_include() +//#import +//#else +//// Support project import fallback if the generated compatibility header +//// is not copied when this plugin is created as a library. +//// https://forums.swift.org/t/swift-static-libraries-dont-copy-generated-objective-c-header/19816 +//#import "sentry_flutter-Swift.h" +//#endif + +@import sentry_flutter_swift; @implementation SentryFlutterPlugin + (void)registerWithRegistrar:(NSObject*)registrar { - [SentryFlutterPluginApple registerWithRegistrar:registrar]; + [SentryFlutterPluginApple registerWithRegistrar:registrar]; } @end From 6034522071f33ac22efbf23d4eed8727152e24f2 Mon Sep 17 00:00:00 2001 From: Denis Andrasec Date: Tue, 5 Nov 2024 17:37:59 +0100 Subject: [PATCH 05/19] update to import correctly (u uses locally build Swift.framwork for sim only --- flutter/ios/.gitignore | 6 +++++- flutter/ios/sentry_flutter/Package.swift | 21 +++++++++++++++---- .../sentry_flutter/SentryFlutterPlugin.m | 2 +- .../include/SentryFlutterPlugin.h | 6 +++--- .../SentryFlutterReplayBreadcrumbConverter.m | 4 ++++ .../SentryFlutterReplayScreenshotProvider.m | 4 ++++ .../SentryFlutterReplayBreadcrumbConverter.h | 0 .../SentryFlutterReplayScreenshotProvider.h | 0 .../SentryFlutterPluginApple.swift | 6 ++++++ 9 files changed, 40 insertions(+), 9 deletions(-) rename flutter/ios/sentry_flutter/Sources/{sentry_flutter => sentry_flutter_objc}/SentryFlutterReplayBreadcrumbConverter.m (99%) rename flutter/ios/sentry_flutter/Sources/{sentry_flutter => sentry_flutter_objc}/SentryFlutterReplayScreenshotProvider.m (97%) rename flutter/ios/sentry_flutter/Sources/{sentry_flutter => sentry_flutter_objc}/include/SentryFlutterReplayBreadcrumbConverter.h (100%) rename flutter/ios/sentry_flutter/Sources/{sentry_flutter => sentry_flutter_objc}/include/SentryFlutterReplayScreenshotProvider.h (100%) diff --git a/flutter/ios/.gitignore b/flutter/ios/.gitignore index aa479fd3ce..d10a0d4773 100644 --- a/flutter/ios/.gitignore +++ b/flutter/ios/.gitignore @@ -34,4 +34,8 @@ Icon? .tags* /Flutter/Generated.xcconfig -/Flutter/flutter_export_environment.sh \ No newline at end of file +/Flutter/flutter_export_environment.sh + +.build +.swiftpm +Package.resolved diff --git a/flutter/ios/sentry_flutter/Package.swift b/flutter/ios/sentry_flutter/Package.swift index efa2d99aff..ffd9a5305b 100644 --- a/flutter/ios/sentry_flutter/Package.swift +++ b/flutter/ios/sentry_flutter/Package.swift @@ -10,17 +10,18 @@ let package = Package( .macOS("10.13") ], products: [ - .library(name: "sentry-flutter", targets: ["sentry_flutter", "sentry_flutter_swift"]) + .library(name: "sentry-flutter", targets: ["sentry_flutter", "sentry_flutter_swift", "sentry_flutter_objc"]) ], dependencies: [ - .package(url: "https://github.com/getsentry/sentry-cocoa", from: "8.36.0") +// .package(url: "https://github.com/getsentry/sentry-cocoa", from: "8.36.0") ], targets: [ .target( name: "sentry_flutter", dependencies: [ "sentry_flutter_swift", - .product(name: "Sentry", package: "sentry-cocoa") +// .target(name: "Sentry") +// .product(name: "Sentry", package: "sentry-cocoa") ], publicHeadersPath:"include" ), @@ -28,8 +29,20 @@ let package = Package( .target( name: "sentry_flutter_swift", dependencies: [ - .product(name: "Sentry", package: "sentry-cocoa") + .target(name: "sentry_flutter_objc"), + .target(name: "Sentry") +// .product(name: "Sentry", package: "sentry-cocoa") ] + ), + .target( + name: "sentry_flutter_objc", + dependencies: [ + .target(name: "Sentry") + ] + ), + .binaryTarget( + name: "Sentry", + path: "Sentry.xcframework" ) ] ) diff --git a/flutter/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.m b/flutter/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.m index a5561161c2..6b6d1a10c7 100644 --- a/flutter/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.m +++ b/flutter/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.m @@ -1,6 +1,6 @@ #import "include/SentryFlutterPlugin.h" -// TODO Check if this kind of import is requirred for cocoapods +// TODO Check if this kind of import is required for cocoapods //#if __has_include() //#import diff --git a/flutter/ios/sentry_flutter/Sources/sentry_flutter/include/SentryFlutterPlugin.h b/flutter/ios/sentry_flutter/Sources/sentry_flutter/include/SentryFlutterPlugin.h index d1a1af035c..358ab446ca 100644 --- a/flutter/ios/sentry_flutter/Sources/sentry_flutter/include/SentryFlutterPlugin.h +++ b/flutter/ios/sentry_flutter/Sources/sentry_flutter/include/SentryFlutterPlugin.h @@ -1,7 +1,7 @@ -#if TARGET_OS_IPHONE - #import -#else +#if TARGET_OS_OSX #import +#else + #import #endif @interface SentryFlutterPlugin : NSObject diff --git a/flutter/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutterReplayBreadcrumbConverter.m b/flutter/ios/sentry_flutter/Sources/sentry_flutter_objc/SentryFlutterReplayBreadcrumbConverter.m similarity index 99% rename from flutter/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutterReplayBreadcrumbConverter.m rename to flutter/ios/sentry_flutter/Sources/sentry_flutter_objc/SentryFlutterReplayBreadcrumbConverter.m index 60d32e1c82..22f05fdd8f 100644 --- a/flutter/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutterReplayBreadcrumbConverter.m +++ b/flutter/ios/sentry_flutter/Sources/sentry_flutter_objc/SentryFlutterReplayBreadcrumbConverter.m @@ -2,6 +2,10 @@ @import Sentry; +#if SWIFT_PACKAGE +@import Sentry.HybridSDK; +#endif + #if SENTRY_TARGET_REPLAY_SUPPORTED @implementation SentryFlutterReplayBreadcrumbConverter { diff --git a/flutter/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutterReplayScreenshotProvider.m b/flutter/ios/sentry_flutter/Sources/sentry_flutter_objc/SentryFlutterReplayScreenshotProvider.m similarity index 97% rename from flutter/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutterReplayScreenshotProvider.m rename to flutter/ios/sentry_flutter/Sources/sentry_flutter_objc/SentryFlutterReplayScreenshotProvider.m index b363cf5342..addc8f48c8 100644 --- a/flutter/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutterReplayScreenshotProvider.m +++ b/flutter/ios/sentry_flutter/Sources/sentry_flutter_objc/SentryFlutterReplayScreenshotProvider.m @@ -1,5 +1,9 @@ @import Sentry; +#if SWIFT_PACKAGE +@import Sentry.HybridSDK; +#endif + #if SENTRY_TARGET_REPLAY_SUPPORTED #import "SentryFlutterReplayScreenshotProvider.h" #import diff --git a/flutter/ios/sentry_flutter/Sources/sentry_flutter/include/SentryFlutterReplayBreadcrumbConverter.h b/flutter/ios/sentry_flutter/Sources/sentry_flutter_objc/include/SentryFlutterReplayBreadcrumbConverter.h similarity index 100% rename from flutter/ios/sentry_flutter/Sources/sentry_flutter/include/SentryFlutterReplayBreadcrumbConverter.h rename to flutter/ios/sentry_flutter/Sources/sentry_flutter_objc/include/SentryFlutterReplayBreadcrumbConverter.h diff --git a/flutter/ios/sentry_flutter/Sources/sentry_flutter/include/SentryFlutterReplayScreenshotProvider.h b/flutter/ios/sentry_flutter/Sources/sentry_flutter_objc/include/SentryFlutterReplayScreenshotProvider.h similarity index 100% rename from flutter/ios/sentry_flutter/Sources/sentry_flutter/include/SentryFlutterReplayScreenshotProvider.h rename to flutter/ios/sentry_flutter/Sources/sentry_flutter_objc/include/SentryFlutterReplayScreenshotProvider.h diff --git a/flutter/ios/sentry_flutter/Sources/sentry_flutter_swift/SentryFlutterPluginApple.swift b/flutter/ios/sentry_flutter/Sources/sentry_flutter_swift/SentryFlutterPluginApple.swift index 112a4d79de..3689b073fe 100644 --- a/flutter/ios/sentry_flutter/Sources/sentry_flutter_swift/SentryFlutterPluginApple.swift +++ b/flutter/ios/sentry_flutter/Sources/sentry_flutter_swift/SentryFlutterPluginApple.swift @@ -1,4 +1,10 @@ import Sentry + +#if SWIFT_PACKAGE +import Sentry.HybridSDK +import sentry_flutter_objc +#endif + #if os(iOS) import Flutter import UIKit From acc2ff0991fa2e01cf27a46082612cd8a8f8743b Mon Sep 17 00:00:00 2001 From: Denis Andrasec Date: Wed, 6 Nov 2024 11:10:10 +0100 Subject: [PATCH 06/19] move to swift as main spm package --- flutter/ios/sentry_flutter/Package.swift | 15 +++----------- .../SentryFlutter.swift | 0 .../sentry_flutter/SentryFlutterPlugin.m | 20 ------------------- .../SentryFlutterPlugin.swift} | 10 +++++----- .../include/SentryFlutterPlugin.h | 8 -------- 5 files changed, 8 insertions(+), 45 deletions(-) rename flutter/ios/sentry_flutter/Sources/{sentry_flutter_swift => sentry_flutter}/SentryFlutter.swift (100%) delete mode 100644 flutter/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.m rename flutter/ios/sentry_flutter/Sources/{sentry_flutter_swift/SentryFlutterPluginApple.swift => sentry_flutter/SentryFlutterPlugin.swift} (98%) delete mode 100644 flutter/ios/sentry_flutter/Sources/sentry_flutter/include/SentryFlutterPlugin.h diff --git a/flutter/ios/sentry_flutter/Package.swift b/flutter/ios/sentry_flutter/Package.swift index ffd9a5305b..570181751c 100644 --- a/flutter/ios/sentry_flutter/Package.swift +++ b/flutter/ios/sentry_flutter/Package.swift @@ -10,7 +10,7 @@ let package = Package( .macOS("10.13") ], products: [ - .library(name: "sentry-flutter", targets: ["sentry_flutter", "sentry_flutter_swift", "sentry_flutter_objc"]) + .library(name: "sentry-flutter", targets: ["sentry_flutter", "sentry_flutter_objc"]) ], dependencies: [ // .package(url: "https://github.com/getsentry/sentry-cocoa", from: "8.36.0") @@ -19,21 +19,12 @@ let package = Package( .target( name: "sentry_flutter", dependencies: [ - "sentry_flutter_swift", -// .target(name: "Sentry") -// .product(name: "Sentry", package: "sentry-cocoa") - ], - publicHeadersPath:"include" - ), - // SPM does not support mixed-language, so we need to move the swift files into a separate target - .target( - name: "sentry_flutter_swift", - dependencies: [ - .target(name: "sentry_flutter_objc"), + "sentry_flutter_objc", .target(name: "Sentry") // .product(name: "Sentry", package: "sentry-cocoa") ] ), + // SPM does not support mixed-language targets, so we need to move the ObjC files into a separate one .target( name: "sentry_flutter_objc", dependencies: [ diff --git a/flutter/ios/sentry_flutter/Sources/sentry_flutter_swift/SentryFlutter.swift b/flutter/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutter.swift similarity index 100% rename from flutter/ios/sentry_flutter/Sources/sentry_flutter_swift/SentryFlutter.swift rename to flutter/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutter.swift diff --git a/flutter/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.m b/flutter/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.m deleted file mode 100644 index 6b6d1a10c7..0000000000 --- a/flutter/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.m +++ /dev/null @@ -1,20 +0,0 @@ -#import "include/SentryFlutterPlugin.h" - -// TODO Check if this kind of import is required for cocoapods - -//#if __has_include() -//#import -//#else -//// Support project import fallback if the generated compatibility header -//// is not copied when this plugin is created as a library. -//// https://forums.swift.org/t/swift-static-libraries-dont-copy-generated-objective-c-header/19816 -//#import "sentry_flutter-Swift.h" -//#endif - -@import sentry_flutter_swift; - -@implementation SentryFlutterPlugin -+ (void)registerWithRegistrar:(NSObject*)registrar { - [SentryFlutterPluginApple registerWithRegistrar:registrar]; -} -@end diff --git a/flutter/ios/sentry_flutter/Sources/sentry_flutter_swift/SentryFlutterPluginApple.swift b/flutter/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.swift similarity index 98% rename from flutter/ios/sentry_flutter/Sources/sentry_flutter_swift/SentryFlutterPluginApple.swift rename to flutter/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.swift index 3689b073fe..0d7d2f9e0e 100644 --- a/flutter/ios/sentry_flutter/Sources/sentry_flutter_swift/SentryFlutterPluginApple.swift +++ b/flutter/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.swift @@ -17,7 +17,7 @@ import CoreVideo // swiftlint:disable file_length function_body_length // swiftlint:disable:next type_body_length -public class SentryFlutterPluginApple: NSObject, FlutterPlugin { +public class SentryFlutterPlugin: NSObject, FlutterPlugin { private let channel: FlutterMethodChannel private static let nativeClientName = "sentry.cocoa.flutter" @@ -45,7 +45,7 @@ public class SentryFlutterPluginApple: NSObject, FlutterPlugin { let channel = FlutterMethodChannel(name: "sentry_flutter", binaryMessenger: registrar.messenger) #endif - let instance = SentryFlutterPluginApple(channel: channel) + let instance = SentryFlutterPlugin(channel: channel) instance.registerObserver() registrar.addMethodCallDelegate(instance, channel: channel) } @@ -306,7 +306,7 @@ public class SentryFlutterPluginApple: NSObject, FlutterPlugin { } let version = PrivateSentrySDKOnly.getSdkVersionString() - PrivateSentrySDKOnly.setSdkName(SentryFlutterPluginApple.nativeClientName, andVersionString: version) + PrivateSentrySDKOnly.setSdkName(SentryFlutterPlugin.nativeClientName, andVersionString: version) // note : for now, in sentry-cocoa, beforeSend is not called before captureEnvelope options.beforeSend = { event in @@ -368,7 +368,7 @@ public class SentryFlutterPluginApple: NSObject, FlutterPlugin { if isValidSdk(sdk: sdk) { switch sdk["name"] as? String { - case SentryFlutterPluginApple.nativeClientName: + case SentryFlutterPlugin.nativeClientName: #if os(OSX) let origin = "mac" #elseif os(watchOS) @@ -483,7 +483,7 @@ public class SentryFlutterPluginApple: NSObject, FlutterPlugin { let isColdStart = appStartMeasurement.type == .cold let item: [String: Any] = [ - "pluginRegistrationTime": SentryFlutterPluginApple.pluginRegistrationTime, + "pluginRegistrationTime": SentryFlutterPlugin.pluginRegistrationTime, "appStartTime": appStartTime, "isColdStart": isColdStart, "nativeSpanTimes": nativeSpanTimes diff --git a/flutter/ios/sentry_flutter/Sources/sentry_flutter/include/SentryFlutterPlugin.h b/flutter/ios/sentry_flutter/Sources/sentry_flutter/include/SentryFlutterPlugin.h deleted file mode 100644 index 358ab446ca..0000000000 --- a/flutter/ios/sentry_flutter/Sources/sentry_flutter/include/SentryFlutterPlugin.h +++ /dev/null @@ -1,8 +0,0 @@ -#if TARGET_OS_OSX - #import -#else - #import -#endif - -@interface SentryFlutterPlugin : NSObject -@end From 160e5a5a1d19fb23eebee4cf52d1543819629601 Mon Sep 17 00:00:00 2001 From: Denis Andrasec Date: Wed, 6 Nov 2024 12:28:55 +0100 Subject: [PATCH 07/19] setup macOS --- flutter/macos/sentry_flutter/Package.swift | Bin 1064 -> 38 bytes .../Sources/sentry_flutter/SentryFlutter.swift | 1 + .../sentry_flutter/SentryFlutterPlugin.swift | 1 + .../SentryFlutterReplayBreadcrumbConverter.m | 1 + .../SentryFlutterReplayScreenshotProvider.m | 1 + .../SentryFlutterReplayBreadcrumbConverter.h | 1 + .../SentryFlutterReplayScreenshotProvider.h | 1 + .../sentry_flutter_swift/SentryFlutter.swift | 1 - .../SentryFlutterPluginApple.swift | 1 - 9 files changed, 6 insertions(+), 2 deletions(-) mode change 100644 => 120000 flutter/macos/sentry_flutter/Package.swift create mode 120000 flutter/macos/sentry_flutter/Sources/sentry_flutter/SentryFlutter.swift create mode 120000 flutter/macos/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.swift create mode 120000 flutter/macos/sentry_flutter/Sources/sentry_flutter_objc/SentryFlutterReplayBreadcrumbConverter.m create mode 120000 flutter/macos/sentry_flutter/Sources/sentry_flutter_objc/SentryFlutterReplayScreenshotProvider.m create mode 120000 flutter/macos/sentry_flutter/Sources/sentry_flutter_objc/include/SentryFlutterReplayBreadcrumbConverter.h create mode 120000 flutter/macos/sentry_flutter/Sources/sentry_flutter_objc/include/SentryFlutterReplayScreenshotProvider.h delete mode 120000 flutter/macos/sentry_flutter/Sources/sentry_flutter_swift/SentryFlutter.swift delete mode 120000 flutter/macos/sentry_flutter/Sources/sentry_flutter_swift/SentryFlutterPluginApple.swift diff --git a/flutter/macos/sentry_flutter/Package.swift b/flutter/macos/sentry_flutter/Package.swift deleted file mode 100644 index a9a8c115070afaeca47f285955db10d2fe045028..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1064 zcmY+DKTH#07{ky?dX)>cHFqa}w#vll zV3gGf69Xx6k-@=%-9;mdi371d&-MKZ_a@JMzvq3w`~KYb-BPu>st`|XFKoxa z)KM$5Z81I>zdqL{`V0HnhEwWW3#u@!><4H^V;D-!`;O;>wJ$mq_q3mLo>uA4NPpj{ z1m31n=Of-M+Fqc}O0HCX76gu`I2Gq`F~WsN|A)GZ>XQ7dy}W8acCP#DZYe-+ka%a8@XVaRtoK zE!n_f;g#?#*-!76-=Cpte`I{)oKhvX?2IRq$xhUHCim=Rw-QwSmBgKC{l0p!_38)e zCu_QW?YJiU!8@b5v~?pjlQ%~*xwM%|WwK^AV~v=3Yb0&u^V2iAF-x!iIp=|X_eNXh zIDZmtnvDGwEAA4oxo5Ht-b+S!FK!_kHhlJBoPYItontckA^rg$LWesIE=w^6ek(i$ z-VweJJ`kQi#Rc$J$+skw+Lm)@2mh6P4BR349`K}a96TW03my_qfLDZv!FqgSPpLy0 ivj>b)81X&aAITdBC;ek!o-yO%QR5#VUj@IE@&5xkl5*Do diff --git a/flutter/macos/sentry_flutter/Package.swift b/flutter/macos/sentry_flutter/Package.swift new file mode 120000 index 0000000000..fe0be63eb8 --- /dev/null +++ b/flutter/macos/sentry_flutter/Package.swift @@ -0,0 +1 @@ +../../ios/sentry_flutter/Package.swift \ No newline at end of file diff --git a/flutter/macos/sentry_flutter/Sources/sentry_flutter/SentryFlutter.swift b/flutter/macos/sentry_flutter/Sources/sentry_flutter/SentryFlutter.swift new file mode 120000 index 0000000000..9fbb9bb436 --- /dev/null +++ b/flutter/macos/sentry_flutter/Sources/sentry_flutter/SentryFlutter.swift @@ -0,0 +1 @@ +../../../../ios/sentry_flutter/Sources/sentry_flutter/SentryFlutter.swift \ No newline at end of file diff --git a/flutter/macos/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.swift b/flutter/macos/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.swift new file mode 120000 index 0000000000..30044f0967 --- /dev/null +++ b/flutter/macos/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.swift @@ -0,0 +1 @@ +../../../../ios/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.swift \ No newline at end of file diff --git a/flutter/macos/sentry_flutter/Sources/sentry_flutter_objc/SentryFlutterReplayBreadcrumbConverter.m b/flutter/macos/sentry_flutter/Sources/sentry_flutter_objc/SentryFlutterReplayBreadcrumbConverter.m new file mode 120000 index 0000000000..a015af93e4 --- /dev/null +++ b/flutter/macos/sentry_flutter/Sources/sentry_flutter_objc/SentryFlutterReplayBreadcrumbConverter.m @@ -0,0 +1 @@ +../../../../ios/sentry_flutter/Sources/sentry_flutter_objc/SentryFlutterReplayBreadcrumbConverter.m \ No newline at end of file diff --git a/flutter/macos/sentry_flutter/Sources/sentry_flutter_objc/SentryFlutterReplayScreenshotProvider.m b/flutter/macos/sentry_flutter/Sources/sentry_flutter_objc/SentryFlutterReplayScreenshotProvider.m new file mode 120000 index 0000000000..e0b12e88bb --- /dev/null +++ b/flutter/macos/sentry_flutter/Sources/sentry_flutter_objc/SentryFlutterReplayScreenshotProvider.m @@ -0,0 +1 @@ +../../../../ios/sentry_flutter/Sources/sentry_flutter_objc/SentryFlutterReplayScreenshotProvider.m \ No newline at end of file diff --git a/flutter/macos/sentry_flutter/Sources/sentry_flutter_objc/include/SentryFlutterReplayBreadcrumbConverter.h b/flutter/macos/sentry_flutter/Sources/sentry_flutter_objc/include/SentryFlutterReplayBreadcrumbConverter.h new file mode 120000 index 0000000000..a1f59a3999 --- /dev/null +++ b/flutter/macos/sentry_flutter/Sources/sentry_flutter_objc/include/SentryFlutterReplayBreadcrumbConverter.h @@ -0,0 +1 @@ +../../../../../ios/sentry_flutter/Sources/sentry_flutter_objc/include/SentryFlutterReplayBreadcrumbConverter.h \ No newline at end of file diff --git a/flutter/macos/sentry_flutter/Sources/sentry_flutter_objc/include/SentryFlutterReplayScreenshotProvider.h b/flutter/macos/sentry_flutter/Sources/sentry_flutter_objc/include/SentryFlutterReplayScreenshotProvider.h new file mode 120000 index 0000000000..1c8b3852ca --- /dev/null +++ b/flutter/macos/sentry_flutter/Sources/sentry_flutter_objc/include/SentryFlutterReplayScreenshotProvider.h @@ -0,0 +1 @@ +../../../../../ios/sentry_flutter/Sources/sentry_flutter_objc/include/SentryFlutterReplayScreenshotProvider.h \ No newline at end of file diff --git a/flutter/macos/sentry_flutter/Sources/sentry_flutter_swift/SentryFlutter.swift b/flutter/macos/sentry_flutter/Sources/sentry_flutter_swift/SentryFlutter.swift deleted file mode 120000 index ea42d8c01c..0000000000 --- a/flutter/macos/sentry_flutter/Sources/sentry_flutter_swift/SentryFlutter.swift +++ /dev/null @@ -1 +0,0 @@ -../../ios/Classes/SentryFlutter.swift \ No newline at end of file diff --git a/flutter/macos/sentry_flutter/Sources/sentry_flutter_swift/SentryFlutterPluginApple.swift b/flutter/macos/sentry_flutter/Sources/sentry_flutter_swift/SentryFlutterPluginApple.swift deleted file mode 120000 index 1ac6c4f5be..0000000000 --- a/flutter/macos/sentry_flutter/Sources/sentry_flutter_swift/SentryFlutterPluginApple.swift +++ /dev/null @@ -1 +0,0 @@ -../../ios/Classes/SentryFlutterPluginApple.swift \ No newline at end of file From 31fcd63631317c810a06ab8e55731e5924b08450 Mon Sep 17 00:00:00 2001 From: Denis Andrasec Date: Wed, 6 Nov 2024 13:58:03 +0100 Subject: [PATCH 08/19] prefix hybrid import with _ --- .../Sources/sentry_flutter/SentryFlutterPlugin.swift | 2 +- .../SentryFlutterReplayBreadcrumbConverter.m | 2 +- .../sentry_flutter_objc/SentryFlutterReplayScreenshotProvider.m | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/flutter/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.swift b/flutter/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.swift index 0d7d2f9e0e..2fdcbf12d2 100644 --- a/flutter/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.swift +++ b/flutter/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.swift @@ -1,7 +1,7 @@ import Sentry #if SWIFT_PACKAGE -import Sentry.HybridSDK +import Sentry._HybridSDK import sentry_flutter_objc #endif diff --git a/flutter/ios/sentry_flutter/Sources/sentry_flutter_objc/SentryFlutterReplayBreadcrumbConverter.m b/flutter/ios/sentry_flutter/Sources/sentry_flutter_objc/SentryFlutterReplayBreadcrumbConverter.m index 22f05fdd8f..1891bcd2b8 100644 --- a/flutter/ios/sentry_flutter/Sources/sentry_flutter_objc/SentryFlutterReplayBreadcrumbConverter.m +++ b/flutter/ios/sentry_flutter/Sources/sentry_flutter_objc/SentryFlutterReplayBreadcrumbConverter.m @@ -3,7 +3,7 @@ @import Sentry; #if SWIFT_PACKAGE -@import Sentry.HybridSDK; +@import Sentry._HybridSDK; #endif #if SENTRY_TARGET_REPLAY_SUPPORTED diff --git a/flutter/ios/sentry_flutter/Sources/sentry_flutter_objc/SentryFlutterReplayScreenshotProvider.m b/flutter/ios/sentry_flutter/Sources/sentry_flutter_objc/SentryFlutterReplayScreenshotProvider.m index addc8f48c8..18bb858b2e 100644 --- a/flutter/ios/sentry_flutter/Sources/sentry_flutter_objc/SentryFlutterReplayScreenshotProvider.m +++ b/flutter/ios/sentry_flutter/Sources/sentry_flutter_objc/SentryFlutterReplayScreenshotProvider.m @@ -1,7 +1,7 @@ @import Sentry; #if SWIFT_PACKAGE -@import Sentry.HybridSDK; +@import Sentry._HybridSDK; #endif #if SENTRY_TARGET_REPLAY_SUPPORTED From 866fe0f499c7033ce9eaa4064dd9be9a027255d7 Mon Sep 17 00:00:00 2001 From: Denis Andrasec Date: Wed, 6 Nov 2024 14:34:04 +0100 Subject: [PATCH 09/19] add cl entry, update hybrid module name --- CHANGELOG.md | 2 ++ flutter/ios/sentry_flutter/Package.swift | 1 + .../Sources/sentry_flutter/SentryFlutterPlugin.swift | 2 +- .../SentryFlutterReplayBreadcrumbConverter.m | 2 +- .../sentry_flutter_objc/SentryFlutterReplayScreenshotProvider.m | 2 +- .../sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.h | 1 - .../sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.m | 1 - 7 files changed, 6 insertions(+), 5 deletions(-) delete mode 120000 flutter/macos/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.h delete mode 120000 flutter/macos/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.m diff --git a/CHANGELOG.md b/CHANGELOG.md index 9260793a20..86d5c41726 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,8 @@ ); ``` +- SPM Support ([#2280](https://github.com/getsentry/sentry-dart/pull/2280)) + ### Enhancements - Cache parsed DSN ([#2365](https://github.com/getsentry/sentry-dart/pull/2365)) diff --git a/flutter/ios/sentry_flutter/Package.swift b/flutter/ios/sentry_flutter/Package.swift index 570181751c..f9313dc447 100644 --- a/flutter/ios/sentry_flutter/Package.swift +++ b/flutter/ios/sentry_flutter/Package.swift @@ -29,6 +29,7 @@ let package = Package( name: "sentry_flutter_objc", dependencies: [ .target(name: "Sentry") +// .product(name: "Sentry", package: "sentry-cocoa") ] ), .binaryTarget( diff --git a/flutter/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.swift b/flutter/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.swift index 2fdcbf12d2..652ef19941 100644 --- a/flutter/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.swift +++ b/flutter/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.swift @@ -1,7 +1,7 @@ import Sentry #if SWIFT_PACKAGE -import Sentry._HybridSDK +import Sentry._Hybrid import sentry_flutter_objc #endif diff --git a/flutter/ios/sentry_flutter/Sources/sentry_flutter_objc/SentryFlutterReplayBreadcrumbConverter.m b/flutter/ios/sentry_flutter/Sources/sentry_flutter_objc/SentryFlutterReplayBreadcrumbConverter.m index 1891bcd2b8..060bbbd80a 100644 --- a/flutter/ios/sentry_flutter/Sources/sentry_flutter_objc/SentryFlutterReplayBreadcrumbConverter.m +++ b/flutter/ios/sentry_flutter/Sources/sentry_flutter_objc/SentryFlutterReplayBreadcrumbConverter.m @@ -3,7 +3,7 @@ @import Sentry; #if SWIFT_PACKAGE -@import Sentry._HybridSDK; +@import Sentry._Hybrid; #endif #if SENTRY_TARGET_REPLAY_SUPPORTED diff --git a/flutter/ios/sentry_flutter/Sources/sentry_flutter_objc/SentryFlutterReplayScreenshotProvider.m b/flutter/ios/sentry_flutter/Sources/sentry_flutter_objc/SentryFlutterReplayScreenshotProvider.m index 18bb858b2e..864744c539 100644 --- a/flutter/ios/sentry_flutter/Sources/sentry_flutter_objc/SentryFlutterReplayScreenshotProvider.m +++ b/flutter/ios/sentry_flutter/Sources/sentry_flutter_objc/SentryFlutterReplayScreenshotProvider.m @@ -1,7 +1,7 @@ @import Sentry; #if SWIFT_PACKAGE -@import Sentry._HybridSDK; +@import Sentry._Hybrid; #endif #if SENTRY_TARGET_REPLAY_SUPPORTED diff --git a/flutter/macos/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.h b/flutter/macos/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.h deleted file mode 120000 index 4e043862d2..0000000000 --- a/flutter/macos/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.h +++ /dev/null @@ -1 +0,0 @@ -../../ios/Classes/SentryFlutterPlugin.h \ No newline at end of file diff --git a/flutter/macos/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.m b/flutter/macos/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.m deleted file mode 120000 index 99905179b3..0000000000 --- a/flutter/macos/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.m +++ /dev/null @@ -1 +0,0 @@ -../../ios/Classes/SentryFlutterPlugin.m \ No newline at end of file From bb6d8ac9e63ce030421a25ec641a3e7a25174961 Mon Sep 17 00:00:00 2001 From: Denis Andrasec Date: Wed, 6 Nov 2024 14:39:32 +0100 Subject: [PATCH 10/19] add spm to guthub workflow --- .github/workflows/flutter.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/.github/workflows/flutter.yml b/.github/workflows/flutter.yml index 95dfe52727..8be229c2ed 100644 --- a/.github/workflows/flutter.yml +++ b/.github/workflows/flutter.yml @@ -143,6 +143,33 @@ jobs: ;; esac + spm: + name: "SPM" + runs-on: macos-15 + timeout-minutes: 30 + defaults: + run: + shell: bash + working-directory: flutter/example + strategy: + fail-fast: false + matrix: + target: [ios, macos] + + steps: + - uses: actions/checkout@v4 + - uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 # pin@v2.16.0 + with: + channel: main + - run: flutter upgrade + - run: flutter config --enable-swift-package-manager + - name: Run on iOS + if: matrix.target == 'ios' + run: flutter run -d "iPhone 16 Pro" + - name: Run on macOS + if: matrix.target == 'macos' + run: flutter run -d "macOS" + analyze: uses: ./.github/workflows/analyze.yml with: From a4e2e384b91413394e50796a5313ead53ec53908 Mon Sep 17 00:00:00 2001 From: Denis Andrasec Date: Wed, 6 Nov 2024 14:41:12 +0100 Subject: [PATCH 11/19] update Package.swift to use remote sentry-cocoa --- flutter/ios/sentry_flutter/Package.swift | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/flutter/ios/sentry_flutter/Package.swift b/flutter/ios/sentry_flutter/Package.swift index f9313dc447..29536ee220 100644 --- a/flutter/ios/sentry_flutter/Package.swift +++ b/flutter/ios/sentry_flutter/Package.swift @@ -13,15 +13,14 @@ let package = Package( .library(name: "sentry-flutter", targets: ["sentry_flutter", "sentry_flutter_objc"]) ], dependencies: [ -// .package(url: "https://github.com/getsentry/sentry-cocoa", from: "8.36.0") + .package(url: "https://github.com/getsentry/sentry-cocoa", from: "8.37.0") ], targets: [ .target( name: "sentry_flutter", dependencies: [ "sentry_flutter_objc", - .target(name: "Sentry") -// .product(name: "Sentry", package: "sentry-cocoa") + .product(name: "Sentry", package: "sentry-cocoa") ] ), // SPM does not support mixed-language targets, so we need to move the ObjC files into a separate one @@ -29,12 +28,8 @@ let package = Package( name: "sentry_flutter_objc", dependencies: [ .target(name: "Sentry") -// .product(name: "Sentry", package: "sentry-cocoa") + .product(name: "Sentry", package: "sentry-cocoa") ] - ), - .binaryTarget( - name: "Sentry", - path: "Sentry.xcframework" ) ] ) From 249bb1e27a872f0017dd40425de9c49dbe0b470f Mon Sep 17 00:00:00 2001 From: Denis Andrasec Date: Mon, 11 Nov 2024 16:19:31 +0100 Subject: [PATCH 12/19] bump --- flutter/ios/sentry_flutter/Package.swift | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/flutter/ios/sentry_flutter/Package.swift b/flutter/ios/sentry_flutter/Package.swift index 29536ee220..f7d76a8e31 100644 --- a/flutter/ios/sentry_flutter/Package.swift +++ b/flutter/ios/sentry_flutter/Package.swift @@ -13,7 +13,7 @@ let package = Package( .library(name: "sentry-flutter", targets: ["sentry_flutter", "sentry_flutter_objc"]) ], dependencies: [ - .package(url: "https://github.com/getsentry/sentry-cocoa", from: "8.37.0") + .package(url: "https://github.com/getsentry/sentry-cocoa", from: "8.40.1") ], targets: [ .target( @@ -27,7 +27,6 @@ let package = Package( .target( name: "sentry_flutter_objc", dependencies: [ - .target(name: "Sentry") .product(name: "Sentry", package: "sentry-cocoa") ] ) From 45b985e31082f32a4795053d3f9abd24b8d8133c Mon Sep 17 00:00:00 2001 From: Denis Andrasec Date: Mon, 9 Dec 2024 16:16:41 +0100 Subject: [PATCH 13/19] Bump sentry cocoa version --- flutter/ios/sentry_flutter.podspec | 2 +- flutter/ios/sentry_flutter/Package.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/flutter/ios/sentry_flutter.podspec b/flutter/ios/sentry_flutter.podspec index 14fbc8b88e..01e9560a19 100644 --- a/flutter/ios/sentry_flutter.podspec +++ b/flutter/ios/sentry_flutter.podspec @@ -16,7 +16,7 @@ Sentry SDK for Flutter with support to native through sentry-cocoa. :tag => s.version.to_s } s.source_files = 'Classes/**/*' s.public_header_files = 'Classes/**/*.h' - s.dependency 'Sentry/HybridSDK', '8.41.0' + s.dependency 'Sentry/HybridSDK', '8.42.0-beta2' s.ios.dependency 'Flutter' s.osx.dependency 'FlutterMacOS' s.ios.deployment_target = '12.0' diff --git a/flutter/ios/sentry_flutter/Package.swift b/flutter/ios/sentry_flutter/Package.swift index f7d76a8e31..0c48287249 100644 --- a/flutter/ios/sentry_flutter/Package.swift +++ b/flutter/ios/sentry_flutter/Package.swift @@ -13,7 +13,7 @@ let package = Package( .library(name: "sentry-flutter", targets: ["sentry_flutter", "sentry_flutter_objc"]) ], dependencies: [ - .package(url: "https://github.com/getsentry/sentry-cocoa", from: "8.40.1") + .package(url: "https://github.com/getsentry/sentry-cocoa", from: "8.42.0-beta.2") ], targets: [ .target( From bffad027cf5ef2424038ea8c007b3b9cf5427cca Mon Sep 17 00:00:00 2001 From: Denis Andrasec Date: Wed, 11 Dec 2024 14:55:23 +0100 Subject: [PATCH 14/19] update script to also set sentry-cocoa verison in spm file --- flutter/scripts/update-cocoa.sh | 49 +++++++++++++++++++++++++++------ 1 file changed, 40 insertions(+), 9 deletions(-) diff --git a/flutter/scripts/update-cocoa.sh b/flutter/scripts/update-cocoa.sh index 55f1c854db..36761ec3b7 100755 --- a/flutter/scripts/update-cocoa.sh +++ b/flutter/scripts/update-cocoa.sh @@ -2,25 +2,56 @@ set -euo pipefail cd $(dirname "$0")/../ios -file='sentry_flutter.podspec' -content=$(cat $file) -regex="('Sentry/HybridSDK', *)'([0-9\.]+(\-[a-z0-9\.]+)?)'" -if ! [[ $content =~ $regex ]]; then + +get_podspec_version() { + local file='sentry_flutter.podspec' + local content=$(cat $file) + regex="('Sentry/HybridSDK', *)'([0-9\.]+(\-[a-z0-9\.]+)?)'" + if ! [[ $content =~ $regex ]]; then + echo "Failed to find the plugin version in $file" + exit 1 + else + echo "${BASH_REMATCH[2]}" + fi +} + +set_podspec_version() { + local file='sentry_flutter.podspec' + local content=$(cat $file) + regex="('Sentry/HybridSDK', *)'([0-9\.]+(\-[a-z0-9\.]+)?)'" + if ! [[ $content =~ $regex ]]; then + echo "Failed to find the plugin version in $file" + exit 1 + else + newValue="${BASH_REMATCH[1]}'$1'" + echo "${content/${BASH_REMATCH[0]}/$newValue}" >$file + fi +} + +set_spm_version() { + local file='sentry_flutter/Package.swift' + local content=$(cat $file) + regex="(url: *['\"]https://github.com/getsentry/sentry-cocoa['\"], *from: *)['\"]([0-9\.]+(-[a-z0-9\.]+)?)['\"]" + if ! [[ $content =~ $regex ]]; then echo "Failed to find the plugin version in $file" exit 1 -fi + else + newValue="${BASH_REMATCH[1]}\"$1\"" + echo "${content/${BASH_REMATCH[0]}/$newValue}" >$file + fi +} case $1 in get-version) - echo ${BASH_REMATCH[2]} + echo $(get_podspec_version) ;; get-repo) echo "https://github.com/getsentry/sentry-cocoa.git" ;; set-version) - newValue="${BASH_REMATCH[1]}'$2'" - echo "${content/${BASH_REMATCH[0]}/$newValue}" >$file - ../scripts/generate-cocoa-bindings.sh "$2" + set_podspec_version "$2" + set_spm_version "$2" +# ../scripts/generate-cocoa-bindings.sh "$2" ;; *) echo "Unknown argument $1" From a6d93f25a28528414e95459151781e58ee871490 Mon Sep 17 00:00:00 2001 From: Denis Andrasec Date: Tue, 17 Dec 2024 13:43:11 +0100 Subject: [PATCH 15/19] fix cl --- CHANGELOG.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 690ee71f38..d0d4510ead 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Enhancements - Warning (in a debug build) if a potentially sensitive widget is not masked or unmasked explicitly ([#2375](https://github.com/getsentry/sentry-dart/pull/2375)) +- SPM Support ([#2280](https://github.com/getsentry/sentry-dart/pull/2280)) ### Dependencies @@ -344,8 +345,6 @@ ); ``` -- SPM Support ([#2280](https://github.com/getsentry/sentry-dart/pull/2280)) - ### Enhancements - Avoid sending too many empty client reports when Http Transport is used ([#2380](https://github.com/getsentry/sentry-dart/pull/2380)) From b1b32ca745a0935df0ca52a887ad08d07a66c447 Mon Sep 17 00:00:00 2001 From: Denis Andrasec Date: Tue, 17 Dec 2024 14:18:38 +0100 Subject: [PATCH 16/19] Bump to release version --- flutter/ios/sentry_flutter.podspec | 2 +- flutter/ios/sentry_flutter/Package.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/flutter/ios/sentry_flutter.podspec b/flutter/ios/sentry_flutter.podspec index 01e9560a19..6c714c0f6c 100644 --- a/flutter/ios/sentry_flutter.podspec +++ b/flutter/ios/sentry_flutter.podspec @@ -16,7 +16,7 @@ Sentry SDK for Flutter with support to native through sentry-cocoa. :tag => s.version.to_s } s.source_files = 'Classes/**/*' s.public_header_files = 'Classes/**/*.h' - s.dependency 'Sentry/HybridSDK', '8.42.0-beta2' + s.dependency 'Sentry/HybridSDK', '8.42.0' s.ios.dependency 'Flutter' s.osx.dependency 'FlutterMacOS' s.ios.deployment_target = '12.0' diff --git a/flutter/ios/sentry_flutter/Package.swift b/flutter/ios/sentry_flutter/Package.swift index 0c48287249..a6ddb423c6 100644 --- a/flutter/ios/sentry_flutter/Package.swift +++ b/flutter/ios/sentry_flutter/Package.swift @@ -13,7 +13,7 @@ let package = Package( .library(name: "sentry-flutter", targets: ["sentry_flutter", "sentry_flutter_objc"]) ], dependencies: [ - .package(url: "https://github.com/getsentry/sentry-cocoa", from: "8.42.0-beta.2") + .package(url: "https://github.com/getsentry/sentry-cocoa", from: "8.42.0") ], targets: [ .target( From b50e0b8fd0e26aa8b95220dc4dae9552c8aaa1e7 Mon Sep 17 00:00:00 2001 From: Denis Andrasec Date: Tue, 17 Dec 2024 15:39:14 +0100 Subject: [PATCH 17/19] =?UTF-8?q?only=20build=20and=20don=E2=80=99t=20run?= =?UTF-8?q?=20with=20spm=20support?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/flutter.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/flutter.yml b/.github/workflows/flutter.yml index 3bc8778604..56201f65ba 100644 --- a/.github/workflows/flutter.yml +++ b/.github/workflows/flutter.yml @@ -165,10 +165,10 @@ jobs: - run: flutter config --enable-swift-package-manager - name: Run on iOS if: matrix.target == 'ios' - run: flutter run -d "iPhone 16 Pro" + run: flutter build ios --no-codesign - name: Run on macOS if: matrix.target == 'macos' - run: flutter run -d "macOS" + run: flutter build macos analyze: uses: ./.github/workflows/analyze.yml From cf145b9758cbc4c04b97de43058981b37aa40794 Mon Sep 17 00:00:00 2001 From: Denis Andrasec Date: Tue, 17 Dec 2024 15:45:28 +0100 Subject: [PATCH 18/19] fix pods file --- flutter/ios/sentry_flutter.podspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flutter/ios/sentry_flutter.podspec b/flutter/ios/sentry_flutter.podspec index 6c714c0f6c..6aad8150b6 100644 --- a/flutter/ios/sentry_flutter.podspec +++ b/flutter/ios/sentry_flutter.podspec @@ -14,8 +14,8 @@ Sentry SDK for Flutter with support to native through sentry-cocoa. s.authors = "Sentry" s.source = { :git => "https://github.com/getsentry/sentry-dart.git", :tag => s.version.to_s } - s.source_files = 'Classes/**/*' - s.public_header_files = 'Classes/**/*.h' + s.source_files = 'sentry_flutter/Sources/**/*' + s.public_header_files = 'sentry_flutter/Sources/**/*.h' s.dependency 'Sentry/HybridSDK', '8.42.0' s.ios.dependency 'Flutter' s.osx.dependency 'FlutterMacOS' From 5f38dda43d6089d75ecfa04ec72dd6d921adb849 Mon Sep 17 00:00:00 2001 From: Denis Andrasec Date: Thu, 19 Dec 2024 11:11:03 +0100 Subject: [PATCH 19/19] remove lefover comment --- flutter/scripts/update-cocoa.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/flutter/scripts/update-cocoa.sh b/flutter/scripts/update-cocoa.sh index 36761ec3b7..21f9ef4fb3 100755 --- a/flutter/scripts/update-cocoa.sh +++ b/flutter/scripts/update-cocoa.sh @@ -51,7 +51,6 @@ get-repo) set-version) set_podspec_version "$2" set_spm_version "$2" -# ../scripts/generate-cocoa-bindings.sh "$2" ;; *) echo "Unknown argument $1"