icerockdev / moko-kswift

Swift-friendly api generator for Kotlin/Native frameworks
https://moko.icerock.dev
Apache License 2.0
350 stars 21 forks source link

Gradle Sync deletes generated KSwift files #68

Closed shubhamsinghshubham777 closed 1 year ago

shubhamsinghshubham777 commented 1 year ago

Hi here! First of all I want to thank the team who made this plugin possible, it's really useful 🌟

Now, I'm not sure if this is an issue of the plugin or gradle itself (or maybe I'm not setting up the plugin correctly) but whenever I make some updates to the build.gradle of the shared module (where I have set up kswift as well) and click on the Sync now button (or even just restart IntelliJ IDEA and it automatically syncs gradle), it deletes the existing shared/build/cocoapods/framework/sharedSwift folder that won't be generated until I do the following:

Starting point: After gradle sync, the sharedSwift folder is no longer present

Screenshot 2022-12-28 at 9 26 15 AM

Step 1: Go to XCode and run the app until the build fails due to sharedSwift not being available anymore

Screenshot 2022-12-28 at 9 30 09 AM

Step 2: Come back to IntellJ IDEA, open the terminal, ensure that the sharedSwift folder is generated now and then run pod install in its terminal

Screenshot 2022-12-28 at 9 32 11 AM

Step 3: Go back to XCode, and from the popup, select Read from disk to make sure XCode reads the newly generated files

Screenshot 2022-12-28 at 9 32 37 AM

Step 4: Let Step 3 finish its build completely and then the app run/build would finally succeed

Screenshot 2022-12-28 at 9 34 53 AM

This becomes quite tedious while developing 😅 Therefore I want to ask if there's a way to retain the previously generated files inside the build folder every time we sync gradle (or manually allow the generation of these generated files)?

Alex009 commented 1 year ago

hi! when after pod install you see that generated swift file shows in pods dir as here

you should not use pod install anymore and deletion of geenrated files after gradle sync not affect your xcode. when you build app in xcode - framework will be automatically compiled and kswift code will be generated too, so all will be compiled successful.

i agree that integration flow now is complicated, but at now i not see some better way yet

shubhamsinghshubham777 commented 1 year ago

Understood. Thanks for the response @Alex009 Closing this issue for now ✅