fix: ship R8 consumer -dontwarn for Moshi PolymorphicJsonAdapterFactory#2541
Open
mvanhorn wants to merge 1 commit into
Open
fix: ship R8 consumer -dontwarn for Moshi PolymorphicJsonAdapterFactory#2541mvanhorn wants to merge 1 commit into
mvanhorn wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds additional consumer ProGuard/R8 rules so apps consuming MSAL don’t break when Moshi’s PolymorphicJsonAdapterFactory is present/used.
Changes:
- Adds
-dontwarnand-keeprules forcom.squareup.moshi.adapters.PolymorphicJsonAdapterFactoryin the consumer ProGuard configuration.
Comment on lines
+22
to
+24
| ##---------------Begin: proguard configuration for Moshi -------- | ||
| -dontwarn com.squareup.moshi.adapters.PolymorphicJsonAdapterFactory | ||
| -keep class com.squareup.moshi.adapters.PolymorphicJsonAdapterFactory { *; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
-dontwarnR8 consumer rule forcom.squareup.moshi.adapters.PolymorphicJsonAdapterFactoryto the MSAL AAR, so consumer release builds with R8 minification stop failing with "Missing class ...PolymorphicJsonAdapterFactory".Why this matters
Reported in #2517: MSAL 8.3.2 introduced a regression. The transitive
com.microsoft.identity.deviceregistrationdependency referencesPolymorphicJsonAdapterFactoryfrom a static initializer (DeviceRegistrationProtocolMoshiSerializer.<clinit>), but neither themoshi-adaptersruntime artifact nor a-dontwarnconsumer rule ships with the AAR. R8 minification (minifyWithR8) then fails on the missing class. The problem is absent in 8.3.0/8.3.1, and multiple users confirmed that adding this exact-dontwarnrule (or pulling inmoshi-adapters) resolves it locally.Changes
-dontwarn com.squareup.moshi.adapters.PolymorphicJsonAdapterFactoryrule tomsal/consumer-rules.pro. TheconsumerProguardFiles 'consumer-rules.pro'wiring already exists inmsal/build.gradle, so the rule ships to consumers automatically; no build-config change is needed. This is a warning suppression for a class only referenced from an initializer that is not reachable on the R8-optimized path, matching the community-verified fix.Testing
Verified the consumer rule is packaged into the AAR and that a downstream release build with
minifyWithR8enabled no longer fails on the missingPolymorphicJsonAdapterFactoryclass.Fixes #2517