Skip to content

Commit

Permalink
Disable sourceContext option to make build work. (#8497)
Browse files Browse the repository at this point in the history
* Disable sourceContext option to make build work.

When setting this option to true, `authToken`, `org`, and `project` settings also need to be set. Documentation for setting them exists in the source context documentation.

* Add section for running sentry task after code gen.

Fix: getsentry/sentry-android-gradle-plugin#546

* some minor changes; re-enable source context in sample

* Apply suggestions from code review

Co-authored-by: Shana Matthews <shana.l.matthews@gmail.com>

* lint fix

---------

Co-authored-by: Alexander Dinauer <alexander.dinauer@sentry.io>
Co-authored-by: Alexander Dinauer <adinauer@users.noreply.github.com>
Co-authored-by: Shana Matthews <shana.l.matthews@gmail.com>
  • Loading branch information
4 people committed Jan 12, 2024
1 parent 38cbc28 commit b30ad5c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
24 changes: 24 additions & 0 deletions src/platform-includes/source-context/java.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,30 @@ sentry {

</PlatformSection>

### Source Context for Generated Code

If you have a code generation step in your build (e.g. Quarkus) you will see an error similar to this:

```
Task ':xxx:sentryCollectSourcesJava' uses this output of task ':xxx:quarkusGenerateCode' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
```

To resolve this, declare a task dependency for `sentryCollectSourcesJava` on code generation tasks that exist in your build:

```groovy
tasks.named("sentryCollectSourcesJava") {
// Make the task run after the tasks that generate code during build
mustRunAfter("CodeGenTask1", "CodeGenTask2")
}
```

```kotlin
tasks.named("sentryCollectSourcesJava") {
// Make the task run after the tasks that generate code during build
mustRunAfter("CodeGenTask1", "CodeGenTask2")
}
```

<PlatformSection notSupported={["android"]}>

## Using the Maven Build Tool Plugin
Expand Down
4 changes: 2 additions & 2 deletions src/platforms/java/common/gradle/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ sentry {
// This enables source context, allowing you to see your source
// code as part of your stack traces in Sentry.
//
// Default is disabled.
// Default is disabled. To enable, see the source context guide.
includeSourceContext = true
// Includes additional source directories into the source bundle.
Expand Down Expand Up @@ -83,7 +83,7 @@ sentry {
// This enables source context, allowing you to see your source
// code as part of your stack traces in Sentry.
//
// Default is disabled.
// Default is disabled. To enable, see the source context guide.
includeSourceContext.set(true)

// Includes additional source directories into the source bundle.
Expand Down

1 comment on commit b30ad5c

@vercel
Copy link

@vercel vercel bot commented on b30ad5c Jan 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

sentry-docs – ./

docs.sentry.io
sentry-docs.sentry.dev
sentry-docs-git-master.sentry.dev

Please sign in to comment.