Skip to content

feat: Add iOS-ObjectiveCpp-NoModules sample reproducing #4543#7433

Merged
philprime merged 13 commits intomainfrom
philprime/objective-cpp-no-modules-sample
Feb 24, 2026
Merged

feat: Add iOS-ObjectiveCpp-NoModules sample reproducing #4543#7433
philprime merged 13 commits intomainfrom
philprime/objective-cpp-no-modules-sample

Conversation

@philprime
Copy link
Copy Markdown
Member

@philprime philprime commented Feb 11, 2026

This PR needs to be merged after #7430

Summary

  • Add a sample project (Samples/iOS-ObjectiveCpp-NoModules) that reproduces the ObjC++ without-modules issue from Replay options not visible from Objective-C without @import #4543
  • The sample uses .mm files with CLANG_ENABLE_MODULES=NO and #import <Sentry/Sentry.h>, which fails with error: use of undeclared identifier 'SentrySDK' since SDK 8.54 moved SentrySDK to Swift
  • This serves as a test case for the pure ObjC SDK wrapper proposed in Create an ObjC SDK #6342 — once implemented, this sample should build successfully

Background

Since SDK 8.54, SentrySDK is a Swift class only visible via Sentry-Swift.h or @import Sentry. Projects that cannot enable Clang modules (React Native ≤0.76, Haxe, custom build systems) can only use #import <Sentry/Sentry.h>, which no longer includes SentrySDK. The sample is intentionally not in the CI build matrix since it does not build with the current SDK.

Test plan

  • xcodegen --spec Samples/iOS-ObjectiveCpp-NoModules/iOS-ObjectiveCpp-NoModules.yml generates the project
  • Building the scheme iOS-ObjectiveCpp-NoModules fails with error: use of undeclared identifier 'SentrySDK' — confirming the reproducer works
  • Existing CI is unaffected (sample not in build matrix)

#skip-changelog

Refs #4543
Refs #6342

…mple apps

Add a new "SentrySPM" SPM product that allows consumers to compile Sentry
directly from source, as an alternative to the pre-built xcframework binary
targets. The product uses a thin Swift wrapper module (Sources/SentrySPM/) that
re-exports both the ObjC and Swift modules via @_exported import, so consumers
only need `import SentrySPM`.

Architecture:
- SentryHeaders: public ObjC headers
- _SentryPrivate: internal ObjC headers
- SentrySwift: all Swift source
- SentryObjCInternal: all ObjC/C source (renamed from SentryObjc)
- SentrySPM: thin re-export wrapper

Also adds SwiftUI sample apps for all supported platforms (iOS, watchOS, tvOS,
macOS, visionOS) that use the SentrySPM product with XcodeGen, along with
Makefile build targets and CI workflow integration.
- Override IOS_SIMULATOR_OS=latest and IOS_DEVICE_NAME for the
  build-sample-spm CI job since macos-26 runners have Xcode 26.x
  simulators, not 18.4/iPhone 16 Pro
- Update prepare-package.sh to keep SentrySPM product in the products
  array when --remove-binary-targets is used, so the existing Samples/SPM
  project can resolve its SentrySPM dependency during workspace builds
Add a sample project that reproduces the ObjC++ without-modules issue
where SentrySDK is undeclared when using #import <Sentry/Sentry.h>
with CLANG_ENABLE_MODULES=NO. Since SDK 8.54, SentrySDK is a Swift
class and only visible via Sentry-Swift.h or @import Sentry, both
of which are unusable from ObjC++ without modules.

This sample serves as a test case for the pure ObjC SDK wrapper
proposed in #6342. It is intentionally not in CI since it does not
build with the current SDK.

Refs #4543
Refs #6342
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 11, 2026

Semver Impact of This PR

🟡 Minor (new features)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


This PR will not appear in the changelog.


🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 11, 2026

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 5be73ee

Add build-sample-iOS-ObjectiveCpp-NoModules target to build the
ObjC++ without-modules reproducer. This target is expected to fail
until the pure ObjC SDK wrapper (#6342) is implemented.

Refs #4543
Refs #6342
@philprime philprime self-assigned this Feb 11, 2026
Comment thread Makefile
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.258%. Comparing base (ed8c255) to head (5be73ee).
⚠️ Report is 3 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##              main     #7433       +/-   ##
=============================================
- Coverage   85.283%   85.258%   -0.026%     
=============================================
  Files          479       479               
  Lines        28608     28579       -29     
  Branches     12419     12426        +7     
=============================================
- Hits         24398     24366       -32     
- Misses        4164      4167        +3     
  Partials        46        46               

see 10 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ed8c255...5be73ee. Read the comment docs.

The build-sample-iOS-ObjectiveCpp-NoModules target was missing the
-destination flag, which would cause xcodebuild to resolve a
destination automatically. This is unreliable on CI and may target
the wrong platform.

Refs #4543
@itaybre itaybre added the ready-to-merge Use this label to trigger all PR workflows label Feb 11, 2026
Copy link
Copy Markdown
Contributor

@itaybre itaybre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 11, 2026

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1192.35 ms 1216.55 ms 24.20 ms
Size 24.14 KiB 1.11 MiB 1.08 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
18c94be 1218.26 ms 1258.80 ms 40.54 ms
70fb69e 1230.45 ms 1257.00 ms 26.55 ms
dbf22c2 1214.19 ms 1241.67 ms 27.48 ms
d540ef3 1214.37 ms 1241.06 ms 26.69 ms
17b7e88 1223.04 ms 1253.48 ms 30.43 ms
29f846e 1210.51 ms 1238.66 ms 28.15 ms
1357911 1224.57 ms 1261.00 ms 36.43 ms
bbee1ba 1197.79 ms 1215.42 ms 17.63 ms
d8db577 1206.83 ms 1244.39 ms 37.56 ms
e8cc4e7 1204.21 ms 1239.22 ms 35.01 ms

App size

Revision Plain With Sentry Diff
18c94be 24.14 KiB 1.10 MiB 1.08 MiB
70fb69e 24.14 KiB 1.11 MiB 1.09 MiB
dbf22c2 24.14 KiB 1.06 MiB 1.04 MiB
d540ef3 24.14 KiB 1.07 MiB 1.04 MiB
17b7e88 24.14 KiB 1.06 MiB 1.04 MiB
29f846e 24.14 KiB 1.07 MiB 1.04 MiB
1357911 24.14 KiB 1.07 MiB 1.04 MiB
bbee1ba 24.14 KiB 1.11 MiB 1.09 MiB
d8db577 24.14 KiB 1.06 MiB 1.04 MiB
e8cc4e7 24.14 KiB 1.11 MiB 1.09 MiB

Previous results on branch: philprime/objective-cpp-no-modules-sample

Startup times

Revision Plain With Sentry Diff
67fbc93 1216.34 ms 1242.29 ms 25.95 ms
e835d88 1213.98 ms 1241.22 ms 27.24 ms
fe3a236 1209.71 ms 1234.55 ms 24.84 ms

App size

Revision Plain With Sentry Diff
67fbc93 24.14 KiB 1.11 MiB 1.09 MiB
e835d88 24.14 KiB 1.11 MiB 1.09 MiB
fe3a236 24.14 KiB 1.11 MiB 1.09 MiB

Base automatically changed from philprime/spm-sample to main February 18, 2026 12:38
@philprime philprime enabled auto-merge (squash) February 18, 2026 13:36
Copilot AI review requested due to automatic review settings February 24, 2026 09:34
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new iOS sample app intended to reliably reproduce the Objective-C++ “no modules” import breakage (ObjC++ .mm + CLANG_ENABLE_MODULES=NO + #import <Sentry/Sentry.h>) described in #4543, to serve as a future verification target for the ObjC wrapper proposal in #6342.

Changes:

  • Add new XcodeGen-based sample project under Samples/iOS-ObjectiveCpp-NoModules/ that intentionally fails to compile with the current SDK.
  • Wire the sample into the repo’s workspace and XcodeGen generation flow (make xcode-ci), and add a dedicated build target in the Makefile.
  • Ignore the generated .xcodeproj for the new sample.

Reviewed changes

Copilot reviewed 13 out of 15 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
Sentry.xcworkspace/contents.xcworkspacedata Adds the new sample’s generated Xcode project reference to the workspace.
Samples/iOS-ObjectiveCpp-NoModules/iOS-ObjectiveCpp-NoModules/main.mm App entry point for the ObjC++ sample.
Samples/iOS-ObjectiveCpp-NoModules/iOS-ObjectiveCpp-NoModules/iOS-ObjectiveCpp-NoModules.entitlements Entitlements placeholder for the sample app.
Samples/iOS-ObjectiveCpp-NoModules/iOS-ObjectiveCpp-NoModules/ViewController.mm ObjC++ view controller that triggers the intended SentrySDK undeclared error.
Samples/iOS-ObjectiveCpp-NoModules/iOS-ObjectiveCpp-NoModules/ViewController.h View controller header for the sample.
Samples/iOS-ObjectiveCpp-NoModules/iOS-ObjectiveCpp-NoModules/Info.plist App Info.plist for the new sample target.
Samples/iOS-ObjectiveCpp-NoModules/iOS-ObjectiveCpp-NoModules/Base.lproj/Main.storyboard Minimal UI (label + button) for exercising the code path.
Samples/iOS-ObjectiveCpp-NoModules/iOS-ObjectiveCpp-NoModules/Base.lproj/LaunchScreen.storyboard Launch screen storyboard for the sample.
Samples/iOS-ObjectiveCpp-NoModules/iOS-ObjectiveCpp-NoModules/AppDelegate.mm ObjC++ AppDelegate that demonstrates the failing SentrySDK startWithConfigureOptions: usage.
Samples/iOS-ObjectiveCpp-NoModules/iOS-ObjectiveCpp-NoModules/AppDelegate.h AppDelegate header for the sample.
Samples/iOS-ObjectiveCpp-NoModules/iOS-ObjectiveCpp-NoModules.yml XcodeGen spec defining the sample target and dependencies.
Samples/iOS-ObjectiveCpp-NoModules/iOS-ObjectiveCpp-NoModules.xcconfig Build settings for the sample, including CLANG_ENABLE_MODULES = NO.
Samples/iOS-ObjectiveCpp-NoModules/README.md Documents the repro scenario and how to generate/build the sample.
Makefile Adds a new build-sample-iOS-ObjectiveCpp-NoModules target and includes the sample in xcode-ci generation.
.gitignore Ignores the generated Samples/iOS-ObjectiveCpp-NoModules/*.xcodeproj.
Files not reviewed (1)
  • Sentry.xcworkspace/contents.xcworkspacedata: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Samples/iOS-ObjectiveCpp-NoModules/README.md Outdated
Update the "This Sample" section to accurately describe that the sample
uses only #import <Sentry/Sentry.h> and does not import Sentry-Swift.h.
Clarify that attempting to include Sentry-Swift.h fails with forward
declaration errors when used from .mm files without modules.
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

Comment thread Samples/iOS-ObjectiveCpp-NoModules/iOS-ObjectiveCpp-NoModules.yml
Copy link
Copy Markdown
Member

@philipphofmann philipphofmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

@philprime philprime merged commit 27ddb4b into main Feb 24, 2026
204 checks passed
@philprime philprime deleted the philprime/objective-cpp-no-modules-sample branch February 24, 2026 12:30
philprime added a commit that referenced this pull request Feb 24, 2026
Add a sample project that reproduces the ObjC++ without-modules issue
where SentrySDK is undeclared when using #import <Sentry/Sentry.h>
with CLANG_ENABLE_MODULES=NO. Since SDK 8.54, SentrySDK is a Swift
class and only visible via Sentry-Swift.h or @import Sentry, both
of which are unusable from ObjC++ without modules.

This sample serves as a test case for the pure ObjC SDK wrapper
proposed in #6342. It is intentionally not in CI since it does not
build with the current SDK.

Add build-sample-iOS-ObjectiveCpp-NoModules target to build the
ObjC++ without-modules reproducer. This target is expected to fail
until the pure ObjC SDK wrapper (#6342) is implemented.

The build-sample-iOS-ObjectiveCpp-NoModules target was missing the
-destination flag, which would cause xcodebuild to resolve a
destination automatically. This is unreliable on CI and may target
the wrong platform.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Use this label to trigger all PR workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants