https://kotlinlang.org logo
Title
j

Joffrey

10/08/2021, 2:34 PM
I'm getting the following warning in a multiplatform library with iOS support:
A compileOnly dependency is used in the Kotlin/Native target 'iosArm64'
The
commonMain
source set indeed declares
kotlinx-serialization-json
as a
compileOnly
dependency. This is what I want for non-native targets (JVM, JS browser, JS node...) because it's supposed to be used this way (I don't want to force this JSON-specific dependency onto users that want to use other serialization formats). So I have a couple questions: 1. is this actually a problem? I mean, by default it's supposed to compile the native targets to a
klib
(not a linked binary) so why is this a problem? Shouldn't it be a problem on the consumer side when actually building a final binary? 2. if it is a problem, how can I solve it? I tried to add this dependency as
implementation
inside the
iosMain
source set, but it doesn't seem to solve the warning I'm tempted to just disable the warning with
kotlin.native.ignoreIncorrectDependencies=true
but I'd like to understand better if it's really a problem first.