Skip to content

Conversation

@romtsn
Copy link
Member

@romtsn romtsn commented Jan 8, 2026

📜 Description

Fix task ordering for proguard UUID generation with configuration cache.

  • Fix provider pattern in AGP74Compat.kt to preserve task dependencies from AGP's artifact API
  • Change @Internal to @InputFiles so Gradle properly orders the task after minification
  • Generate random UUID as fallback when mapping file doesn't exist
  • Only consider first existing mapping file (aligns with upload task behavior)

💡 Motivation and Context

Multiple customer reports internally. I wasn't able to reproduce this consistently, sadly.

Race condition where SentryGenerateProguardUuidTask could run before the mapping file is created (observed with configuration cache + AGP 8.13.2 + Kotlin 2.3.0), resulting in a stale/mismatched UUID.

Root cause:

  1. @Internal on proguardMappingFiles prevented Gradle from inferring task dependencies and properly serializing this as part of configuration cache
  2. Provider wrapping pattern (project.provider { x.get() }) broke AGP's artifact task-dependency chain

💚 How did you test it?

  • Existing unit and integration tests pass
  • regenerates UUID if mapping file changes and does not regenerate UUID every build tests cover the behavior

📝 Checklist

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

🔮 Next steps

N/A

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.

Just had some questions but otherwise looks good! Nice digging here!

"Generates a unique build ID to be used " + "when uploading the Sentry mapping file"
}

@get:Internal
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder why this is internal.

val proguardMappingFileHash =
proguardMappingFiles.files.joinToString { if (it.isFile) it.contentHash() else STATIC_HASH }
val uuid = UUID.nameUUIDFromBytes(proguardMappingFileHash.toByteArray())
// SentryUploadProguardMappingsTask also picks up the first existing mapping file, so there's
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the proguardMappingFiles in the same order for this task and that task?

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