Skip to content

fix(otel): broaden R8 dontwarn for Auto Value (SDK-4207)#2607

Open
abdulraqeeb33 wants to merge 2 commits intomainfrom
fix/otel-r8-autovalue-consumer-rules
Open

fix(otel): broaden R8 dontwarn for Auto Value (SDK-4207)#2607
abdulraqeeb33 wants to merge 2 commits intomainfrom
fix/otel-r8-autovalue-consumer-rules

Conversation

@abdulraqeeb33
Copy link
Copy Markdown
Contributor

Summary

Addresses R8 release failures where opentelemetry-sdk-logs references Google Auto Value annotation types that are not on the app classpath (SDK-4207, GitHub #2596).

Changes

  • OneSignalSDK/onesignal/otel/consumer-rules.pro: Replace three specific -dontwarn lines with -dontwarn com.google.auto.value.** so inner types and extensions (e.g. Memoized) are covered without follow-up tickets.
  • examples/demo/app/proguard-rules.pro: Remove duplicate suppressions so minified demo builds exercise the library consumer-rules.pro (via OneSignalSDK/settings.gradle dependency substitution).

Verification

  • ./gradlew :app:minifyGmsReleaseWithR8 :app:minifyHuaweiReleaseWithR8 from OneSignalSDK/ (PASS).

Made with Cursor

Use -dontwarn com.google.auto.value.** so R8 release builds do not fail on
optional annotation types referenced by OpenTelemetry (SDK-4207, #2596),
including future inner types or extensions.

Remove duplicate suppressions from the demo app ProGuard file so minified
builds validate the library consumer-rules.pro via dependency substitution.

Made-with: Cursor
Copilot AI review requested due to automatic review settings April 9, 2026 14:09
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes R8 release minification failures caused by optional OpenTelemetry sdk-logs references to Google AutoValue annotation types that are not present on consuming apps’ classpaths, by shipping broader suppressions via the com.onesignal:otel consumer ProGuard rules and removing redundant demo-app-only suppressions.

Changes:

  • Broaden AutoValue suppression in onesignal/otel consumer rules to -dontwarn com.google.auto.value.** to cover inner/extension types.
  • Remove duplicate -dontwarn entries from the demo app so minified demo builds exercise the library-provided consumer rules.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
OneSignalSDK/onesignal/otel/consumer-rules.pro Expands AutoValue -dontwarn to a wildcard to prevent R8 missing-class failures for optional annotation references.
examples/demo/app/proguard-rules.pro Removes redundant suppressions so the demo relies on com.onesignal:otel consumer ProGuard rules during minified builds.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +23 to +24
# Optional Jackson / Auto Value suppressions for OneSignal OTel are shipped in
# com.onesignal:otel consumer-rules.pro; the minified demo relies on those (see SDK-4207 / #2596).
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 The new comment in examples/demo/app/proguard-rules.pro incorrectly states that the demo relies on com.onesignal:otel's consumer-rules.pro, when in fact otel is not a transitive dependency of the demo app at all. Future contributors may believe the demo exercises otel's ProGuard consumer rules as a regression test, when it does not; this false assumption could cause real R8 failures to go undetected.

Extended reasoning...

What the bug is: The comment added at lines 23-24 of examples/demo/app/proguard-rules.pro reads: "Optional Jackson / Auto Value suppressions for OneSignal OTel are shipped in com.onesignal:otel consumer-rules.pro; the minified demo relies on those." This claim is factually incorrect.

The code path that triggers the misunderstanding: The PR description explains that "minified demo builds exercise the library consumer-rules.pro (via OneSignalSDK/settings.gradle dependency substitution)." While dependency substitution in settings.gradle does replace com.onesignal:otel with the local :OneSignal:otel project, this substitution only applies to modules that are already requested in the dependency graph — it cannot inject otel into a build that never declared it.

Why existing code doesn't prevent it:

  • examples/demo/app/build.gradle.kts declares only com.onesignal:OneSignal as a dependency.
  • OneSignalSDK/onesignal/build.gradle (the main SDK module) exposes core, notifications, in-app-messages, and location as api dependencies — NOT otel.
  • Since otel is never in the demo's transitive dependency graph, Android Gradle Plugin never picks up otel's consumerProguardFiles (i.e., consumer-rules.pro) during the demo's R8 pass.

Why the demo build passes: The old dontwarn lines in proguard-rules.pro were dead code — otel classes were never on the demo's classpath, so R8 never generated warnings for them. Removing those lines is correct, but for the wrong stated reason.

Impact: The misleading comment creates a false impression that the demo's minified build acts as a regression test for otel's ProGuard consumer rules. If a future contributor adds otel as a dependency and otel's consumer-rules.pro is missing or broken, they may wrongly assume the demo would have caught it. Conversely, someone auditing the demo's ProGuard setup may waste time tracing a dependency path that doesn't exist.

Step-by-step proof:

  1. Open examples/demo/app/build.gradle.kts — only com.onesignal:OneSignal is listed.
  2. Open OneSignalSDK/onesignal/build.gradleapi deps are core, notifications, in-app-messages, location. No otel.
  3. Run ./gradlew :app:dependencies in the demo — otel does not appear in the dependency tree.
  4. Because otel is absent, AGP never merges otel's consumerProguardFiles into the demo's R8 config.
  5. Conclusion: the comment's claim that "the minified demo relies on those" rules is incorrect.

How to fix it: Replace the comment with an accurate statement, e.g.: "The old dontwarn lines above were removed because otel classes are not on the demo classpath (otel is not a transitive dep of com.onesignal:OneSignal). If otel is ever added to the demo, consumer-rules.pro in com.onesignal:otel will supply the suppressions automatically."

Address review feedback: otel is transitive via core (implementation), not
injected by settings substitution; note older SDKs without otel.

Made-with: Cursor
@abdulraqeeb33
Copy link
Copy Markdown
Contributor Author

@claude[agent] review

@Claude
Copy link
Copy Markdown

Claude AI commented Apr 9, 2026

@claude[agent] review

Reviewed the PR. The changes look good:

b34c4db: Broadened -dontwarn to com.google.auto.value.** (covers all Auto Value types including inner classes/extensions) and removed demo app duplicates to exercise library consumer rules.

df3e76c: Enhanced documentation explaining that AGP merges otel's consumer-rules.pro when core pulls it as an implementation dependency.

The wildcard approach is maintainable and correctly addresses SDK-4207. CodeQL and lint checks passed.

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