Skip to content

fix(proguard): Fix compatibility with Kotlin/Compose 2.3.0#1054

Merged
romtsn merged 14 commits intomainfrom
rz/fix/proguard-mapping-with-compose
Jan 23, 2026
Merged

fix(proguard): Fix compatibility with Kotlin/Compose 2.3.0#1054
romtsn merged 14 commits intomainfrom
rz/fix/proguard-mapping-with-compose

Conversation

@romtsn
Copy link
Member

@romtsn romtsn commented Jan 21, 2026

📜 Description

Kotlin/Compose 2.3.0 introduced a new task that modifies the mapping file (and also recalculates its SHA-hash) and this breaks our existing hooks. We have been hooking into the minify task before, but now this does not work anymore because the Kotlin task can run after/in-parallel with our task and modify the mapping file, so we'd be essentially looking at an empty mapping file location, or an outdated mapping file.

This PR introduces a new method to hook into the mapping file generation:

  • On AGP 8.3+ it uses the new toListenTo API so the task is automatically wired by AGP with the mapping file artifact
  • On AGP < 8.3 it still uses the old way of hooking (minifyTask.finalizedBy) but in addition we also add a mustRunAfter to our task so it runs after the compose one.

💡 Motivation and Context

Fixes getsentry/sentry-java#5045

💚 How did you test it?

Manually + a new test + existing tests should cover too

📝 Checklist

  • I reviewed the submitted code
  • I added tests to verify the changes
  • I updated the docs if needed
  • No breaking changes

🔮 Next steps

@github-actions
Copy link
Contributor

github-actions bot commented Jan 21, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


Bug Fixes 🐛

Proguard

  • Fix compatibility with Kotlin/Compose 2.3.0 by romtsn in #1054
  • Do not generate empty debug-meta.properties file by romtsn in #1047

Documentation 📚

  • (changelog) Use ### format for Breaking Changes sections by runningcode in #1060

Internal Changes 🔧

Deps

  • Update Android SDK to v8.31.0 by github-actions in #1058
  • Update Android SDK to v8.30.0 by github-actions in #1053
  • Update CLI to v3.1.0 by github-actions in #1052
  • Update CLI to v3.0.3 by github-actions in #1049

Release

  • Fix changelog-preview permissions by BYK in #1062
  • Switch from action-prepare-release to Craft by BYK in #1051

Other

  • (changelog) Prepare 6.0.0 release changelog by runningcode in #1056

🤖 This preview updates automatically when you update the PR.

Copy link
Contributor

@runningcode runningcode left a comment

Choose a reason for hiding this comment

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

LGTM!


@get:Internal abstract val proguardMappingFiles: ConfigurableFileCollection
// Used by AGP < 8.3 with conventional file paths
@get:Internal abstract val fallbackMappingFiles: ConfigurableFileCollection
Copy link
Contributor

Choose a reason for hiding this comment

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

is it still correct that these are internal? i guess better to do this in a separate PR if we need to change this.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, still needs to be internal for this test to pass, otherwise it'll trigger minify task in robolectric tests unfortunately

Copy link
Contributor

Choose a reason for hiding this comment

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

strange! is that true for 8.3+ as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

I actually haven't tried, but will give it a shot!

@romtsn romtsn merged commit bcf7f41 into main Jan 23, 2026
19 checks passed
@romtsn romtsn deleted the rz/fix/proguard-mapping-with-compose branch January 23, 2026 13:51
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.

uploadSentryProguardMappings runs before/parallel with KGP 2.3.0's mergeComposeMapping, causing upload failures

3 participants