I have a configuration requirement when setting up...
# kotlin-native
j
I have a configuration requirement when setting up iOS in gradle, where I want both the iosArm64 + iosX64 target to get built at the same time, but only want to configure everything for the target once. I have managed to configure both targets at one place, but now all my code inside iosMain will become red. I will paste it inside this thread in order not to spam the channel with code. How can i configure both my targets at one place, code in one place, but still set up iosMain properly without extra configuration?
All my code inside my iosMain folder will become red. And I figure it is because rather than using
val iosMain by creating
i am now using
val iosMain by creating
How can i configure both my targets at one place, but still set up iosMain without extra configuration?
r
That’s not how it works. You just created a non-platform specific sourceSet called iosMain, that doesn’t make it an iOS sourceSet
You need to define a “main” iOS target with one of the platform, then add additional targets and make the additional targets depend on your main one
You can make your sourceSets depend on each other inside your Gradle build file. It’s the recommended way. I just use a simple symlink as I don’t need the portability and prefer not to bloat my Gradle files more
j
Yeah I dont know, but from what you are saying i'll need to add/modify another target called
ios
which means clogging down the gradle-file even more, I dont believe for a second that is the only way out of this
r
This use-case is still a work-in-progress. See https://youtrack.jetbrains.com/issue/KT-27801 and related issues.
My usual workaround is
iosX64.dependsOn(iosArm64)
but it's not perfect.
k
there was a whole thread about this last week i think in #multiplatform
all you need to do is name one of your iOS targets to match your source set
then IDEA figures everything out
in my case i have iosX64('ios'), iosArm32('iosArm32'), iosArm64('iosArm64')
j
Thanks guys, I'll look into this more closely