Skip to content
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

Upgrade to Kotlin 1.9.20 & gradle 8 #375

Merged
merged 36 commits into from
Dec 11, 2023

Conversation

Daeda88
Copy link
Contributor

@Daeda88 Daeda88 commented May 15, 2023

This updates the gradle build tools to Gradle 8, moves to Kotlin 1.8.21, coroutines 1.7.1 and cleans up the build stack

  • Moves build to Gradle 8
  • Upgrade kotlin versions to 1.8.21, coroutines 1.7.1, serialization to 1.5.1
  • Upgrades firebase to 32..0.0 (android) and 10.9.0 (iOS)
  • Use Android Source Layout V2
  • Use version variables in gradle.properties to ease future upgrades

@Daeda88
Copy link
Contributor Author

Daeda88 commented May 15, 2023

Once this is merged, I can make a few more PRs from our Splendo fork, including fixes to Polymorphic serialization (it fails for nesting, doesnt support non-sealed polymorphism etc), several iOS methods, and tracking the new firestore persistence settings

@nbransby
Copy link
Member

Another huge PR 🙄

What are the podspecs for?

@Daeda88
Copy link
Contributor Author

Daeda88 commented Jun 12, 2023

Another huge PR 🙄

What are the podspecs for?

To get them to build. Im guessing the latest plugin requires them (which is a bit weird since we set noPodspec which implies you shouldnt need them). But this is on the native plugin side.

And yeah, its kind of big because the new Android filestructure requires renames from androidAndroidTest to androidInstrumentedTest etc. But the old way will get deprecated so you'll have to do the renames eventually.

@nbransby
Copy link
Member

And yeah, its kind of big because the new Android filestructure requires renames from androidAndroidTest to androidInstrumentedTest etc. But the old way will get deprecated so you'll have to do the renames eventually.

This PR includes upgrading kotlin.mpp.androidSourceSetLayoutVersion to 2? That's great as it was on our todo list but it would be super helpful if that was in the PR title of description somewhere. In fact this task alone would make a sizable PR and should really be submitted separately, that would really help us improve our TTM (time to merge) on this project 🙏

@Daeda88
Copy link
Contributor Author

Daeda88 commented Jun 14, 2023

@nbransby I dont think it would reduce the size that much. Upgrading to Gradle 8 means that Android now needs the namespace set. As a result, the cleanup requires most Manifest files to be deleted. With 10 modules, that just adds up. Most of the files changed dont contain that much, except for the Build.gradle files which will always come in bulk.

I did try and split it up for you, but it wont reduce the PR size by much and is a lot of work on my side.

I have updated the initial PR comment to better reflect what changed btw

@Daeda88
Copy link
Contributor Author

Daeda88 commented Jun 14, 2023

Alternatively you could merge #386 first, and Ill make sure I track the changes

@nbransby
Copy link
Member

gradle check fails on #386, does it work on this branch?

@Daeda88
Copy link
Contributor Author

Daeda88 commented Jun 20, 2023

@nbransby there was a merge issue with test-utils. I fixed them, so I expect CI to work now (tests run locally at least)

@nbransby
Copy link
Member

does gradle check pass?

@Daeda88
Copy link
Contributor Author

Daeda88 commented Jun 20, 2023

It does now. There's a bit of a bug/missing feature with Kotlin 1.8 where AndroidUnitTest automatically has a dependency on commonTest. This is problematic because the tests in this library are instrumented tests. Kotlin 1.9 allows the disabling of the dependency, but for now, I solved it by making an Annotation @IgnoreForAndroidUnitTest which will make sure the tests are not done for Android Unit tests specifically.

@nbransby
Copy link
Member

do you have a link to the docs on Kotlin 1.9 allows the disabling of the dependency?

@nbransby
Copy link
Member

nbransby commented Jul 5, 2023

I noticed gradle check doesn't run the android instrumented tests and gradle connectedCheck appears to hang...

> Task :firebase-firestore:connectedDebugAndroidTest
Starting 36 tests on Pixel 4 - 13

Any ideas on that?

@Daeda88
Copy link
Contributor Author

Daeda88 commented Sep 18, 2023

@nbransby sorry I completely forgot to respond at the time. I had to upgrade our tooling to Kotlin 1.9.10 due to build issues with XCode 15 on older kotlin versions, so Ive amended the PR with the latest changes from master.

Re the connected devices, looks like the expected emulator was not there, Ill try and have a look. I can run connectedCheck just fine on my local machine, so its probably some CI configuration.

@Qw4z1
Copy link
Contributor

Qw4z1 commented Oct 12, 2023

Once this is merged, I can make a few more PRs from our Splendo fork, including fixes to Polymorphic serialization (it fails for nesting, doesnt support non-sealed polymorphism etc), several iOS methods, and tracking the new firestore persistence settings

@Daeda88, would any of the fixes you mention include a fix for #420?

@Qw4z1
Copy link
Contributor

Qw4z1 commented Oct 12, 2023

And yeah, its kind of big because the new Android filestructure requires renames from androidAndroidTest to androidInstrumentedTest etc. But the old way will get deprecated so you'll have to do the renames eventually.

This PR includes upgrading kotlin.mpp.androidSourceSetLayoutVersion to 2? That's great as it was on our todo list but it would be super helpful if that was in the PR title of description somewhere. In fact this task alone would make a sizable PR and should really be submitted separately, that would really help us improve our TTM (time to merge) on this project 🙏

@nbransby, is this todo list that you mention publicly available somewhere? If not, I think it could make it easier for people who wants to contribute to know where they should start. 😇

@nbransby
Copy link
Member

nbransby commented Nov 5, 2023

@nbransby looks like CI is finally passing!

@Daeda88 I'm guessing the ios tests defeated you in the end 😅

@Daeda88
Copy link
Contributor Author

Daeda88 commented Nov 5, 2023

JS tests actually. They fail randomly and I don't know why. Rerunning ci a bunch of times will eventually pass it.

@nbransby
Copy link
Member

nbransby commented Nov 14, 2023

@nbransby, is this todo list that you mention publicly available somewhere? If not, I think it could make it easier for people who wants to contribute to know where they should start. 😇

@Qw4z1 yes plenty of places to start here https://github.com/GitLiveApp/firebase-kotlin-sdk/issues

@nbransby
Copy link
Member

nbransby commented Nov 14, 2023

JS tests actually. They fail randomly and I don't know why. Rerunning ci a bunch of times will eventually pass it.

The error is

> Failed to execute all tests:
  :firebase-firestore:jsBrowserTest: java.lang.IllegalStateException: command '/Users/runner/.gradle/nodejs/node-v18.12.1-darwin-x64/bin/node' exited with errors (exit code: 1)

but if you look at the js test report html it says all the tests passed 😑

@Daeda88
Copy link
Contributor Author

Daeda88 commented Nov 14, 2023

I'm currently upgrading our internal fork to 1.9.20 and there JS seems to pass fine. Now it's the Android tests XD. Once its stable I'll update this pr again.

@Daeda88 Daeda88 changed the title Upgrade to Kotlin 1.8.21 & gradle 8 Upgrade to Kotlin 1.9.20 & gradle 8 Nov 17, 2023
@Daeda88
Copy link
Contributor Author

Daeda88 commented Nov 17, 2023

@nbransby upgraded to Kotlin 1.9.20. On our fork this now builds reliable. HOWEVER the Android tests fail on MacOS latest: the auth api is giving some timeouts for the Android emulator. We've resolved it by running on a 4 core ubuntu machine, but that is not free (0,016 USD per minute, at a build time of approximately 7 min). If you know of a way to optimize id be happy to do it, but so far no luck.

@nbransby
Copy link
Member

Have you got a link to the failed runs?

Are you still running the iOS tests on Mac?

@Daeda88
Copy link
Contributor Author

Daeda88 commented Nov 20, 2023

Here's an example: https://github.com/splendo/firebase-kotlin-sdk/actions/runs/6903223212/job/18781490591
Still running iOS tests, but Ive split Android/iOS/JS over three jobs/machines to increase build time (and make tests better, since it ensures a clean firebase emulator)

@MattSkala
Copy link
Contributor

@nbransby upgraded to Kotlin 1.9.20. On our fork this now builds reliable. HOWEVER the Android tests fail on MacOS latest: the auth api is giving some timeouts for the Android emulator. We've resolved it by running on a 4 core ubuntu machine, but that is not free (0,016 USD per minute, at a build time of approximately 7 min). If you know of a way to optimize id be happy to do it, but so far no luck.

I've tried running the Android tests on the standard ubuntu-latest runner and it seems to work fine: https://github.com/MattSkala/firebase-kotlin-sdk/actions/runs/6989496153/job/19018094669?pr=2

@nbransby
Copy link
Member

nbransby commented Dec 5, 2023

Still running iOS tests, but Ive split Android/iOS/JS over three jobs/machines to increase build time (and make tests better, since it ensures a clean firebase emulator)

@Daeda88 are we able to do this over free machines with the android tests running on standard ubuntu-latest runner which according to @MattSkala seems to work

@Daeda88
Copy link
Contributor Author

Daeda88 commented Dec 5, 2023

@nbransby @MattSkala Set it to Ubuntu latest and also upgraded to 1.9.21

@MattSkala
Copy link
Contributor

@nbransby @MattSkala Set it to Ubuntu latest and also upgraded to 1.9.21

@Daeda88 I see the workflow failed, it would probably be better to get macOS working after all, can you give it one more shot?

After looking at the workflows, I think there might be a race condition as there is no wait until Firebase Emulator is started. It might happen that tests are started before the emulators are ready. We could wait for the emulator to start in the setup test action e.g. using wait-on: MattSkala@49dc48b

@Daeda88
Copy link
Contributor Author

Daeda88 commented Dec 11, 2023

@MattSkala pushed MacOS 13 again. Doubt it works and I dont really see a good way to counter the race condition. Any suggestions?

@Daeda88
Copy link
Contributor Author

Daeda88 commented Dec 11, 2023

@nbransby well waddayouknow, apparently it works fine on MacOS 13 for Kotlin 1.9.21. Merging is obviously blocked due to review & an expected build on api 29 instead of 34 which is latest, but that's nothing I can control :)

@nbransby nbransby merged commit 30c8665 into GitLiveApp:master Dec 11, 2023
3 checks passed
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.

4 participants