Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions .github/workflows/sample-application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,12 @@ jobs:
ios-use-frameworks: ["no-frameworks"]
build-type: ["dev", "production"]
sentry-consumption: ["xcframework"]
# `xcframework` is the default: RNSentry vendors a prebuilt
# `Sentry-Dynamic.xcframework` downloaded from sentry-cocoa's release.
# Keep a single CocoaPods job to catch regressions in the source-build
# fallback (`SENTRY_USE_XCFRAMEWORK=0`).
include:
- rn-architecture: "new"
ios-use-frameworks: "no-frameworks"
build-type: "production"
sentry-consumption: "cocoapods"
# `xcframework` is the only supported mode: RNSentry vendors a prebuilt
# `Sentry.xcframework` downloaded from sentry-cocoa's release.
# There is no CocoaPods job because the source-build fallback
# (`SENTRY_USE_XCFRAMEWORK=0`) is gone โ€” sentry-cocoa stopped
# publishing to the CocoaPods trunk in 9.20.0, so the podspec raises
# when that opt-out is set.
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

Expand Down Expand Up @@ -105,7 +102,6 @@ jobs:
[[ "${{ matrix.build-type }}" == "production" ]] && export ENABLE_PROD=1 || export ENABLE_PROD=0
[[ "${{ matrix.rn-architecture }}" == "new" ]] && export ENABLE_NEW_ARCH=1 || export ENABLE_NEW_ARCH=0
[[ "${{ matrix.ios-use-frameworks }}" == "dynamic-frameworks" ]] && export USE_FRAMEWORKS=dynamic
[[ "${{ matrix.sentry-consumption }}" == "cocoapods" ]] && export SENTRY_USE_XCFRAMEWORK=0

./scripts/pod-install.sh

Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,19 @@

## Unreleased

### Changes

- Migrate iOS internals from the deprecated `PrivateSentrySDKOnly` SPI to `SentrySDK.internal` ([#6541](https://github.com/getsentry/sentry-react-native/pull/6541))

Re-lands [#6380](https://github.com/getsentry/sentry-react-native/pull/6380), reverted in 8.20.0 by [#6491](https://github.com/getsentry/sentry-react-native/pull/6491) because it broke iOS screenshot capture. The underlying sentry-cocoa bug is fixed in 9.24.0.

<!-- prettier-ignore-start -->
> [!WARNING]
> **Action required if you target React Native < 0.75.**
> `RNSentry` now ships Swift code, which makes it a Swift pod under CocoaPods. If your `Podfile` doesn't already modularize React Native's ObjC pods (RN >= 0.75 does this by default), add `use_modular_headers!` to your `ios/Podfile` before running `pod install`. Otherwise `pod install` fails with an error like:
> `The Swift pod 'RNSentry' depends upon 'React-hermes', which does not define modules.`
<!-- prettier-ignore-end -->

### Fixes

- Make the `RNSentry` SPEC CHECKSUM in `Podfile.lock` machine-independent ([#6534](https://github.com/getsentry/sentry-react-native/pull/6534))
Expand Down Expand Up @@ -41,6 +54,9 @@
- Bump Android SDK from v8.50.1 to v8.51.0 ([#6539](https://github.com/getsentry/sentry-react-native/pull/6539))
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#8510)
- [diff](https://github.com/getsentry/sentry-java/compare/8.50.1...8.51.0)
- Bump Cocoa SDK from v9.19.1 to v9.24.0 ([#6541](https://github.com/getsentry/sentry-react-native/pull/6541))
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#9240)
- [diff](https://github.com/getsentry/sentry-cocoa/compare/9.19.1...9.24.0)
Comment thread
alwx marked this conversation as resolved.

## 8.21.0

Expand Down
21 changes: 20 additions & 1 deletion dev-packages/e2e-tests/patch-scripts/rn.patch.podfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,27 @@ if (currentMatch) {
debug.log('Warning: Could not find platform :ios line to patch');
}

// RNSentry now contains Swift code (via the RNSentryInternal bridge over
// SentrySDK.internal). CocoaPods refuses to integrate a Swift pod against
// non-modular ObjC dependencies (e.g. React-hermes on older RN versions),
// so ensure the Podfile requests modular headers globally.
let modularPatched = false;
if (!content.includes('use_modular_headers!')) {
const patched = content.replace(
/prepare_react_native_project!\s*\n/,
'prepare_react_native_project!\nuse_modular_headers!\n',
);
if (patched !== content) {
content = patched;
modularPatched = true;
debug.log('Patching Podfile with use_modular_headers!');
} else {
debug.log('Warning: Could not find prepare_react_native_project! anchor to inject use_modular_headers!');
}
}

// Write the file if any changes were made
if (shouldPatch || currentMatch) {
if (shouldPatch || currentMatch || modularPatched) {
fs.writeFileSync(args['pod-file'], content);
debug.log('Podfile patched successfully!');
} else {
Expand Down
49 changes: 29 additions & 20 deletions packages/core/RNSentry.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,15 @@ Pod::Spec.new do |s|
# in `android/CMakeLists.txt`. The files are guarded with
# `RCT_NEW_ARCH_ENABLED` so they compile to empty TUs on Old Arch.
#
# We include `.swift` (for `RNSentrySwiftLinkStub.swift`) only on RN >=
# 0.75. Adding a Swift file makes CocoaPods treat RNSentry as a Swift
# pod, which then requires modular headers from its ObjC dependencies
# (React-Core, React-hermes) โ€” RN < 0.75 doesn't emit those, so
# `pod install` fails with:
# "The Swift pod `RNSentry` depends upon `React-hermes`, which does
# not define modules."
# The stub is only needed when linking Sentry.xcframework's Swift
# symbols into a dynamic framework anyway (RN 0.86+ `use_frameworks!
# :dynamic`), so gating on RN 0.75 is safe.
supports_swift_stub = rn_version[:major] >= 1 || (rn_version[:major] == 0 && rn_version[:minor] >= 75)
if supports_swift_stub
s.source_files = 'ios/**/*.{h,m,mm,swift}', 'cpp/**/*.{h,cpp}'
s.swift_versions = ['5.5']
else
s.source_files = 'ios/**/*.{h,m,mm}', 'cpp/**/*.{h,cpp}'
end
# Swift is compiled unconditionally because `RNSentryInternal.swift` is
# the sole ObjCโ†”Swift bridge over `SentrySDK.internal.*` โ€” every `.m`/
# `.mm` file in this pod calls into it. That makes RNSentry a Swift pod
# in CocoaPods' eyes, which in turn requires modular headers from its
# ObjC dependencies. Users on React Native < 0.75 (where `React-hermes`
# and friends aren't modularized by default) must add
# `use_modular_headers!` to their Podfile โ€” see CHANGELOG.
s.source_files = 'ios/**/*.{h,m,mm,swift}', 'cpp/**/*.{h,cpp}'
s.swift_versions = ['5.5']
s.public_header_files = 'ios/RNSentry.h', 'ios/RNSentrySDK.h', 'ios/RNSentryStart.h', 'ios/RNSentryVersion.h', 'ios/RNSentryBreadcrumb.h', 'ios/RNSentryReplay.h', 'ios/RNSentryReplayBreadcrumbConverter.h', 'ios/Replay/RNSentryReplayMask.h', 'ios/Replay/RNSentryReplayUnmask.h', 'ios/RNSentryTimeToDisplay.h'

s.compiler_flags = other_cflags
Expand All @@ -71,7 +63,7 @@ Pod::Spec.new do |s|
'DEFINES_MODULE' => 'YES'
}

sentry_cocoa_version = '9.19.1'
sentry_cocoa_version = '9.24.0'

# Consume sentry-cocoa as a prebuilt `Sentry.xcframework` by default.
#
Expand All @@ -86,7 +78,13 @@ Pod::Spec.new do |s|
# (`Signatures/*.signature` collision during archive).
#
# Set `SENTRY_USE_XCFRAMEWORK=0` to fall back to the source-built
# `Sentry` CocoaPod (e.g. for offline builds behind a restrictive proxy).
# `Sentry` CocoaPod. This fallback is unavailable for sentry-cocoa
# >= 9.20.0: upstream deleted `Sentry.podspec` and dropped the
# `cocoapods` publishing target in that release, so 9.19.1 is the last
# version on the CocoaPods trunk. Opting out therefore raises below
# with an explanation rather than letting CocoaPods fail with an
# opaque "None of your spec sources contain a spec satisfying the
# dependency: `Sentry (= x.y.z)`".
#
# `SENTRY_USE_SPM` was the name in earlier drafts of this PR; honor it as a
# deprecated alias so CI or local envs still exporting `SENTRY_USE_SPM=0`
Expand Down Expand Up @@ -155,7 +153,18 @@ Pod::Spec.new do |s|
pod_target_xcconfig.merge!(xcframework_search_paths)
s.user_target_xcconfig = xcframework_search_paths
else
s.dependency 'Sentry', sentry_cocoa_version
raise <<~MSG
[Sentry] SENTRY_USE_XCFRAMEWORK=0 is no longer supported.

sentry-cocoa stopped publishing to the CocoaPods trunk in 9.20.0
(`Sentry.podspec` was removed upstream), so `pod 'Sentry', '#{sentry_cocoa_version}'`
cannot resolve โ€” 9.19.1 is the last version available there.

Unset SENTRY_USE_XCFRAMEWORK to use the prebuilt `Sentry.xcframework`.
For builds without network access to GitHub Releases, pre-populate the
cache on a machine that has access and point the build at it with
SENTRY_XCFRAMEWORK_CACHE_DIR.
MSG
end

# Assign before `install_modules_dependencies` so it can merge its
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
33DEDFED2D8DC825006066E4 /* RNSentryOnDrawReporter+Test.mm in Sources */ = {isa = PBXBuildFile; fileRef = 33DEDFEC2D8DC820006066E4 /* RNSentryOnDrawReporter+Test.mm */; };
33DEDFF02D9185EB006066E4 /* RNSentryTimeToDisplayTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33DEDFEF2D9185E3006066E4 /* RNSentryTimeToDisplayTests.swift */; };
33F58AD02977037D008F60EA /* RNSentryTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 33F58ACF2977037D008F60EA /* RNSentryTests.m */; };
33F58AD12977037D008F60EB /* RNSentryScreenshotSourceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33F58ACE2977037D008F60EB /* RNSentryScreenshotSourceTests.swift */; };
2639D71D3BD04F17B0BAC987 /* RNSentryTurboModulePerfControllerTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = E795057A6D534A80A9D06356 /* RNSentryTurboModulePerfControllerTests.mm */; };
AEFB00422CC90C4B00EC8A9A /* RNSentryBreadcrumbTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3360843C2C340C76008CC412 /* RNSentryBreadcrumbTests.swift */; };
B4DEB41739F14AA38202D4D4 /* RNSentryUriValidationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E3742693F7643C2ADE1BDF2 /* RNSentryUriValidationTests.m */; };
Expand Down Expand Up @@ -50,6 +51,7 @@
33DEDFEE2D8DD431006066E4 /* RNSentryTimeToDisplay.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = RNSentryTimeToDisplay.h; path = ../ios/RNSentryTimeToDisplay.h; sourceTree = SOURCE_ROOT; };
33DEDFEF2D9185E3006066E4 /* RNSentryTimeToDisplayTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RNSentryTimeToDisplayTests.swift; sourceTree = "<group>"; };
33F58ACF2977037D008F60EA /* RNSentryTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNSentryTests.m; sourceTree = "<group>"; };
33F58ACE2977037D008F60EB /* RNSentryScreenshotSourceTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RNSentryScreenshotSourceTests.swift; sourceTree = "<group>"; };
3E3742693F7643C2ADE1BDF2 /* RNSentryUriValidationTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNSentryUriValidationTests.m; sourceTree = "<group>"; };
650CB718ACFBD05609BF2126 /* libPods-RNSentryCocoaTesterTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RNSentryCocoaTesterTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
E795057A6D534A80A9D06356 /* RNSentryTurboModulePerfControllerTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = RNSentryTurboModulePerfControllerTests.mm; sourceTree = "<group>"; };
Expand Down Expand Up @@ -111,6 +113,7 @@
332D33492CDCC8E100547D76 /* RNSentryTests.h */,
336084382C32E382008CC412 /* RNSentryReplayBreadcrumbConverterTests.swift */,
33F58ACF2977037D008F60EA /* RNSentryTests.m */,
33F58ACE2977037D008F60EB /* RNSentryScreenshotSourceTests.swift */,
3339C4802D6625570088EB3A /* RNSentryUserTests.m */,
3E3742693F7643C2ADE1BDF2 /* RNSentryUriValidationTests.m */,
E795057A6D534A80A9D06356 /* RNSentryTurboModulePerfControllerTests.mm */,
Expand Down Expand Up @@ -267,6 +270,7 @@
336084392C32E382008CC412 /* RNSentryReplayBreadcrumbConverterTests.swift in Sources */,
33DEDFED2D8DC825006066E4 /* RNSentryOnDrawReporter+Test.mm in Sources */,
33F58AD02977037D008F60EA /* RNSentryTests.m in Sources */,
33F58AD12977037D008F60EB /* RNSentryScreenshotSourceTests.swift in Sources */,
3339C4812D6625570088EB3A /* RNSentryUserTests.m in Sources */,
B4DEB41739F14AA38202D4D4 /* RNSentryUriValidationTests.m in Sources */,
2639D71D3BD04F17B0BAC987 /* RNSentryTurboModulePerfControllerTests.mm in Sources */,
Expand Down
Loading
Loading