Automattic / stories-android

Loop concept app - WP Stories library
GNU General Public License v2.0
17 stars 6 forks source link

Remove kotlin android extensions #702

Closed malinajirka closed 3 years ago

malinajirka commented 3 years ago

This PR is built on top of https://github.com/Automattic/stories-android/pull/688. It removes no longer necessary "kotlin-android-extensions" which has been preventing us from updating to a newer gradle version.

This PR needs to be merged after https://github.com/Automattic/stories-android/pull/688 gets merged.

This is still a draft since I haven't tested the changes in WPAndroid.

Changes in this PR

To test: Smoke test the app

malinajirka commented 3 years ago

Merge of this PR is on hold until we migrate WPAndroid to kotlin 1.4.2. In order to do that we'll need to

  1. Replace synthetic accessors with ViewBinding in WPAndroid (probably even its dependencies)
  2. Remove all usages of apply plugin: 'kotlin-android-extensions'
ParaskP7 commented 3 years ago

šŸ‘‹ @malinajirka !

Merge of this PR is on hold until we migrate WPAndroid to kotlin 1.4.2.

Can you help me understand why is that? šŸ™

malinajirka commented 3 years ago

Thanks so much for checking out this PR @ParaskP7.

Can you help me understand why is that? šŸ™

'kotlin-android-extensions' and kotlin-parcelize can't live in the same project. Since stories are just a git submodule in WPAndroid, we need to remove all usages of 'kotlin-android-extensions' from WPAndroid before we'll be able to use Stories with kotlin-parcelize. At least that's how it looked when I tried to use this branch in WPAndroid - if I recall correctly the build actually worked, but AS was totally confused and some classes were underlined. Having said all that I didn't dive deeply into it as I knew we'd need to remove 'kotlin-android-extensions' in WPAndroid anyway.

ParaskP7 commented 3 years ago

šŸ‘‹ @malinajirka !

'kotlin-android-extensions' and kotlin-parcelize can't live in the same project. Since stories are just a git submodule in WPAndroid, we need to remove all usages of 'kotlin-android-extensions' from WPAndroid before we'll be able to use Stories with kotlin-parcelize.

šŸ¤” I wouldn't think that to be the case, since in the end those are just story modules that will share their .aar with the downstream app. This is very interesting, thanks for the clarification. šŸ™

At least that's how it looked when I tried to use this branch in WPAndroid - if I recall correctly the build actually worked, but AS was totally confused and some classes were underlined. Having said all that I didn't dive deeply into it as I knew we'd need to remove 'kotlin-android-extensions' in WPAndroid anyway.

šŸ¤” This is very interesting, thanks for sharing. šŸ™

As long as you have tested it and found this to be the case, I am fine to have this PR sitting as draft until we are done with the rest of kotlin-android-extensions in WPAndroid.

PS: @oguzkocer do we have any plans to also make the stories-android a composite build in the future? I kind of found it difficult to test this locally with WPAndroid as I didn't want to mess with submodules.

oguzkocer commented 3 years ago

I wouldn't think that to be the case, since in the end those are just story modules that will share their .aar with the downstream app. This is very interesting, thanks for the clarification.

@ParaskP7 I don't want to speak about this particular case without testing, but in our current setup, these modules are not any different from the libs/abc modules we have in WPAndroid. They are not standalone builds that are shared as an aar binary and does get affected by the configuration of the root project. Actually, if I am not mistaken, you can't even build some of the modules in isolation because they are not setup correctly for it.

PS: @oguzkocer do we have any plans to also make the stories-android a composite build in the future? I kind of found it difficult to test this locally with WPAndroid as I didn't want to mess with submodules.

Yes, it'll be gone after Gradle 7 upgrade work is done. Having said that, it isn't any harder to use submodules than to use composite builds. You basically check out the branch in libs/stories-android folder of WPAndroid. The only issue is that sometimes git will hate you for using submodules and will tell you something doesn't exist even though it does. So... yeah, it'll be gone soon :)

P.S: I love hearing about composite build being a success. I've had my worries šŸ˜Ÿ

ParaskP7 commented 3 years ago

šŸ‘‹ @oguzkocer !

@ParaskP7 I don't want to speak about this particular case without testing, but in our current setup, these modules are not any different from the libs/abc modules we have in WPAndroid. They are not standalone builds that are shared as an aar binary and does get affected by the configuration of the root project. Actually, if I am not mistaken, you can't even build some of the modules in isolation because they are not setup correctly for it.

Thanks for the clarification. šŸ™

Yes, it'll be gone after Gradle 7 upgrade work is done. Having said that, it isn't any harder to use submodules than to use composite builds. You basically check out the branch in libs/stories-android folder of WPAndroid. The only issue is that sometimes git will hate you for using submodules and will tell you something doesn't exist even though it does. So... yeah, it'll be gone soon :)

git will hate you for... šŸ˜† Thanks Oguz, yeap you are right, you can do that, thanks for sharing. It just scares me, I am not being able to trust git submodules lately, especially since I am not working regularly with them.

P.S: I love hearing about composite build being a success. I've had my worries šŸ˜Ÿ

Yeap, big success and you are a šŸ¦ø ! MANY THANK šŸ™‡

ParaskP7 commented 3 years ago

šŸ‘‹ @malinajirka @oguzkocer !

This PR can be now effectively unblocked as all the work within the parent Replace Synthetic Accessors with ViewBinding #14845 issue for WordPress-Android is done.

šŸ¾

PS: Let me know if I can help with anything here.

malinajirka commented 3 years ago

I've rested this PR with the current develop of WPAndroid and I didn't encounter any issues - both the build and AS seemed to be happy with the current setup. I merging this PR, I'll create a PR in WPAndroid in a bit.