Hey, guys
Is it possible to use JSON serialization in iOS framework build as konan artifact?
Seems compile "org.jetbrains.kotlinx:jsonparser-native:0.6.0 doesn't work
No, currently compiler plugin does not work with Kotlin/Native.
jsonparser-native contains only parser and Json tree, without
@Serializable and other classes.
Also, it requires usage of new dsl, where konan plugin is renamed to
kotlin-platform-native. Refer to json/Readme.md , installation section
for details and link to examples.
сб, 21 июля 2018 г., 18:35 Sergey Petrov notifications@github.com:
Hey, guys
Is is possible to use JSON serialization in iOS framework build as konan
artifact?
Seems compile "org.jetbrains.kotlinx:jsonparser-native:0.6.0 doesn't work—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/Kotlin/kotlinx.serialization/issues/177, or mute the
thread
https://github.com/notifications/unsubscribe-auth/ALO2J_hWBP3UWgS8GC_abH-XgEAwgHXuks5uI0pSgaJpZM4VZqmH
.
Yeah, I need
only parser and Json tree
but i can't use
compile "org.jetbrains.kotlinx:jsonparser-native:0.6.0
with konan plugin (gradle sync fails).
It only works with kotlin-platform-native which (maybe I'm wrong here) can be used only to build executables (but I need iOS framework)
Error is Could not find method implementation() for arguments [org.jetbrains.kotlinx:jsonparser-native:0.6.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
buildscript {
repositories {
jcenter()
mavenCentral()
maven { url "https://dl.bintray.com/jetbrains/kotlin-native-dependencies" }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin:$konan_version"
}
}
repositories {
maven { url "https://dl.bintray.com/kotlin/kotlinx/" }
}
apply plugin: 'konan'
konan.targets = ['ios_arm64', 'ios_x64']
konanArtifacts {
framework('KotlinNative') {
enableMultiplatform true
}
}
dependencies {
expectedBy project(':common')
implementation "org.jetbrains.kotlinx:jsonparser-native:0.6.0"
}
Tried to use kotlin-platform-plugin to build a framework as
apply plugin: 'kotlin-platform-native'
sourceSets {
main {
kotlin.srcDir 'src/main/kotlin'
component {
outputKinds = [EXECUTABLE] // <-- FRAMEWORK/LIBRARY does not work here
target 'ios_arm64', 'ios_x64'
}
}
}
Error is Could not get unknown property 'FRAMEWORK' for Kotlin/Native component 'main' of type org.jetbrains.kotlin.gradle.plugin.experimental.internal.KotlinNativeMainComponent.
Ok, found the way to produce framework using kotlin-platform-native
https://github.com/Kotlin/kotlinx.coroutines/blob/native/gradle/compile-native.gradle
Official support for frameworks in kotlin-platform-native is going to be in 0.8.1, which I hope to be released soon. You can try to build it by yourself with one of the 0.9-dev-* builds now, e.g. 0.9-dev-2922.
Hi @sdelaysam, I follow this file to produce framework https://github.com/Kotlin/kotlinx.coroutines/blob/native/gradle/compile-native.gradle with outputKinds = [KLIBRARY], but the output file is .klib file, do you have any idea to import it to xcode or point me to to an example?
@pkliang yeah, I reverted back to konan plugin because of this :(
Still don't know how to use kotlin-platform-native to produce framework
Tried KFRAMEWORK but no luck :)
@sdelaysam outputKinds = [FRAMEWORK] works with kotlin-native-gradle-plugin:0.9-dev-2922, 0.8 doesn't support framework
Hi @sandwwraith will this JSON, @serializable and other classes be available in near future for kotlin-platform-native as well?
@RR12 there's separate ticket to track this: #86
org.jetbrains.kotlinx:jsonparser-native:0.6.1 was released under Kotlin/Native 0.8.1, so I suppose you can update your version and use outputKinds = [FRAMEWORK] now.
Most helpful comment
@sdelaysam
outputKinds = [FRAMEWORK]works withkotlin-native-gradle-plugin:0.9-dev-2922, 0.8 doesn't support framework