Skip to content

Commit

Permalink
fix: define separate module names for UIKitless configurations (#4140)
Browse files Browse the repository at this point in the history
  • Loading branch information
armcknight authored Jul 9, 2024
1 parent d26797f commit 5230990
Show file tree
Hide file tree
Showing 21 changed files with 263 additions and 216 deletions.
32 changes: 16 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -213,42 +213,42 @@ jobs:
- run: swift build
shell: sh

check-uikit-linkage-debug-UIKitless:
name: Check no UIKit linkage (Debug_without_UIKit)
check-debug-without-UIKit:
name: Check no UIKit linkage (DebugWithoutUIKit)
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- name: Build for Debug
run: ./scripts/xcode-test.sh "iOS" "latest" $GITHUB_REF_NAME ci build "iPhone 14" Debug_without_UIKit uikit-check-build
- name: Ensure no UIKit
run: ./scripts/check-uikit-linkage.sh Debug_without_UIKit uikit-check-build unlinked
run: ./scripts/xcode-test.sh "iOS" "latest" $GITHUB_REF_NAME ci build "iPhone 14" DebugWithoutUIKit uikit-check-build
- name: Ensure UIKit is not linked
run: ./scripts/check-uikit-linkage.sh DebugWithoutUIKit uikit-check-build unlinked SentryWithoutUIKit

check-uikit-linkage-release-UIKitless:
name: Check no UIKit linkage (Release_without_UIKit)
check-release-without-UIKit:
name: Check no UIKit linkage (ReleaseWithoutUIKit)
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- name: Build for Release
run: ./scripts/xcode-test.sh "iOS" "latest" $GITHUB_REF_NAME ci build "iPhone 14" Release_without_UIKit uikit-check-build
- name: Ensure no UIKit
run: ./scripts/check-uikit-linkage.sh Release_without_UIKit uikit-check-build unlinked
run: ./scripts/xcode-test.sh "iOS" "latest" $GITHUB_REF_NAME ci build "iPhone 14" ReleaseWithoutUIKit uikit-check-build
- name: Ensure UIKit is not linked
run: ./scripts/check-uikit-linkage.sh ReleaseWithoutUIKit uikit-check-build unlinked SentryWithoutUIKit

check-uikit-linkage-debug:
check-debug-with-UIKit:
name: Check UIKit linkage (Debug)
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- name: Build for Debug
run: ./scripts/xcode-test.sh "iOS" "latest" $GITHUB_REF_NAME ci build "iPhone 14" Debug uikit-check-build
- name: Ensure no UIKit
run: ./scripts/check-uikit-linkage.sh Debug uikit-check-build linked
- name: Ensure UIKit is linked
run: ./scripts/check-uikit-linkage.sh Debug uikit-check-build linked Sentry

check-uikit-linkage-release:
check-release-with-UIKit:
name: Check UIKit linkage (Release)
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- name: Build for Release
run: ./scripts/xcode-test.sh "iOS" "latest" $GITHUB_REF_NAME ci build "iPhone 14" Release uikit-check-build
- name: Ensure no UIKit
run: ./scripts/check-uikit-linkage.sh Release uikit-check-build linked
- name: Ensure UIKit is linked
run: ./scripts/check-uikit-linkage.sh Release uikit-check-build linked Sentry
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Fixes

- UIKitless configurations now produce a module with a different name (#4140)
- Sentry Replay Serialized Breadcrumbs include level name ([#4141](https://github.com/getsentry/sentry-cocoa/pull/4141))

## 8.30.0
Expand Down
165 changes: 52 additions & 113 deletions Sentry.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

14 changes: 11 additions & 3 deletions Sources/Configuration/SDK.xcconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "DeploymentTargets.xcconfig"
#include "Versions.xcconfig"

SUPPORTED_PLATFORMS = macosx iphoneos iphonesimulator watchos watchsimulator appletvos appletvsimulator xros xrsimulator
TARGETED_DEVICE_FAMILY = 1,2,3,4,7
Expand Down Expand Up @@ -34,9 +34,17 @@ CLANG_CXX_LIBRARY = libc++
HEADER_SEARCH_PATHS = $(SRCROOT)/Sources/Sentry/include/**

SWIFT_ACTIVE_COMPILATION_CONDITIONS_Debug = DEBUG
SWIFT_ACTIVE_COMPILATION_CONDITIONS_Debug_without_UIKit = DEBUG SENTRY_NO_UIKIT
SWIFT_ACTIVE_COMPILATION_CONDITIONS_DebugWithoutUIKit = DEBUG SENTRY_NO_UIKIT
SWIFT_ACTIVE_COMPILATION_CONDITIONS_Test = TEST
SWIFT_ACTIVE_COMPILATION_CONDITIONS_TestCI = TESTCI
SWIFT_ACTIVE_COMPILATION_CONDITIONS_Release =
SWIFT_ACTIVE_COMPILATION_CONDITIONS_Release_without_UIKit = SENTRY_NO_UIKIT
SWIFT_ACTIVE_COMPILATION_CONDITIONS_ReleaseWithoutUIKit = SENTRY_NO_UIKIT
SWIFT_ACTIVE_COMPILATION_CONDITIONS = $(SWIFT_ACTIVE_COMPILATION_CONDITIONS_$(CONFIGURATION))

GCC_PREPROCESSOR_DEFINITIONS_Debug = DEBUG=1
GCC_PREPROCESSOR_DEFINITIONS_DebugWithoutUIKit = DEBUG=1 SENTRY_NO_UIKIT=1
GCC_PREPROCESSOR_DEFINITIONS_Test = DEBUG=1 TEST=1
GCC_PREPROCESSOR_DEFINITIONS_TestCI = DEBUG=1 TEST=1 TESTCI=1
GCC_PREPROCESSOR_DEFINITIONS_Release = RELEASE=1
GCC_PREPROCESSOR_DEFINITIONS_ReleaseWithoutUIKit = RELEASE=1 SENTRY_NO_UIKIT=1
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS_$(CONFIGURATION))
20 changes: 15 additions & 5 deletions Sources/Configuration/Sentry.xcconfig
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
PRODUCT_NAME = Sentry
INFOPLIST_FILE = Sources/Resources/Info.plist
PRODUCT_BUNDLE_IDENTIFIER = io.sentry.Sentry
#include "Versions.xcconfig"

CURRENT_PROJECT_VERSION = 8.30.0
INFOPLIST_FILE = Sources/Resources/Info.plist

MODULEMAP_FILE = $(SRCROOT)/Sources/Resources/Sentry.modulemap
SENTRY_MODULE_NAME = Sentry
SENTRY_WITHOUT_UIKIT_MODULE_NAME = SentryWithoutUIKit

// This config is required so the test code can access the SentryPrivate module. Removing this setting
// leads to an error: no such module '_SentryPrivate' when including the XCFramework with Carthage
HEADER_SEARCH_PATHS = $(SRCROOT)/Sources/Sentry/include/**

PRODUCT_MODULE_NAME_Debug = $(SENTRY_MODULE_NAME)
PRODUCT_MODULE_NAME_DebugWithoutUIKit = $(SENTRY_WITHOUT_UIKIT_MODULE_NAME)
PRODUCT_MODULE_NAME_Test = $(SENTRY_MODULE_NAME)
PRODUCT_MODULE_NAME_TestCI = $(SENTRY_MODULE_NAME)
PRODUCT_MODULE_NAME_Release = $(SENTRY_MODULE_NAME)
PRODUCT_MODULE_NAME_ReleaseWithoutUIKit = $(SENTRY_WITHOUT_UIKIT_MODULE_NAME)
PRODUCT_MODULE_NAME = $(PRODUCT_MODULE_NAME_$(CONFIGURATION))
PRODUCT_NAME = $(PRODUCT_MODULE_NAME)
PRODUCT_BUNDLE_IDENTIFIER = io.sentry.$(PRODUCT_MODULE_NAME)
MODULEMAP_FILE = $(SRCROOT)/Sources/Resources/$(PRODUCT_MODULE_NAME_$(CONFIGURATION)).modulemap
8 changes: 8 additions & 0 deletions Sources/Configuration/SentrySwiftUI.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,11 @@ IPHONEOS_DEPLOYMENT_TARGET = 13.0
WATCHOS_DEPLOYMENT_TARGET = 6.0
TVOS_DEPLOYMENT_TARGET = 13.0
MACH_O_TYPE = mh_dylib

OTHER_LDFLAGS_DebugWithoutUIKit = -framework SentryWithoutUIKit
OTHER_LDFLAGS_ReleaseWithoutUIKit = -framework SentryWithoutUIKit
OTHER_LDFLAGS_Debug = -framework Sentry
OTHER_LDFLAGS_Test = -framework Sentry
OTHER_LDFLAGS_TestCI = -framework Sentry
OTHER_LDFLAGS_Release = -framework Sentry
OTHER_LDFLAGS = $(OTHER_LDFLAGS_$(CONFIGURATION))
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ IPHONEOS_DEPLOYMENT_TARGET = 11.0
WATCHOS_DEPLOYMENT_TARGET = 4.0
TVOS_DEPLOYMENT_TARGET = 11.0
XROS_DEPLOYMENT_TARGET = 1.0

CURRENT_PROJECT_VERSION = 8.30.0
6 changes: 6 additions & 0 deletions Sources/Resources/SentryWithoutUIKit.modulemap
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
framework module SentryWithoutUIKit {
umbrella header "SentryWithoutUIKit.h"

export *
module * { export * }
}
81 changes: 42 additions & 39 deletions Sources/Sentry/Public/Sentry.h
Original file line number Diff line number Diff line change
@@ -1,46 +1,49 @@
#import <Foundation/Foundation.h>
#if __has_include(<Sentry/Sentry.h>)
# import <Foundation/Foundation.h>

//! Project version number for Sentry.
FOUNDATION_EXPORT double SentryVersionNumber;

//! Project version string for Sentry.
FOUNDATION_EXPORT const unsigned char SentryVersionString[];

#import <Sentry/SentryAttachment.h>
#import <Sentry/SentryBreadcrumb.h>
#import <Sentry/SentryClient.h>
#import <Sentry/SentryCrashExceptionApplication.h>
#import <Sentry/SentryDebugImageProvider.h>
#import <Sentry/SentryDebugMeta.h>
#import <Sentry/SentryDefines.h>
#import <Sentry/SentryDsn.h>
#import <Sentry/SentryEnvelopeItemHeader.h>
#import <Sentry/SentryError.h>
#import <Sentry/SentryEvent.h>
#import <Sentry/SentryException.h>
#import <Sentry/SentryFrame.h>
#import <Sentry/SentryGeo.h>
#import <Sentry/SentryHttpStatusCodeRange.h>
#import <Sentry/SentryHub.h>
#import <Sentry/SentryMeasurementUnit.h>
#import <Sentry/SentryMechanism.h>
#import <Sentry/SentryMechanismMeta.h>
#import <Sentry/SentryMessage.h>
#import <Sentry/SentryNSError.h>
#import <Sentry/SentryOptions.h>
#import <Sentry/SentryRequest.h>
#import <Sentry/SentrySDK.h>
#import <Sentry/SentrySampleDecision.h>
#import <Sentry/SentrySamplingContext.h>
#import <Sentry/SentryScope.h>
#import <Sentry/SentrySerializable.h>
#import <Sentry/SentrySpanContext.h>
#import <Sentry/SentrySpanId.h>
#import <Sentry/SentrySpanProtocol.h>
#import <Sentry/SentrySpanStatus.h>
#import <Sentry/SentryStacktrace.h>
#import <Sentry/SentryThread.h>
#import <Sentry/SentryTraceHeader.h>
#import <Sentry/SentryTransactionContext.h>
#import <Sentry/SentryUser.h>
#import <Sentry/SentryUserFeedback.h>
# import <Sentry/SentryAttachment.h>
# import <Sentry/SentryBreadcrumb.h>
# import <Sentry/SentryClient.h>
# import <Sentry/SentryCrashExceptionApplication.h>
# import <Sentry/SentryDebugImageProvider.h>
# import <Sentry/SentryDebugMeta.h>
# import <Sentry/SentryDefines.h>
# import <Sentry/SentryDsn.h>
# import <Sentry/SentryEnvelopeItemHeader.h>
# import <Sentry/SentryError.h>
# import <Sentry/SentryEvent.h>
# import <Sentry/SentryException.h>
# import <Sentry/SentryFrame.h>
# import <Sentry/SentryGeo.h>
# import <Sentry/SentryHttpStatusCodeRange.h>
# import <Sentry/SentryHub.h>
# import <Sentry/SentryMeasurementUnit.h>
# import <Sentry/SentryMechanism.h>
# import <Sentry/SentryMechanismMeta.h>
# import <Sentry/SentryMessage.h>
# import <Sentry/SentryNSError.h>
# import <Sentry/SentryOptions.h>
# import <Sentry/SentryRequest.h>
# import <Sentry/SentrySDK.h>
# import <Sentry/SentrySampleDecision.h>
# import <Sentry/SentrySamplingContext.h>
# import <Sentry/SentryScope.h>
# import <Sentry/SentrySerializable.h>
# import <Sentry/SentrySpanContext.h>
# import <Sentry/SentrySpanId.h>
# import <Sentry/SentrySpanProtocol.h>
# import <Sentry/SentrySpanStatus.h>
# import <Sentry/SentryStacktrace.h>
# import <Sentry/SentryThread.h>
# import <Sentry/SentryTraceHeader.h>
# import <Sentry/SentryTransactionContext.h>
# import <Sentry/SentryUser.h>
# import <Sentry/SentryUserFeedback.h>
# import <Sentry/SentryWithoutUIKit.h>
#endif // __has_include(<Sentry/Sentry.h>)
12 changes: 6 additions & 6 deletions Sources/Sentry/Public/SentryOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -254,15 +254,15 @@ NS_SWIFT_NAME(Options)
#if SENTRY_UIKIT_AVAILABLE
/**
* When enabled, the SDK tracks performance for UIViewController subclasses.
* @warning This feature is not available in @c Debug_without_UIKit and @c Release_without_UIKit
* @warning This feature is not available in @c DebugWithoutUIKit and @c ReleaseWithoutUIKit
* configurations even when targeting iOS or tvOS platforms.
* @note The default is @c YES .
*/
@property (nonatomic, assign) BOOL enableUIViewControllerTracing;

/**
* Automatically attaches a screenshot when capturing an error or exception.
* @warning This feature is not available in @c Debug_without_UIKit and @c Release_without_UIKit
* @warning This feature is not available in @c DebugWithoutUIKit and @c ReleaseWithoutUIKit
* configurations even when targeting iOS or tvOS platforms.
* @note Default value is @c NO .
*/
Expand All @@ -272,7 +272,7 @@ NS_SWIFT_NAME(Options)
* @warning This is an experimental feature and may still have bugs.
* @brief Automatically attaches a textual representation of the view hierarchy when capturing an
* error event.
* @warning This feature is not available in @c Debug_without_UIKit and @c Release_without_UIKit
* @warning This feature is not available in @c DebugWithoutUIKit and @c ReleaseWithoutUIKit
* configurations even when targeting iOS or tvOS platforms.
* @note Default value is @c NO .
*/
Expand All @@ -281,7 +281,7 @@ NS_SWIFT_NAME(Options)
/**
* When enabled, the SDK creates transactions for UI events like buttons clicks, switch toggles,
* and other ui elements that uses UIControl @c sendAction:to:forEvent:
* @warning This feature is not available in @c Debug_without_UIKit and @c Release_without_UIKit
* @warning This feature is not available in @c DebugWithoutUIKit and @c ReleaseWithoutUIKit
* configurations even when targeting iOS or tvOS platforms.
* @note Default value is @c YES .
*/
Expand All @@ -290,7 +290,7 @@ NS_SWIFT_NAME(Options)
/**
* How long an idle transaction waits for new children after all its child spans finished. Only UI
* event transactions are idle transactions.
* @warning This feature is not available in @c Debug_without_UIKit and @c Release_without_UIKit
* @warning This feature is not available in @c DebugWithoutUIKit and @c ReleaseWithoutUIKit
* configurations even when targeting iOS or tvOS platforms.
* @note The default is 3 seconds.
*/
Expand All @@ -304,7 +304,7 @@ NS_SWIFT_NAME(Options)
* @note You can filter for different app start types in Discover with
* @c app_start_type:cold.prewarmed ,
* @c app_start_type:warm.prewarmed , @c app_start_type:cold , and @c app_start_type:warm .
* @warning This feature is not available in @c Debug_without_UIKit and @c Release_without_UIKit
* @warning This feature is not available in @c DebugWithoutUIKit and @c ReleaseWithoutUIKit
* configurations even when targeting iOS or tvOS platforms.
* @note Default value is @c NO .
*/
Expand Down
49 changes: 49 additions & 0 deletions Sources/Sentry/Public/SentryWithoutUIKit.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#if __has_include(<SentryWithoutUIKit/Sentry.h>)
# import <Foundation/Foundation.h>

//! Project version number for Sentry.
FOUNDATION_EXPORT double SentryVersionNumber;

//! Project version string for Sentry.
FOUNDATION_EXPORT const unsigned char SentryVersionString[];

# import <SentryWithoutUIKit/Sentry.h>
# import <SentryWithoutUIKit/SentryAttachment.h>
# import <SentryWithoutUIKit/SentryBreadcrumb.h>
# import <SentryWithoutUIKit/SentryClient.h>
# import <SentryWithoutUIKit/SentryCrashExceptionApplication.h>
# import <SentryWithoutUIKit/SentryDebugImageProvider.h>
# import <SentryWithoutUIKit/SentryDebugMeta.h>
# import <SentryWithoutUIKit/SentryDefines.h>
# import <SentryWithoutUIKit/SentryDsn.h>
# import <SentryWithoutUIKit/SentryEnvelopeItemHeader.h>
# import <SentryWithoutUIKit/SentryError.h>
# import <SentryWithoutUIKit/SentryEvent.h>
# import <SentryWithoutUIKit/SentryException.h>
# import <SentryWithoutUIKit/SentryFrame.h>
# import <SentryWithoutUIKit/SentryGeo.h>
# import <SentryWithoutUIKit/SentryHttpStatusCodeRange.h>
# import <SentryWithoutUIKit/SentryHub.h>
# import <SentryWithoutUIKit/SentryMeasurementUnit.h>
# import <SentryWithoutUIKit/SentryMechanism.h>
# import <SentryWithoutUIKit/SentryMechanismMeta.h>
# import <SentryWithoutUIKit/SentryMessage.h>
# import <SentryWithoutUIKit/SentryNSError.h>
# import <SentryWithoutUIKit/SentryOptions.h>
# import <SentryWithoutUIKit/SentryRequest.h>
# import <SentryWithoutUIKit/SentrySDK.h>
# import <SentryWithoutUIKit/SentrySampleDecision.h>
# import <SentryWithoutUIKit/SentrySamplingContext.h>
# import <SentryWithoutUIKit/SentryScope.h>
# import <SentryWithoutUIKit/SentrySerializable.h>
# import <SentryWithoutUIKit/SentrySpanContext.h>
# import <SentryWithoutUIKit/SentrySpanId.h>
# import <SentryWithoutUIKit/SentrySpanProtocol.h>
# import <SentryWithoutUIKit/SentrySpanStatus.h>
# import <SentryWithoutUIKit/SentryStacktrace.h>
# import <SentryWithoutUIKit/SentryThread.h>
# import <SentryWithoutUIKit/SentryTraceHeader.h>
# import <SentryWithoutUIKit/SentryTransactionContext.h>
# import <SentryWithoutUIKit/SentryUser.h>
# import <SentryWithoutUIKit/SentryUserFeedback.h>
#endif // __has_include(<SentryWithoutUIKit/Sentry.h>)
10 changes: 5 additions & 5 deletions Sources/Sentry/include/HybridPublic/PrivateSentrySDKOnly.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,31 +132,31 @@ typedef void (^SentryOnAppStartMeasurementAvailable)(
#if SENTRY_UIKIT_AVAILABLE
/**
* Allows hybrid SDKs to enable frame tracking measurements despite other options.
* @warning This feature is not available in @c Debug_without_UIKit and @c Release_without_UIKit
* @warning This feature is not available in @c DebugWithoutUIKit and @c ReleaseWithoutUIKit
* configurations even when targeting iOS or tvOS platforms.
*/
@property (class, nonatomic, assign) BOOL framesTrackingMeasurementHybridSDKMode;

/**
* @warning This feature is not available in @c Debug_without_UIKit and @c Release_without_UIKit
* @warning This feature is not available in @c DebugWithoutUIKit and @c ReleaseWithoutUIKit
* configurations even when targeting iOS or tvOS platforms.
*/
@property (class, nonatomic, assign, readonly) BOOL isFramesTrackingRunning;

/**
* @warning This feature is not available in @c Debug_without_UIKit and @c Release_without_UIKit
* @warning This feature is not available in @c DebugWithoutUIKit and @c ReleaseWithoutUIKit
* configurations even when targeting iOS or tvOS platforms.
*/
@property (class, nonatomic, assign, readonly) SentryScreenFrames *currentScreenFrames;

/**
* @warning This feature is not available in @c Debug_without_UIKit and @c Release_without_UIKit
* @warning This feature is not available in @c DebugWithoutUIKit and @c ReleaseWithoutUIKit
* configurations even when targeting iOS or tvOS platforms.
*/
+ (NSArray<NSData *> *)captureScreenshots;

/**
* @warning This feature is not available in @c Debug_without_UIKit and @c Release_without_UIKit
* @warning This feature is not available in @c DebugWithoutUIKit and @c ReleaseWithoutUIKit
* configurations even when targeting iOS or tvOS platforms.
*/
+ (NSData *)captureViewHierarchy;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ SENTRY_NO_INIT
@end

/**
* @warning This feature is not available in @c Debug_without_UIKit and @c Release_without_UIKit
* @warning This feature is not available in @c DebugWithoutUIKit and @c ReleaseWithoutUIKit
* configurations even when targeting iOS or tvOS platforms.
*/
@interface SentryAppStartMeasurement : NSObject
Expand Down
2 changes: 1 addition & 1 deletion Sources/Sentry/include/HybridPublic/SentryScreenFrames.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ typedef NSArray<NSDictionary<NSString *, NSNumber *> *> SentryFrameInfoTimeSerie
# endif // SENTRY_TARGET_PROFILING_SUPPORTED

/**
* @warning This feature is not available in @c Debug_without_UIKit and @c Release_without_UIKit
* @warning This feature is not available in @c DebugWithoutUIKit and @c ReleaseWithoutUIKit
* configurations even when targeting iOS or tvOS platforms.
*/
@interface SentryScreenFrames : NSObject
Expand Down
Loading

0 comments on commit 5230990

Please sign in to comment.