-
-
Notifications
You must be signed in to change notification settings - Fork 37
fix(proguard): Fix compatibility with Kotlin/Compose 2.3.0 #1054
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
3657620
fix(proguard): Generate a new UUID instead of static hash for non-exi…
romtsn 27eab36
Merge branch 'main' into rz/fix/proguard-mapping-stale-uuid
romtsn d3d716a
Properly wire generate uuid task with mapping files
romtsn f26df92
Changelog
romtsn c76eb59
fix(proguard): Fix compatibility with Kotlin/Compose 2.3.0
romtsn 7ca88f0
Changelog
romtsn 11d575d
Fix test
romtsn 5d3e41f
Merge branch 'main' into rz/fix/proguard-mapping-with-compose
romtsn 136b404
Fix test did not have tests enabled
romtsn 80dca0d
Fix test with a specific kotlin version and not rely on AGP pulling i…
romtsn 0a23482
Merge branch 'main' into rz/fix/proguard-mapping-with-compose
romtsn e63f528
Update plugin-build/src/main/kotlin/io/sentry/android/gradle/AGP83Com…
romtsn 3d2c5a1
Merge branch 'main' into rz/fix/proguard-mapping-with-compose
romtsn ff86bdc
More explicit task names
romtsn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
50 changes: 50 additions & 0 deletions
50
plugin-build/src/main/kotlin/io/sentry/android/gradle/AGP83Compat.kt
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| @file:Suppress("UnstableApiUsage") | ||
|
|
||
| package io.sentry.android.gradle | ||
|
|
||
| import com.android.build.api.artifact.SingleArtifact | ||
| import com.android.build.api.variant.Variant | ||
| import io.sentry.android.gradle.tasks.SentryGenerateProguardUuidTask | ||
| import io.sentry.gradle.common.SentryVariant | ||
| import org.gradle.api.Project | ||
| import org.gradle.api.tasks.TaskProvider | ||
|
|
||
| /** | ||
| * Compatibility layer for AGP 8.3+. | ||
| * | ||
| * This class provides access to the `toListenTo` API, which was introduced in AGP 8.3. It allows | ||
| * proper task wiring for artifacts without forcing their production. | ||
| */ | ||
| data class AndroidVariant83( | ||
| private val variant: Variant, | ||
| private val delegate: SentryVariant = AndroidVariant74(variant), | ||
| ) : SentryVariant by delegate { | ||
|
|
||
| override val isDebuggable: Boolean = variant.debuggable | ||
|
|
||
| /** | ||
| * Wires the [SentryGenerateProguardUuidTask] to listen to the obfuscation mapping file artifact. | ||
| * | ||
| * When minification runs, this ensures the UUID task executes after the mapping file is produced, | ||
| * and receives the mapping file location via [SentryGenerateProguardUuidTask.mappingFile]. | ||
| * | ||
| * When minification doesn't run, the UUID task won't be triggered via this wiring (it would only | ||
| * run if explicitly depended upon by another task). | ||
| */ | ||
| override fun wireMappingFileToUuidTask( | ||
| project: Project, | ||
| task: TaskProvider<out SentryGenerateProguardUuidTask>, | ||
| variantName: String, | ||
| dexguardEnabled: Boolean, | ||
| ) { | ||
| if (!dexguardEnabled) { | ||
| variant.artifacts | ||
| .use(task) | ||
| .wiredWith(SentryGenerateProguardUuidTask::mappingFile) | ||
| .toListenTo(SingleArtifact.OBFUSCATION_MAPPING_FILE) | ||
| } else { | ||
| // when dexguard is enabled we still want to go the old way, because AGP API does not apply | ||
| delegate.wireMappingFileToUuidTask(project, task, variantName, true) | ||
| } | ||
| } | ||
| } |
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
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
is it still correct that these are internal? i guess better to do this in a separate PR if we need to change this.
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.
Yeah, still needs to be internal for this test to pass, otherwise it'll trigger minify task in robolectric tests unfortunately
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.
strange! is that true for 8.3+ as well?
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 actually haven't tried, but will give it a shot!