https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
i

ivan.savytskyi

03/13/2019, 8:27 PM
Hey folks, how to provide
linkerOpts
for compilation tests? in MPP project (MPP gradle plugin) If I do this:
Copy code
def iosPreset = findProperty("kn.ios.target") == "arm" ? presets.iosArm64 : presets.iosX64
        fromPreset(iosPreset, 'ios') {
            compilations.all {
                kotlinOptions.freeCompilerArgs = ["-Xverbose-phases=linker"]
                outputKinds('FRAMEWORK')
                linkerOpts "-F./libs"
I’m getting error
llvm-lto: error: Linking globals named 'ktype:com.greeter.NSObjectProtocolMeta': symbol multiply defined!
Is there any way I can provide
linkerOpts
for test compilation
seems like I need to do this:
Copy code
configure([targets["ios"]]) {
        compilations.test {
            kotlinOptions.freeCompilerArgs = ["-Xverbose-phases=linker"]
            linkerOpts "-F./libs"
        }
    }
b

basher

03/13/2019, 8:58 PM
I ended up doing this:
Copy code
afterEvaluate {
    kotlin {
        targets.all {
            compilations.all {
                // can't use compilations.test because not all "compilations" have a test variant
                if (name == 'test') {
                    kotlinOptions {
                        freeCompilerArgs = ['-Xuse-experimental=kotlin.Experimental']
                    }
                }
            }
        }
    }
}
i think i had to do it this way for the reason noted in the comments
2 Views