-
-
Notifications
You must be signed in to change notification settings - Fork 35
Add GenerateDistributionPropertiesTask for distribution options #999
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
base: main
Are you sure you want to change the base?
Add GenerateDistributionPropertiesTask for distribution options #999
Conversation
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>
- 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>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
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.
lgtm % two comments
...n-build/src/main/kotlin/io/sentry/android/gradle/tasks/GenerateDistributionPropertiesTask.kt
Outdated
Show resolved
Hide resolved
...n-build/src/main/kotlin/io/sentry/android/gradle/tasks/GenerateDistributionPropertiesTask.kt
Show resolved
Hide resolved
) { task -> | ||
task.output.set(output) | ||
task.withSentryTelemetry(extension, sentryTelemetryProvider) | ||
// TODO we should check if the org and project are available in sentry.properties |
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.
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) |
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.
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.
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.
nothing blocking just a couple of notes, LGTM!
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 intosentry-debug-meta.properties
and read by the SDK at runtime.Example Usage
#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