-
-
Notifications
You must be signed in to change notification settings - Fork 359
fix(replay): Allow excluding the sentry-android-replay module from android targets #5174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| This module is needed to successfully compile the Android target for the cases when `sentry-android-replay` is excluded from the host app classpath (for example, to reduce the resulting bundle/apk size), e.g. via the following snippet: | ||
|
|
||
| ```gradle | ||
| subprojects { | ||
| configurations.all { | ||
| exclude group: 'io.sentry', module: 'sentry-android-replay' | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| It provides stubs for the Replay classes that are used by the React Native SDK and is being added as a `compileOnly` dependency to `android/build.gradle` (meaning, it is not present at runtime and does not affect our customers' code). | ||
|
|
||
| In addition, we also check for the `sentry-android-replay` classes presence at runtime and only then instantiate the replay-related classes (currently only `RNSentryReplayBreadcrumbConverter`) to not cause a `NoClassDefFoundError`. | ||
|
|
||
| ## Updating the stubs | ||
|
|
||
| To update the stubs, just run `yarn build` from the root of the repo and it will recompile the classes and put them under `packages/core/android/libs/replay-stubs.jar`. Check this newly generated `.jar` in and push. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| allprojects { | ||
| repositories { | ||
| mavenCentral() | ||
| } | ||
| } | ||
|
|
||
| apply plugin: 'java-library' | ||
|
|
||
| java { | ||
| sourceCompatibility = JavaVersion.VERSION_1_8 | ||
| targetCompatibility = JavaVersion.VERSION_1_8 | ||
| } | ||
|
|
||
| tasks.named('jar', Jar) { | ||
| archiveBaseName.set('replay-stubs') | ||
| archiveVersion.set('') | ||
| destinationDirectory.set(file("$rootDir/../libs")) | ||
| } | ||
|
|
||
| dependencies { | ||
| compileOnly 'io.sentry:sentry:8.21.1' | ||
| } |
Binary file not shown.
7 changes: 7 additions & 0 deletions
7
packages/core/android/replay-stubs/gradle/wrapper/gradle-wrapper.properties
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| distributionBase=GRADLE_USER_HOME | ||
| distributionPath=wrapper/dists | ||
| distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip | ||
| networkTimeout=10000 | ||
| validateDistributionUrl=true | ||
| zipStoreBase=GRADLE_USER_HOME | ||
| zipStorePath=wrapper/dists |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to include a simple mention on how to remove it with a sample diff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Example of what we did for Web Replay: https://github.com/getsentry/sentry-react-native/blob/cf745081e2928fd7b1459e38989d54d8ef0815b9/CHANGELOG.md#features-25
And with that, it's optional, but we could also include an estimation on how much app size is reduced when users opt out for mobile replay.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added both 👍