Skip to content

Conversation

runningcode
Copy link
Contributor

@runningcode runningcode commented Oct 6, 2025

Summary

Implements EME-397 by adding support for setting SentryOptions.DistributionOptions from Gradle using the existing properties file mechanism. There are probably many ways of passing these options to the client but using properties files doesn't require the client to recompile resources or code and there is already an existing mechanism in the codebase to do this so I just piggy-backed on that mechanism.

This PR adds a GenerateDistributionPropertiesTask that generates distribution-related properties which are bundled into sentry-debug-meta.properties and read by the SDK at runtime.

Example Usage

sentry {
  org.set("my-org")
  projectName.set("my-project")
  authToken.set(System.getenv("SENTRY_AUTH_TOKEN"))
  
  distribution {
    enabledVariants.addAll("debug", "staging")
  }
}

#skip-changelog since this is for an unreleased feature that isn’t complete yet

Sentry-java

The sentry-java PR that implements this is here: getsentry/sentry-java#4784

🤖 Generated with Claude Code

Implements EME-397 by adding a Gradle task to generate distribution
properties that will be bundled into the app and read by the SDK.

The task generates sentry-distribution.properties with:
- io.sentry.distribution.org-slug
- io.sentry.distribution.project-slug
- io.sentry.distribution.org-auth-token
- io.sentry.distribution.build-configuration

Values are sourced from the existing SentryPluginExtension (org,
projectName, authToken) and the variant's build type. The task only
runs for variants enabled in distribution.enabledVariants.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link

linear bot commented Oct 6, 2025

- Make task cacheable and use @OutputFile annotation
- Simplify task by removing unnecessary directory creation and logging
- Use variant name as build configuration instead of just build type
- Reorder register() parameters for consistency
- Remove redundant tests that don't add coverage

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
runningcode and others added 3 commits October 6, 2025 16:55
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@runningcode runningcode marked this pull request as ready for review October 6, 2025 15:11
Copy link
Contributor

@chromy chromy left a comment

Choose a reason for hiding this comment

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

lgtm % two comments

) { task ->
task.output.set(output)
task.withSentryTelemetry(extension, sentryTelemetryProvider)
// TODO we should check if the org and project are available in sentry.properties
Copy link
Member

Choose a reason for hiding this comment

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

oh yeah, this is a good point! We also check ext for org and project names, but I'm not sure if anyone is really using extras to set that. Maybe we should get rid of it in the upcoming major altogether

task.orgSlug.set(extension.org)
task.projectSlug.set(extension.projectName)
// TODO we should have a separate authToken for Build Distribution
task.orgAuthToken.set(extension.authToken)
Copy link
Member

Choose a reason for hiding this comment

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

I guess it's more of a security topic, but idk if it's fine to inject and expose the auth token at runtime, given that we recommend hiding it in an env variable even on CI, for example.

Copy link
Member

@romtsn romtsn left a comment

Choose a reason for hiding this comment

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

nothing blocking just a couple of notes, LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants