Skip to content

Commit cf9975b

Browse files
committed
Merge branch 'main' into v7
# Conflicts: # CHANGELOG.md # dev-packages/e2e-tests/package.json # dev-packages/type-check/package.json # dev-packages/utils/package.json # lerna.json # packages/core/android/build.gradle # packages/core/android/src/main/java/io/sentry/react/RNSentryVersion.java # packages/core/ios/RNSentryVersion.m # packages/core/package.json # packages/core/src/js/version.ts # performance-tests/TestAppPlain/package.json # performance-tests/TestAppSentry/package.json # samples/expo/app.json # samples/expo/package.json # samples/react-native-macos/package.json # samples/react-native/android/app/build.gradle # samples/react-native/ios/sentryreactnativesample/Info.plist # samples/react-native/ios/sentryreactnativesampleTests/Info.plist # samples/react-native/package.json # yarn.lock
2 parents c99094a + ffab994 commit cf9975b

File tree

20 files changed

+351
-63
lines changed

20 files changed

+351
-63
lines changed

.github/workflows/codeql-analysis.yml

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

4545
# Initializes the CodeQL tools for scanning.
4646
- name: Initialize CodeQL
47-
uses: github/codeql-action/init@39edc492dbe16b1465b0cafca41432d857bdb31a # [email protected].1
47+
uses: github/codeql-action/init@181d5eefc20863364f96762470ba6f862bdef56b # [email protected].2
4848
with:
4949
languages: ${{ matrix.language }}
5050
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -55,7 +55,7 @@ jobs:
5555
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5656
# If this step fails, then you should remove it and run the build manually (see below)
5757
- name: Autobuild
58-
uses: github/codeql-action/autobuild@39edc492dbe16b1465b0cafca41432d857bdb31a # [email protected].1
58+
uses: github/codeql-action/autobuild@181d5eefc20863364f96762470ba6f862bdef56b # [email protected].2
5959

6060
# ℹ️ Command-line programs to run using the OS shell.
6161
# 📚 https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
@@ -66,4 +66,4 @@ jobs:
6666
# make bootstrap
6767
# make release
6868
- name: Perform CodeQL Analysis
69-
uses: github/codeql-action/analyze@39edc492dbe16b1465b0cafca41432d857bdb31a # [email protected].1
69+
uses: github/codeql-action/analyze@181d5eefc20863364f96762470ba6f862bdef56b # [email protected].2

.github/workflows/update-deps.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,14 @@ jobs:
8686
changelog-entry: false
8787
secrets:
8888
api-token: ${{ secrets.CI_DEPLOY_KEY }}
89+
90+
sentry-android-gradle-plugin:
91+
uses: getsentry/github-workflows/.github/workflows/updater.yml@v2
92+
with:
93+
path: scripts/update-sentry-android-gradle-plugin.sh
94+
name: Sentry Android Gradle Plugin
95+
pattern: '^[0-9.]+$'
96+
pr-strategy: update
97+
changelog-entry: false
98+
secrets:
99+
api-token: ${{ secrets.CI_DEPLOY_KEY }}

CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,31 @@ Version 7 of the SDK is compatible with Sentry self-hosted versions 24.4.2 or hi
192192
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#8132)
193193
- [diff](https://github.com/getsentry/sentry-java/compare/7.20.1...8.13.2)
194194

195+
## 6.17.0
196+
197+
### Features
198+
199+
- Add experimental flag `enableUnhandledCPPExceptionsV2` on iOS ([#4975](https://github.com/getsentry/sentry-react-native/pull/4975))
200+
201+
```js
202+
import * as Sentry from '@sentry/react-native';
203+
204+
Sentry.init({
205+
_experiments: {
206+
enableUnhandledCPPExceptionsV2: true,
207+
},
208+
});
209+
```
210+
211+
### Dependencies
212+
213+
- Bump CLI from v2.46.0 to v2.47.0 ([#4979](https://github.com/getsentry/sentry-react-native/pull/4979))
214+
- [changelog](https://github.com/getsentry/sentry-cli/blob/master/CHANGELOG.md#2470)
215+
- [diff](https://github.com/getsentry/sentry-cli/compare/2.46.0...2.47.0)
216+
- Bump Android SDK from v7.22.5 to v7.22.6 ([#4985](https://github.com/getsentry/sentry-react-native/pull/4985))
217+
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#7226)
218+
- [diff](https://github.com/getsentry/sentry-java/compare/7.22.5...7.22.6)
219+
195220
## 6.16.1
196221

197222
### Fixes

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"devDependencies": {
3131
"@expo/swiftlint": "^0.57.1",
3232
"@naturalcycles/ktlint": "^1.13.0",
33-
"@sentry/cli": "2.46.0",
33+
"@sentry/cli": "2.47.0",
3434
"clang-format": "^1.8.0",
3535
"downlevel-dts": "^0.11.0",
3636
"google-java-format": "^1.4.0",

packages/core/RNSentryCocoaTester/RNSentryCocoaTesterTests/RNSentryTests.mm

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,82 @@ - (void)testCreateOptionsWithDictionarySpotlightZero
239239
XCTAssertFalse(actualOptions.enableSpotlight, @"Did not disable spotlight");
240240
}
241241

242+
- (void)testCreateOptionsWithDictionaryEnableUnhandledCPPExceptionsV2Enabled
243+
{
244+
RNSentry *rnSentry = [[RNSentry alloc] init];
245+
NSError *error = nil;
246+
247+
NSDictionary *_Nonnull mockedReactNativeDictionary = @{
248+
@"dsn" : @"https://[email protected]/123456",
249+
@"_experiments" : @ {
250+
@"enableUnhandledCPPExceptionsV2" : @YES,
251+
},
252+
};
253+
SentryOptions *actualOptions = [rnSentry createOptionsWithDictionary:mockedReactNativeDictionary
254+
error:&error];
255+
256+
XCTAssertNotNil(actualOptions, @"Did not create sentry options");
257+
XCTAssertNil(error, @"Should not pass no error");
258+
259+
id experimentalOptions = [actualOptions valueForKey:@"experimental"];
260+
XCTAssertNotNil(experimentalOptions, @"Experimental options should not be nil");
261+
262+
BOOL enableUnhandledCPPExceptions =
263+
[[experimentalOptions valueForKey:@"enableUnhandledCPPExceptionsV2"] boolValue];
264+
XCTAssertTrue(
265+
enableUnhandledCPPExceptions, @"enableUnhandledCPPExceptionsV2 should be enabled");
266+
}
267+
268+
- (void)testCreateOptionsWithDictionaryEnableUnhandledCPPExceptionsV2Disabled
269+
{
270+
RNSentry *rnSentry = [[RNSentry alloc] init];
271+
NSError *error = nil;
272+
273+
NSDictionary *_Nonnull mockedReactNativeDictionary = @{
274+
@"dsn" : @"https://[email protected]/123456",
275+
@"_experiments" : @ {
276+
@"enableUnhandledCPPExceptionsV2" : @NO,
277+
},
278+
};
279+
SentryOptions *actualOptions = [rnSentry createOptionsWithDictionary:mockedReactNativeDictionary
280+
error:&error];
281+
282+
XCTAssertNotNil(actualOptions, @"Did not create sentry options");
283+
XCTAssertNil(error, @"Should not pass no error");
284+
285+
id experimentalOptions = [actualOptions valueForKey:@"experimental"];
286+
XCTAssertNotNil(experimentalOptions, @"Experimental options should not be nil");
287+
288+
BOOL enableUnhandledCPPExceptions =
289+
[[experimentalOptions valueForKey:@"enableUnhandledCPPExceptionsV2"] boolValue];
290+
XCTAssertFalse(
291+
enableUnhandledCPPExceptions, @"enableUnhandledCPPExceptionsV2 should be disabled");
292+
}
293+
294+
- (void)testCreateOptionsWithDictionaryEnableUnhandledCPPExceptionsV2Default
295+
{
296+
RNSentry *rnSentry = [[RNSentry alloc] init];
297+
NSError *error = nil;
298+
299+
NSDictionary *_Nonnull mockedReactNativeDictionary = @{
300+
@"dsn" : @"https://[email protected]/123456",
301+
};
302+
SentryOptions *actualOptions = [rnSentry createOptionsWithDictionary:mockedReactNativeDictionary
303+
error:&error];
304+
305+
XCTAssertNotNil(actualOptions, @"Did not create sentry options");
306+
XCTAssertNil(error, @"Should not pass no error");
307+
308+
// Test that when no _experiments are provided, the experimental option defaults to false
309+
id experimentalOptions = [actualOptions valueForKey:@"experimental"];
310+
XCTAssertNotNil(experimentalOptions, @"Experimental options should not be nil");
311+
312+
BOOL enableUnhandledCPPExceptions =
313+
[[experimentalOptions valueForKey:@"enableUnhandledCPPExceptionsV2"] boolValue];
314+
XCTAssertFalse(
315+
enableUnhandledCPPExceptions, @"enableUnhandledCPPExceptionsV2 should default to disabled");
316+
}
317+
242318
- (void)testPassesErrorOnWrongDsn
243319
{
244320
RNSentry *rnSentry = [[RNSentry alloc] init];

packages/core/ios/RNSentry.mm

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
# import "RNSentryRNSScreen.h"
5050
#endif
5151

52+
#import "RNSentryExperimentalOptions.h"
5253
#import "RNSentryVersion.h"
5354

5455
@interface
@@ -305,6 +306,14 @@ - (SentryOptions *_Nullable)createOptionsWithDictionary:(NSDictionary *_Nonnull)
305306
// Failed requests can only be enabled in one SDK to avoid duplicates
306307
sentryOptions.enableCaptureFailedRequests = NO;
307308

309+
NSDictionary *experiments = options[@"_experiments"];
310+
if (experiments != nil && [experiments isKindOfClass:[NSDictionary class]]) {
311+
BOOL enableUnhandledCPPExceptions =
312+
[experiments[@"enableUnhandledCPPExceptionsV2"] boolValue];
313+
[RNSentryExperimentalOptions setEnableUnhandledCPPExceptionsV2:enableUnhandledCPPExceptions
314+
sentryOptions:sentryOptions];
315+
}
316+
308317
return sentryOptions;
309318
}
310319

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#import <Foundation/Foundation.h>
2+
3+
@class SentryOptions;
4+
5+
NS_ASSUME_NONNULL_BEGIN
6+
7+
@interface RNSentryExperimentalOptions : NSObject
8+
9+
/**
10+
* Sets the enableUnhandledCPPExceptionsV2 experimental option on SentryOptions
11+
* @param sentryOptions The SentryOptions instance to configure
12+
* @param enabled Whether to enable unhandled C++ exceptions V2
13+
*/
14+
+ (void)setEnableUnhandledCPPExceptionsV2:(BOOL)enabled
15+
sentryOptions:(SentryOptions *)sentryOptions;
16+
17+
/**
18+
* Gets the current value of enableUnhandledCPPExceptionsV2 experimental option
19+
* @param sentryOptions The SentryOptions instance to read from
20+
* @return The current value of enableUnhandledCPPExceptionsV2
21+
*/
22+
+ (BOOL)getEnableUnhandledCPPExceptionsV2:(SentryOptions *)sentryOptions;
23+
24+
@end
25+
26+
NS_ASSUME_NONNULL_END
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#import "RNSentryExperimentalOptions.h"
2+
@import Sentry;
3+
4+
@implementation RNSentryExperimentalOptions
5+
6+
+ (void)setEnableUnhandledCPPExceptionsV2:(BOOL)enabled sentryOptions:(SentryOptions *)sentryOptions
7+
{
8+
if (sentryOptions == nil) {
9+
return;
10+
}
11+
sentryOptions.experimental.enableUnhandledCPPExceptionsV2 = enabled;
12+
}
13+
14+
+ (BOOL)getEnableUnhandledCPPExceptionsV2:(SentryOptions *)sentryOptions
15+
{
16+
if (sentryOptions == nil) {
17+
return NO;
18+
}
19+
return sentryOptions.experimental.enableUnhandledCPPExceptionsV2;
20+
}
21+
22+
@end

packages/core/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"dependencies": {
6868
"@sentry/babel-plugin-component-annotate": "3.5.0",
6969
"@sentry/browser": "9.22.0",
70-
"@sentry/cli": "2.46.0",
70+
"@sentry/cli": "2.47.0",
7171
"@sentry/core": "9.22.0",
7272
"@sentry/react": "9.22.0",
7373
"@sentry/types": "9.22.0"
@@ -80,7 +80,7 @@
8080
"@sentry-internal/eslint-config-sdk": "9.22.0",
8181
"@sentry-internal/eslint-plugin-sdk": "9.22.0",
8282
"@sentry-internal/typescript": "9.22.0",
83-
"@sentry/wizard": "5.1.0",
83+
"@sentry/wizard": "5.3.0",
8484
"@testing-library/react-native": "^12.7.2",
8585
"@types/jest": "^29.5.13",
8686
"@types/node": "^20.9.3",

packages/core/plugin/src/withSentryAndroidGradlePlugin.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ export interface SentryAndroidGradlePluginOptions {
1212
includeSourceContext?: boolean;
1313
}
1414

15+
export const sentryAndroidGradlePluginVersion = '5.8.0';
16+
1517
/**
1618
* Adds the Sentry Android Gradle Plugin to the project.
1719
* https://docs.sentry.io/platforms/react-native/manual-setup/manual-setup/#enable-sentry-agp
@@ -28,8 +30,6 @@ export function withSentryAndroidGradlePlugin(
2830
includeSourceContext = false,
2931
}: SentryAndroidGradlePluginOptions = {},
3032
): any {
31-
const version = '4.14.1';
32-
3333
// Modify android/build.gradle
3434
const withSentryProjectBuildGradle = (config: any): any => {
3535
return withProjectBuildGradle(config, (projectBuildGradle: any) => {
@@ -44,7 +44,7 @@ export function withSentryAndroidGradlePlugin(
4444
return config;
4545
}
4646

47-
const dependency = `classpath("io.sentry:sentry-android-gradle-plugin:${version}")`;
47+
const dependency = `classpath("io.sentry:sentry-android-gradle-plugin:${sentryAndroidGradlePluginVersion}")`;
4848

4949
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
5050
if (projectBuildGradle.modResults.contents.includes(dependency)) {

0 commit comments

Comments
 (0)