Skip to content

Commit 7659cbe

Browse files
authored
SPM Support (#2280)
1 parent ea6d86d commit 7659cbe

28 files changed

+149
-50
lines changed

.github/workflows/flutter.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,33 @@ jobs:
9797
;;
9898
esac
9999
100+
spm:
101+
name: "SPM"
102+
runs-on: macos-15
103+
timeout-minutes: 30
104+
defaults:
105+
run:
106+
shell: bash
107+
working-directory: flutter/example
108+
strategy:
109+
fail-fast: false
110+
matrix:
111+
target: [ios, macos]
112+
113+
steps:
114+
- uses: actions/checkout@v4
115+
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 # [email protected]
116+
with:
117+
channel: main
118+
- run: flutter upgrade
119+
- run: flutter config --enable-swift-package-manager
120+
- name: Run on iOS
121+
if: matrix.target == 'ios'
122+
run: flutter build ios --no-codesign
123+
- name: Run on macOS
124+
if: matrix.target == 'macos'
125+
run: flutter build macos
126+
100127
analyze:
101128
uses: ./.github/workflows/analyze.yml
102129
with:

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Features
66

77
- Add SentryReplayQuality setting (`options.experimental.replay.quality`) ([#2582](https://github.com/getsentry/sentry-dart/pull/2582))
8+
- SPM Support ([#2280](https://github.com/getsentry/sentry-dart/pull/2280))
89

910
### Dependencies
1011

flutter/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,8 @@ build/
1010
.cxx/
1111

1212
.vscode/launch.json
13+
cocoa_bindings_temp
14+
15+
ios/sentry_flutter/Package.resolved
16+
1317
temp

flutter/ios/.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,8 @@ Icon?
3434
.tags*
3535

3636
/Flutter/Generated.xcconfig
37-
/Flutter/flutter_export_environment.sh
37+
/Flutter/flutter_export_environment.sh
38+
39+
.build
40+
.swiftpm
41+
Package.resolved

flutter/ios/Assets/.gitkeep

Whitespace-only changes.

flutter/ios/Classes/SentryFlutterPlugin.h

Lines changed: 0 additions & 10 deletions
This file was deleted.

flutter/ios/Classes/SentryFlutterPlugin.m

Lines changed: 0 additions & 15 deletions
This file was deleted.

flutter/ios/sentry_flutter.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ Sentry SDK for Flutter with support to native through sentry-cocoa.
1414
s.authors = "Sentry"
1515
s.source = { :git => "https://github.com/getsentry/sentry-dart.git",
1616
:tag => s.version.to_s }
17-
s.source_files = 'Classes/**/*'
18-
s.public_header_files = 'Classes/**/*.h'
17+
s.source_files = 'sentry_flutter/Sources/**/*'
18+
s.public_header_files = 'sentry_flutter/Sources/**/*.h'
1919
s.dependency 'Sentry/HybridSDK', '8.43.0'
2020
s.ios.dependency 'Flutter'
2121
s.osx.dependency 'FlutterMacOS'

flutter/ios/sentry_flutter/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// swift-tools-version: 5.9
2+
// The swift-tools-version declares the minimum version of Swift required to build this package.
3+
4+
import PackageDescription
5+
6+
let package = Package(
7+
name: "sentry_flutter",
8+
platforms: [
9+
.iOS("12.0"),
10+
.macOS("10.13")
11+
],
12+
products: [
13+
.library(name: "sentry-flutter", targets: ["sentry_flutter", "sentry_flutter_objc"])
14+
],
15+
dependencies: [
16+
.package(url: "https://github.com/getsentry/sentry-cocoa", from: "8.43.0")
17+
],
18+
targets: [
19+
.target(
20+
name: "sentry_flutter",
21+
dependencies: [
22+
"sentry_flutter_objc",
23+
.product(name: "Sentry", package: "sentry-cocoa")
24+
]
25+
),
26+
// SPM does not support mixed-language targets, so we need to move the ObjC files into a separate one
27+
.target(
28+
name: "sentry_flutter_objc",
29+
dependencies: [
30+
.product(name: "Sentry", package: "sentry-cocoa")
31+
]
32+
)
33+
]
34+
)

0 commit comments

Comments
 (0)