Skip to content
Merged
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
2 changes: 1 addition & 1 deletion packages/core/RNSentryAndroidTester/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ android {
}
}

android.sourceSets.main.java.srcDirs += ['../../android/src/expo/java']
android.sourceSets.main.java.srcDirs += ['../../android/expo-handler/src/main/java']

dependencies {
implementation project(':RNSentry')
Expand Down
2 changes: 0 additions & 2 deletions packages/core/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,12 @@ android {
} else {
java.srcDirs += ['src/oldarch']
}
java.srcDirs += ['src/expo']
}
}
}

dependencies {
compileOnly files('libs/replay-stubs.jar')
compileOnly files('libs/expo-stubs.jar')
implementation 'com.facebook.react:react-native:+'
api 'io.sentry:sentry-android:8.36.0'
debugImplementation 'io.sentry:sentry-spotlight:8.36.0'
Expand Down
20 changes: 20 additions & 0 deletions packages/core/android/expo-handler/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 31
namespace = "io.sentry.react.expo"

defaultConfig {
minSdkVersion 21
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
compileOnly project(':expo-modules-core')
compileOnly 'io.sentry:sentry-android:8.36.0'
}
4 changes: 2 additions & 2 deletions packages/core/android/expo-stubs/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
This module provides stubs for `expo-modules-core` interfaces (`Package` and `ReactNativeHostHandler`) needed to compile the Expo-specific source set (`android/src/expo/`).
This module provides stubs for `expo-modules-core` interfaces (`Package` and `ReactNativeHostHandler`) needed to compile the Expo handler tests in `RNSentryAndroidTester`.

The Expo source set registers a `ReactNativeHostHandler` that captures native exceptions swallowed by Expo's bridgeless error handling (`ExpoReactHostDelegate.handleInstanceException`). These stubs are added as a `compileOnly` dependency to `android/build.gradle` (meaning, they are not present at runtime). In Expo projects, the real `expo-modules-core` classes are available at runtime via Expo's autolinking.
The Expo handler (`android/expo-handler/`) registers a `ReactNativeHostHandler` that captures native exceptions swallowed by Expo's bridgeless error handling (`ExpoReactHostDelegate.handleInstanceException`). In Expo projects, the handler is compiled against the real `expo-modules-core` project. For unit testing in `RNSentryAndroidTester` (which doesn't have Expo), these stubs provide the interfaces at compile time.

## Updating the stubs

Expand Down
Binary file modified packages/core/android/libs/expo-stubs.jar
Binary file not shown.
6 changes: 5 additions & 1 deletion packages/core/expo-module.config.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{
"platforms": ["android"]
"platforms": ["android"],
"android": {
"name": "sentry-react-native-expo",
"path": "android/expo-handler"
}
}
3 changes: 1 addition & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@
},
"main": "dist/js/index.js",
"scripts": {
"build": "npx run-s build:sdk downlevel build:tools build:plugin build:replay-stubs build:expo-stubs",
"build": "npx run-s build:sdk downlevel build:tools build:plugin build:replay-stubs",
"build:sdk": "tsc -p tsconfig.build.json",
"build:sdk:watch": "tsc -p tsconfig.build.json -w --preserveWatchOutput",
"build:tools": "tsc -p tsconfig.build.tools.json",
"build:tools:watch": "tsc -p tsconfig.build.tools.json -w --preserveWatchOutput",
"build:plugin": "EXPO_NONINTERACTIVE=true expo-module build plugin",
"build:replay-stubs": "cd android/replay-stubs && ./gradlew jar",
"build:expo-stubs": "cd android/expo-stubs && ./gradlew jar",
"build:tarball": "bash scripts/build-tarball.sh",
"downlevel": "downlevel-dts dist ts3.8/dist --to=3.8",
"clean": "rimraf dist coverage && yarn clean:plugin",
Expand Down
Loading