Skip to content

Commit cd6ac8e

Browse files
romtsnlizokmimatwawana
authored
feat(java): Add Gradle sections describing dependencies metadata report (#5712)
Co-authored-by: lizokm <[email protected]> Co-authored-by: Isabel <[email protected]>
1 parent c6a7500 commit cd6ac8e

File tree

3 files changed

+102
-2
lines changed

3 files changed

+102
-2
lines changed

src/platforms/android/common/gradle.mdx

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,13 @@ description: "Learn about using the Sentry Android Gradle Plugin."
55
---
66

77
The [Sentry Android Gradle Plugin](https://github.com/getsentry/sentry-android-gradle-plugin) is an addition to the main Android and Hybrid SDKs (like React Native and Flutter) and offers
8-
seamless integration with the Gradle build system. It supports the upload of ProGuard/R8 mappings and of Native debug symbols and sources, as well as
9-
auto-instrumentation tracing through bytecode manipulation.
8+
seamless integration with the Gradle build system. It supports the following features:
9+
10+
- ProGuard/R8 mappings upload
11+
- Native debug symbols and sources upload
12+
- Auto-instrumentation tracing through bytecode manipulation
13+
- Auto-installation of the Sentry Android SDK and its integrations
14+
- External dependencies report
1015

1116
## Setup
1217

@@ -109,6 +114,14 @@ sentry {
109114
// Defaults to the latest published sentry version.
110115
sentryVersion = '{{ packages.version('sentry.java.android', '5.0.0') }}'
111116
}
117+
118+
// Disables or enables dependencies metadata reporting for Sentry.
119+
// If enabled, the plugin will collect external dependencies and
120+
// upload them to Sentry as part of events. If disabled, all the logic
121+
// related to the dependencies metadata report will be excluded.
122+
//
123+
// Default is enabled.
124+
includeDependenciesReport = true
112125
}
113126
```
114127

@@ -174,6 +187,15 @@ sentry {
174187
// Defaults to the latest published sentry version.
175188
sentryVersion.set("{{ packages.version('sentry.java.android', '5.0.0') }}")
176189
}
190+
191+
// Disables or enables dependencies metadata reporting for Sentry.
192+
// If enabled, the plugin will collect external dependencies and
193+
// upload them to Sentry as part of events. If disabled, all the logic
194+
// related to the dependencies metadata report will be excluded.
195+
//
196+
// Default is enabled.
197+
//
198+
includeDependenciesReport.set(true)
177199
}
178200
```
179201

Loading

src/platforms/java/common/gradle.mdx

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
---
2+
title: Gradle
3+
sidebar_order: 100
4+
description: "Learn about using the Sentry Gradle Plugin."
5+
---
6+
7+
The [Sentry Gradle Plugin](https://github.com/getsentry/sentry-android-gradle-plugin) is an addition to the main Java SDK and offers
8+
seamless integration with the Gradle build system. It supports the reporting of your application's external dependencies as part of events.
9+
10+
## Setup
11+
12+
### Install
13+
14+
Using Gradle in your application module's `build.gradle` add:
15+
16+
```groovy
17+
buildscript {
18+
repositories {
19+
mavenCentral()
20+
}
21+
}
22+
23+
plugins {
24+
id "io.sentry.android.gradle" version "{{ packages.version('sentry.java.android.gradle-plugin', '3.0.0') }}"
25+
}
26+
```
27+
28+
```kotlin
29+
buildscript {
30+
repositories {
31+
mavenCentral()
32+
}
33+
}
34+
35+
plugins {
36+
id("io.sentry.android.gradle") version "{{ packages.version('sentry.java.android.gradle-plugin', '3.0.0') }}"
37+
}
38+
```
39+
40+
<Note>
41+
42+
Although the plugin id contains `android`, it can be used for non-android projects. However, for non-android projects, the plugin only collects external dependencies.
43+
44+
</Note>
45+
46+
### Configure
47+
48+
We expose the following configuration values directly in `build.gradle`:
49+
50+
```groovy
51+
sentry {
52+
// Disables or enables dependencies metadata reporting for Sentry.
53+
// If enabled, the plugin will collect external dependencies and
54+
// upload them to Sentry as part of events. If disabled, all the logic
55+
// related to the dependencies metadata report will be excluded.
56+
//
57+
// Default is enabled.
58+
includeDependenciesReport = true
59+
}
60+
```
61+
62+
```kotlin
63+
sentry {
64+
// Disables or enables dependencies metadata reporting for Sentry.
65+
// If enabled, the plugin will collect external dependencies and
66+
// upload them to Sentry as part of events. If disabled, all the logic
67+
// related to the dependencies metadata report will be excluded.
68+
//
69+
// Default is enabled.
70+
includeDependenciesReport.set(true)
71+
}
72+
```
73+
74+
## Dependencies Report
75+
76+
The plugin automatically collects an application's external dependencies (including transitive ones), and generates a compile-time report. The Sentry Java SDK picks up the report at runtime and sends it along with every Sentry event. The event dependencies metadata will look something like this:
77+
78+
![Java dependencies report](dependencies-report.png)

0 commit comments

Comments
 (0)