Hi!, I’m having some problems when trying to run s...
# multiplatform
r
Hi!, I’m having some problems when trying to run some integration tests in iOS Devices: • I have code that is different when running on the simulator or the device, so I have these folders ◦ iosMain (95% of my code) ◦ iosTest ◦ iosArm64Main (that 5% of the code which is specific for the device, uses Metal) ◦ iosX64Main (same 5% of the code which is in OpenGL because sim does not support Metal) • In order to make this work, I had to add this to build gradle file (this was suggested in this channel 🙂 )
Copy code
val isIdeaSyncing = System.getProperty("idea.sync.active") != null
    if (isIdeaSyncing) {
        iosX64("ios")
    } else {
        ios()
        iosX64()
        iosArm64()
    }
Well, with that, when I try to run a test in
iosTest
folder I got this error
Copy code
FAILURE: Build failed with an exception.
* What went wrong:
Task 'cleanIosTest' not found in project ':sdk'.
Probably because on how I define the targets, but If remove above’s snippet with the iOS targets, then the code which is exclusive for simulator or device is not built Any clues?? Thank you!
l
Hey Rob, I think the issue might be that you are declaring multiple targets.
ios()
is a shortcut for all the iOS targets, so not sure how gradle handles that! This is how I have it on my project
Copy code
val iosTarget: (String, KotlinNativeTarget.() -> Unit) -> KotlinNativeTarget =
        if (System.getenv("SDK_NAME")?.startsWith("iphoneos") == true)
            ::iosArm64
        else
            ::iosX64
r
Thanks Luis!, I had that in my gradle file in the past, but then I cannot have different code for device or simulator since it does not build what’s on the iosX64Main folder