Skip to content

Commit 3dc1a8f

Browse files
Update includes and returns in HAL to correctly support platform extensions (#806)
* Consolidate use of USE_SENTRY_NATIVE for GenericPlatform, and cleanup Build.cs * Restore Build.cs but remove WriteLine about unsupported platform * Ensure that use of HAL when returning nullptr includes the interface header * Normalize tabs vs. spaces * Actually normalize * Update CHANGELOG --------- Co-authored-by: Ivan Tustanivskyi <tustanivsky@gmail.com>
1 parent 41eb4a5 commit 3dc1a8f

14 files changed

+67
-33
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
- [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#081)
99
- [diff](https://github.com/getsentry/sentry-native/compare/0.8.0...0.8.1)
1010

11+
### Internal
12+
13+
- Update `include`s and `return`s in HAL to correctly support platform extensions ([#806](https://github.com/getsentry/sentry-unreal/pull/806))
14+
1115
## 1.0.0-alpha.1
1216

1317
### Breaking Changes

plugin-dev/Source/Sentry/Private/HAL/PlatformSentryAttachment.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ static TSharedPtr<ISentryAttachment> CreateSharedSentryAttachment(const FString&
1515
#elif PLATFORM_APPLE
1616
return MakeShareable(new SentryAttachmentApple(Path, Filename, ContentType));
1717
#else
18-
return MakeShareable(new FNullSentryAttachment());
18+
return MakeShareable(new FNullSentryAttachment);
1919
#endif
2020
}
2121

@@ -26,6 +26,6 @@ static TSharedPtr<ISentryAttachment> CreateSharedSentryAttachment(const TArray<u
2626
#elif PLATFORM_APPLE
2727
return MakeShareable(new SentryAttachmentApple(Data, Filename, ContentType));
2828
#else
29-
return MakeShareable(new FNullSentryAttachment());
29+
return MakeShareable(new FNullSentryAttachment);
3030
#endif
3131
}

plugin-dev/Source/Sentry/Private/HAL/PlatformSentryBreadcrumb.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#include "Apple/SentryBreadcrumbApple.h"
77
#elif USE_SENTRY_NATIVE
88
#include "GenericPlatform/GenericPlatformSentryBreadcrumb.h"
9+
#else
10+
#include "Interface/SentryBreadcrumbInterface.h"
911
#endif
1012

1113
static TSharedPtr<ISentryBreadcrumb> CreateSharedSentryBreadcrumb()

plugin-dev/Source/Sentry/Private/HAL/PlatformSentryEvent.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
#include "Android/SentryEventAndroid.h"
55
#elif PLATFORM_APPLE
66
#include "Apple/SentryEventApple.h"
7-
#else
7+
#elif USE_SENTRY_NATIVE
88
#include "GenericPlatform/GenericPlatformSentryEvent.h"
9+
#else
10+
#include "Interface/SentryEventInterface.h"
911
#endif
1012

1113
static TSharedPtr<ISentryEvent> CreateSharedSentryEvent()
@@ -14,7 +16,9 @@ static TSharedPtr<ISentryEvent> CreateSharedSentryEvent()
1416
return MakeShareable(new SentryEventAndroid);
1517
#elif PLATFORM_APPLE
1618
return MakeShareable(new SentryEventApple);
17-
#else
19+
#elif USE_SENTRY_NATIVE
1820
return MakeShareable(new FGenericPlatformSentryEvent);
21+
#else
22+
return nullptr;
1923
#endif
2024
}

plugin-dev/Source/Sentry/Private/HAL/PlatformSentryHint.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
static TSharedPtr<ISentryHint> CreateSharedSentryHint()
1010
{
1111
#if PLATFORM_ANDROID
12-
return MakeShareable(new SentryHintAndroid);
12+
return MakeShareable(new SentryHintAndroid);
1313
#else
14-
return MakeShareable(new FNullSentryHint);
14+
return MakeShareable(new FNullSentryHint);
1515
#endif
1616
}

plugin-dev/Source/Sentry/Private/HAL/PlatformSentryId.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,21 @@
44
#include "Android/SentryIdAndroid.h"
55
#elif PLATFORM_APPLE
66
#include "Apple/SentryIdApple.h"
7-
#else
7+
#elif USE_SENTRY_NATIVE
88
#include "GenericPlatform/GenericPlatformSentryId.h"
9+
#else
10+
#include "Interface/SentryIdInterface.h"
911
#endif
1012

1113
static TSharedPtr<ISentryId> CreateSharedSentryId()
1214
{
1315
#if PLATFORM_ANDROID
14-
return MakeShareable(new SentryIdAndroid);
16+
return MakeShareable(new SentryIdAndroid);
1517
#elif PLATFORM_APPLE
16-
return MakeShareable(new SentryIdApple);
18+
return MakeShareable(new SentryIdApple);
19+
#elif USE_SENTRY_NATIVE
20+
return MakeShareable(new FGenericPlatformSentryId);
1721
#else
18-
return MakeShareable(new FGenericPlatformSentryId);
22+
return nullptr;
1923
#endif
2024
}

plugin-dev/Source/Sentry/Private/HAL/PlatformSentrySamplingContext.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
static TSharedPtr<ISentrySamplingContext> CreateSharedSentrySamplingContext()
66
{
7-
// Sampling context is supposed to be created internally by the SDK using the platform-specific implementations.
8-
// Currently, it doesn't provide default constructor for Apple/Android thus we can only return Null-version here.
9-
return MakeShareable(new FNullSentrySamplingContext);
7+
// Sampling context is supposed to be created internally by the SDK using the platform-specific implementations.
8+
// Currently, it doesn't provide default constructor for Apple/Android thus we can only return Null-version here.
9+
return MakeShareable(new FNullSentrySamplingContext);
1010
}

plugin-dev/Source/Sentry/Private/HAL/PlatformSentryScope.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,21 @@
44
#include "Android/SentryScopeAndroid.h"
55
#elif PLATFORM_APPLE
66
#include "Apple/SentryScopeApple.h"
7-
#else
7+
#elif USE_SENTRY_NATIVE
88
#include "GenericPlatform/GenericPlatformSentryScope.h"
9+
#else
10+
#include "Interface/SentryScopeInterface.h"
911
#endif
1012

1113
static TSharedPtr<ISentryScope> CreateSharedSentryScope()
1214
{
1315
#if PLATFORM_ANDROID
14-
return MakeShareable(new SentryScopeAndroid);
16+
return MakeShareable(new SentryScopeAndroid);
1517
#elif PLATFORM_APPLE
16-
return MakeShareable(new SentryScopeApple);
18+
return MakeShareable(new SentryScopeApple);
19+
#elif USE_SENTRY_NATIVE
20+
return MakeShareable(new FGenericPlatformSentryScope);
1721
#else
18-
return MakeShareable(new FGenericPlatformSentryScope);
22+
return nullptr;
1923
#endif
2024
}

plugin-dev/Source/Sentry/Private/HAL/PlatformSentrySpan.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
#include "Android/SentrySpanAndroid.h"
55
#elif PLATFORM_APPLE
66
#include "Apple/SentrySpanApple.h"
7-
#else
7+
#elif USE_SENTRY_NATIVE
88
#include "GenericPlatform/GenericPlatformSentrySpan.h"
9+
#else
10+
#include "Interface/SentrySpanInterface.h"
911
#endif
1012

1113
static TSharedPtr<ISentrySpan> CreateSharedSentrySpan(const FString& Name, const FString& Operation)
@@ -14,7 +16,9 @@ static TSharedPtr<ISentrySpan> CreateSharedSentrySpan(const FString& Name, const
1416
return MakeShareable(new SentrySpanAndroid);
1517
#elif PLATFORM_APPLE
1618
return MakeShareable(new SentrySpanApple);
17-
#else
19+
#elif USE_SENTRY_NATIVE
1820
return MakeShareable(new FGenericPlatformSentrySpan);
21+
#else
22+
return nullptr;
1923
#endif
2024
}

plugin-dev/Source/Sentry/Private/HAL/PlatformSentryTransaction.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,21 @@
44
#include "Android/SentryTransactionAndroid.h"
55
#elif PLATFORM_APPLE
66
#include "Apple/SentryTransactionApple.h"
7-
#else
7+
#elif USE_SENTRY_NATIVE
88
#include "GenericPlatform/GenericPlatformSentryTransaction.h"
9+
#else
10+
#include "Interface/SentryTransactionInterface.h"
911
#endif
1012

1113
static TSharedPtr<ISentryTransaction> CreateSharedSentryTransaction()
1214
{
1315
#if PLATFORM_ANDROID
14-
return MakeShareable(new SentryTransactionAndroid);
16+
return MakeShareable(new SentryTransactionAndroid);
1517
#elif PLATFORM_APPLE
16-
return MakeShareable(new SentryTransactionApple);
18+
return MakeShareable(new SentryTransactionApple);
19+
#elif USE_SENTRY_NATIVE
20+
return MakeShareable(new FGenericPlatformSentryTransaction);
1721
#else
18-
return MakeShareable(new FGenericPlatformSentryTransaction);
22+
return nullptr;
1923
#endif
2024
}

plugin-dev/Source/Sentry/Private/HAL/PlatformSentryTransactionContext.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
#include "Android/SentryTransactionContextAndroid.h"
55
#elif PLATFORM_APPLE
66
#include "Apple/SentryTransactionContextApple.h"
7-
#else
7+
#elif USE_SENTRY_NATIVE
88
#include "GenericPlatform/GenericPlatformSentryTransactionContext.h"
9+
#else
10+
#include "Interface/SentryTransactionContextInterface.h"
911
#endif
1012

1113
static TSharedPtr<ISentryTransactionContext> CreateSharedSentryTransactionContext(const FString& Name, const FString& Operation)
@@ -14,7 +16,9 @@ static TSharedPtr<ISentryTransactionContext> CreateSharedSentryTransactionContex
1416
return MakeShareable(new SentryTransactionContextAndroid(Name, Operation));
1517
#elif PLATFORM_APPLE
1618
return MakeShareable(new SentryTransactionContextApple(Name, Operation));
17-
#else
19+
#elif USE_SENTRY_NATIVE
1820
return MakeShareable(new FGenericPlatformSentryTransactionContext(Name, Operation));
21+
#else
22+
return nullptr;
1923
#endif
2024
}

plugin-dev/Source/Sentry/Private/HAL/PlatformSentryUser.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
#include "Android/SentryUserAndroid.h"
55
#elif PLATFORM_APPLE
66
#include "Apple/SentryUserApple.h"
7-
#else
7+
#elif USE_SENTRY_NATIVE
88
#include "GenericPlatform/GenericPlatformSentryUser.h"
9+
#else
10+
#include "Interface/SentryUserInterface.h"
911
#endif
1012

1113
static TSharedPtr<ISentryUser> CreateSharedSentryUser()
@@ -14,7 +16,9 @@ static TSharedPtr<ISentryUser> CreateSharedSentryUser()
1416
return MakeShareable(new SentryUserAndroid);
1517
#elif PLATFORM_APPLE
1618
return MakeShareable(new SentryUserApple);
17-
#else
19+
#elif USE_SENTRY_NATIVE
1820
return MakeShareable(new FGenericPlatformSentryUser);
21+
#else
22+
return nullptr;
1923
#endif
2024
}

plugin-dev/Source/Sentry/Private/HAL/PlatformSentryUserFeedback.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
#include "Android/SentryUserFeedbackAndroid.h"
55
#elif PLATFORM_APPLE
66
#include "Apple/SentryUserFeedbackApple.h"
7-
#else
7+
#elif USE_SENTRY_NATIVE
88
#include "GenericPlatform/GenericPlatformSentryUserFeedback.h"
9+
#else
10+
#include "Interface/SentryUserFeedbackInterface.h"
911
#endif
1012

1113
static TSharedPtr<ISentryUserFeedback> CreateSharedSentryUserFeedback(TSharedPtr<ISentryId> EventId)
@@ -14,7 +16,9 @@ static TSharedPtr<ISentryUserFeedback> CreateSharedSentryUserFeedback(TSharedPtr
1416
return MakeShareable(new SentryUserFeedbackAndroid(EventId));
1517
#elif PLATFORM_APPLE
1618
return MakeShareable(new SentryUserFeedbackApple(EventId));
17-
#else
19+
#elif USE_SENTRY_NATIVE
1820
return MakeShareable(new FGenericPlatformSentryUserFeedback(EventId));
21+
#else
22+
return nullptr;
1923
#endif
2024
}

plugin-dev/Source/Sentry/Sentry.Build.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,5 @@ public Sentry(ReadOnlyTargetRules Target) : base(Target)
160160

161161
AddEngineThirdPartyPrivateStaticDependencies(Target, "libcurl");
162162
}
163-
else
164-
{
165-
Console.WriteLine("Sentry Unreal SDK does not support platform: " + Target.Platform);
166-
}
167163
}
168164
}

0 commit comments

Comments
 (0)