My Kotlin Multiplatform project is built for iOS and Android.
However, with some required cocoapods we have libs referenced in gradle, that exist only on MacOS machines, thus preventing a gradle sync on Windows and Linux machines – even if they would only build Android builds.
The build.gradle.kts file looks like that:
kotlin {
cocoapods {
ios.deploymentTarget = config.minIOSVersion.get()
pod("ourPod") {
version = libs.versions.ios.ourpod.sdk.get()
extraOpts += listOf("-compiler-option", "-fmodules")
}
}
...
This however leads on Windows and Linux machines to the error:
Unresolved reference: cocoapods as well as some other errors like por() etc.
I wrapped the whole thing in a OS check like that
if (! Os.isFamily(Os.FAMILY_MAC)) { ...
Still though gradle would not need it, the error is still there.
Is there a way to exclude/ignore/suppress these warnings? Since the wrapping line prevents it from being executed I see no need for that. On Windows/Linux I need this code basically commented out. Any