Brendan Weinstein
03/30/2020, 7:18 AMtasks.withType<KotlinCompile> {
kotlinOptions.freeCompilerArgs += "-Xobjc-generics"
}
instead of extraOpts("-Xobjc-generics")
, but I am seeing types returned as Any where I did not before. Any tips on the right way to enable generics for 1.3.71?Artyom Degtyarev [JB]
03/30/2020, 8:58 AMtasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinNativeCompile> {
this.compilation.kotlinOptions { freeCompilerArgs = freeCompilerArgs + "-Xobjc-generics" }
}
rudolf.hladik
03/30/2020, 2:57 PMbuildscript {
repositories {
...
}
dependencies {
...
}
}
allprojects {
repositories{
...
}
pluginManager.withPlugin("kotlin-multiplatform") {
val kotlinExtension = project.extensions.getByName("kotlin") as org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
val uniqueName = "${project.group}.${project.name}"
kotlinExtension.targets.withType(org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget::class.java) {
// todo add ("-linker-options", "-lsqlite3")
compilations["main"].kotlinOptions.freeCompilerArgs += listOf("-Xobjc-generics","-module-name", uniqueName)
}
}
}
unfortunetly as you can see my todo I don’t know how to add “-lsqlite3” flag to linker optionsArtyom Degtyarev [JB]
03/30/2020, 3:03 PMtargets.withType(org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget::class.java) {
binaries.configureEach{
linkerOpts("-lsqlite3")
freeCompilerArgs += listOf("-Xobjc-generics","-module-name", "a")
}
}
Brendan Weinstein
03/31/2020, 1:07 AMcompilations.forEach {
it.kotlinOptions { freeCompilerArgs = freeCompilerArgs + "-Xobjc-generics" }
}
If there's a quick answer, just curious what the difference between a binary and a compilation. There's no gradle dsl
documentation :/Artyom Degtyarev [JB]
03/31/2020, 7:08 AMcompileKotlin<Target>
task, that generates a .klib
file, and link<Debug|Release><BinaryKind><Target>
, which produces a binary file from the .klib
. Both targets include K/N compiler call inside.
I assume that both flags should be specified per binary according to this doc(on Objective-C generics) and this one(see Configuring binaries).saket
04/20/2020, 5:59 AMkotlin {
targets {
fromPreset(presets.macosX64, 'macos') {
binaries {
framework('shared') {
isStatic = false
linkerOpts.add("-lsqlite3")
}
}
}
...
Artyom Degtyarev [JB]
04/21/2020, 10:01 AMsaket
04/22/2020, 5:30 AMArtyom Degtyarev [JB]
04/22/2020, 7:52 AMsaket
04/22/2020, 3:07 PM