-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
ViewBinding: Remove Kotlin Android Extensions (Replace with Kotlin Parcelize) #14902
Conversation
Since this lib utilizes the '@parcelize' annotation (ie. 'GutenbergPropsBuilder'), the 'kotlin-android-extensions' plugin cannot be removed completely, but instead it needs to be replaced with the 'kotlin-parcelize' plugin.
Parcelize annotations from package 'kotlinx.android.parcel' are deprecated. The newly 'kotlinx.parcelize' package is now the default and as such the corresponding import have been updated accordingly. Also, as part of this change the new 'ParcelCreator' error needs to be suppressed since it is a false positive. Classes which use @parcelize don't need to manually implement 'ParcelCreator' anymore. Documentation: https://developer.android.com/kotlin/parcelize
Since this lib utilizes the '@parcelize' annotation (ie. 'PreviewImageFragment'), the 'kotlin-android-extensions' plugin cannot be removed completely, but instead it needs to be replaced with the 'kotlin-parcelize' plugin.
Parcelize annotations from package 'kotlinx.android.parcel' are deprecated. The newly 'kotlinx.parcelize' package is now the default and as such the corresponding import have been updated accordingly. Also, as part of this change the new 'ParcelCreator' error needs to be suppressed since it is a false positive. Classes which use @parcelize don't need to manually implement 'ParcelCreator' anymore. Documentation: https://developer.android.com/kotlin/parcelize
Since this lib utilizes the '@parcelize' annotation (ie. 'SelectedDateProvider' on 'StatsActivity'), the 'kotlin-android-extensions' plugin cannot be removed completely, but instead it needs to be replaced with the 'kotlin-parcelize' plugin.
Parcelize annotations from package 'kotlinx.android.parcel' are deprecated. The newly 'kotlinx.parcelize' package is now the default and as such the corresponding import have been updated accordingly. Also, as part of this change the new 'ParcelCreator' error needs to be suppressed since it is a false positive. Classes which use @parcelize don't need to manually implement 'ParcelCreator' anymore. Documentation: https://developer.android.com/kotlin/parcelize
You can trigger optional UI/connected tests for these changes by visiting CircleCI here. |
You can test the changes on this Pull Request by downloading the APK here. |
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.
Nice work @ParaskP7.
All requested testing looks good, plus I moved around the app and did some spot testing of other features. 🚀
👋 @zwarm !
Thank you so much for doing some additional smoke testing of the other features, you rock! 🚀 🙇 |
I've scanned through this PR and it LGTM. Great job! ;) So AFAIU we can merge this PR and then merge the stories PR and that's it right? |
Thank you all for working on this! Since it's already approved and Jirka had a quick look as well, could we merge this in as soon as we can @ParaskP7 @zwarm? @malinajirka Yes, I think the next step is to update stories-android. If you need any PR reviews, could you add @ParaskP7 & @zwarm since they have a lot more knowledge on the subject? |
@oguzkocer @malinajirka Thanks everybody. |
👋 @malinajirka @oguzkocer @zwarm !
Great, thanks so much for going through the changes Jirka and for singing off on the merge! 🙏
Great, thank you Oguz! I am seeing Annmarie did the merging honours, woohoo! 🎉
👍
Thank you Annmarie! 🥇
💯 THIS ^ 🏅 |
Release Notes: https://github.com/JetBrains/kotlin/releases/tag/v1.6.20 ------------------------------------------------------------------------ This is a tmp solution which will be removed once the 'Catalog' related Automattic/android-dependency-catalog#20 PR gets ready for review and the CI is able to publish the new catalog. ------------------------------------------------------------------------ FYI: Instead of updating Kotlin to this newer '1.6.20' patch version, a better alternative would have been to replace the deprecated 'kotlin-android-extensions' plugin with 'kotlin-parcelize'. However, doing such a migration is not trivial and will require a lot of work. For instance, one could search for all the 'kotlinx.android.synthetic' and 'kotlinx.android.parcel' related imports. Those would need to be replaced with 'ViewBinding' and 'kotlinx.parcelize' respectively. As a reference see WPAndroid such issues and their multiple PRs: - Replace Synthetic Accessors with ViewBinding #14845 wordpress-mobile/WordPress-Android#14845 - ViewBinding: Remove Kotlin Android Extensions (Replace with Kotlin Parcelize) #14902 wordpress-mobile/WordPress-Android#14902
Parent #14845
The
kotlin-android-extensions
plugin is no longer necessary and it is preventing us from updating to a newer gradle version. @oguzkocer and @malinajirka I am adding you as the main reviewers since you two are also working on merging the relatedstories-android
draft PR, which (kind of) depends on this PR.This PR is part of a larger effort to replace synthetic accessors within WPAndroid and is split into three parts:
kotlin-android-extensions
plugin withkotlin-parcelize
for theeditor
library.kotlin-android-extensions
plugin withkotlin-parcelize
for theimage-editor
library.kotlin-android-extensions
plugin withkotlin-parcelize
for theWordPress
module.Changes in this PR, for each part above:
kotlin-android-extensions
plugin withkotlin-parcelize
.kotlinx.parcelize.Parcelize
import withkotlinx.parcelize.Parcelize
ParcelCreator
Lint error.To test (for
editor
lib):My Site
->Blog Posts
.FAB
->Blog post
.To test (for
image-editor
lib):My Site
->Blog Posts
->FAB
->Blog post
.title
and somecontent
.+
🔵 button on the bottom left, on top of the keyboard, to then select anImage
block.ADD IMAGE
->Choose from device
-> Select an image of your choice -> Click theConfirm
tick on the top right of the screen.Media options
icon on the top right of the image -> SelectEdit
.PreviewImageFragment
edit screen should be launched.To test (for
WordPress
module):My Site
->Stats
.Stats
screen should be enough, since this will verify that all the other similar changes also work as expected. But in case you feel strongly about smoke testing all those other screens as well, please feel free to do it.Regression Notes
N/A
Manually tested as described above in the
To test
sections.N/A
PR submission checklist:
RELEASE-NOTES.txt
if necessary.