icerockdev / moko-kswift

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

Only use Kswift when building for iOS #40

Closed Jon889 closed 2 years ago

Jon889 commented 2 years ago

We run some tests on CI on the shared code, so it doesn't need the Kswift files at all. Is there a way in Gradle to only install the Kswift plugin and run in if a condition (eg a flag or env variable) is set to true?

Alex009 commented 2 years ago

you can wrap apply of plugin in if(System.getenv("CI") != null) id("kswift")

but why you should disable kswift at all? what wrong with generation at tests run?

Jon889 commented 2 years ago

Thanks I’ll try that :)

It’s pretty specific to our set up, as we use kotlin 1.6.x when building for iOS and kotlin 1.5.x for CI and Android. And using the latest version of kswift with Kotlin 1.5 causes issues with gradle that slows down the process significantly. (I’m not an expert at all, but something about not being able to reuse gradle daemons I think because of the different kotlin versions).