I guess the incremental compilation doesn’t work f...
# kotlin-native
s
I guess the incremental compilation doesn’t work for native builds. If I change any single source file, then Android Studio takes very short time to
build
the app. However, the
run
button currently takes about 3 minutes after any single change, and about 3 seconds if no changes were made. Executing this:
Copy code
./gradlew compileKotlinIosX64 --parallel --build-cache -i
Shows that there is a call to:
Copy code
Run tool: "konanc" with args: -g -ea -target ios_x64 -p library -o <...>
with tens of source files as arguments (every source file, not just modified one) Is there any possibility to prevent rebuilding
shared.klib
from scratch every time?
e
there's a roadmap item to improve compilation time, https://youtrack.jetbrains.com/issue/KT-42294
I thought the current state is that compilation is incremental but linking is not. I could be wrong though
k
Yeah, I started asking if it was really compile or link that's taking the time, but my day is a little busy to get into the weeds on this topic 🙂 but, yeah, I think it's more the making of the framework.
s
Thanks for link, so all of you have the same experience?
k
Oh, yeah. Round trip on any change takes a fair bit of time. Generally speaking, we recommend changing and testing on the Android side and verifying on the iOS. Doing Kotlin changes and running on iOS repeatedly will be slower for sure. We're (touchlab) experimenting with shipping Kotlin framework binaries automatically on PR merges so devs that aren't changing Kotlin, just editing Swift that maybe talks to Kotlin, can avoid the build steps altogether locally. The CI build time difference between no Kotlin changes and Kotlin changes is considerable (went looking for stats, but we're mid dev on the tooling itself, so it's a mess 🙂 )
s
I’m doing experiments about 99% logics are placed on KMM side, even routing and presenters. So my platform side only creates UI views and passes them into KMM to have them linked with presenters (inside KMM). “Editing Swift side” wont work for me. :( Well, having all the recent info, I guess the best way for me is waiting while JetBrains will improve their K/Native cache system, and carefully learn the Android development the same time (to speed up each my build)?