saket
05/31/2020, 7:11 AMkevin
05/31/2020, 10:45 PMMars
06/01/2020, 2:14 PMkotlin {
jvm()
}
would create jvmMain
source set?
I then declare dependencies for the source set in the following way
jvm().compilations["main"].defaultSourceSet {
dependsOn(commonMain)
dependencies {
...
}
}
but I can't make this very simple project run. I'm getting
SourceSet with name 'jvmMain' not found.
For details, please check:
https://stackoverflow.com/questions/62132959/sourceset-with-name-jvmmain-not-foundPiasy
06/01/2020, 2:44 PMx86_64
), bunch of undefined reference to symbols like ___res_9_p_type_syms
, _BZ2_bzWriteClose
, _CKRecordShareKey
, _kCLLocationCoordinate2DInvalid
, _compression_stream_init
and _at_encoder_get_block_alpha
. I managed to add some libraries to fix all of them except for _at_encoder_get_block_alpha
. I'm using Kotlin 1.3.71, there is no error at all on 1.3.61.zalewski.se
06/01/2020, 4:28 PMKotlinKClass
type of my class generated from KMP module? I need to pass it as an argument to get an instance.aleksey.tomin
06/01/2020, 5:49 PMcommon:
implementation("io.ktor:ktor-client-core:$ktorVersion")
implementation("io.ktor:ktor-client-json:$ktorVersion")
implementation("io.ktor:ktor-client-gson:$ktorVersion")
macOS:
implementation("io.ktor:ktor-client-curl:$ktorVersion")
implementation("io.ktor:ktor-client-core-native:$ktorVersion")
implementation("io.ktor:ktor-client-json-native:$ktorVersion")
But when I write import io.ktor.client.features.json.GsonSerializer
I have got the error Unresolved reference: GsonSerializer
What I’ve done wrong?Omar Mainegra
06/01/2020, 8:23 PMlinkDebugTestIos
)zalewski.se
06/02/2020, 4:05 PMval iOSTarget: (String, KotlinNativeTarget.() -> Unit) -> KotlinNativeTarget =
if (System.getenv("SDK_NAME")?.startsWith("iphoneos") == true)
::iosArm64
else
::iosX64
iOSTarget("ios") {
binaries {
framework(uniqueName)
}
}
Then everything works in iosMain
, I can see whole syntax highlighting correctly.
Although if I set it like here:
ios {
binaries {
framework(uniqueName)
}
}
Everything related to iOS is red, I can’t see any import (although it compiles correctly) and syntax highlighting is broken.Justin
06/03/2020, 3:44 AMjs
) but also builds a multiplatform library that can be imported into another Kotlin Multiplatform project?
Basically I have KMP libraries A
and B
.
Library A
is imported directly by an external js
project.
Library B
- which is used by native iOS and Android apps, requires library A
as a dependency.
Both libraries are for internal use only so I wouldn't be publishing anything to public maven.
Any pointers would be much appreciated!Jolas
06/03/2020, 3:51 AMMananpoddarm
06/03/2020, 6:28 AMfelislynx
06/03/2020, 7:19 AMfun apiCall() = GlobalScope.async(ApplicationDispatcher) {..}
so in Android code i can do
val returnValue = apiCall().await()
how to handle same flow in iOS ?
I see that return type for this function is
Kotlinx_coroutines_coreDeferred
but there is no await() function availableChetan Sachdeva
06/03/2020, 5:47 PMbsimmons
06/03/2020, 6:15 PMesdudnik
06/03/2020, 9:36 PMticker
(from kotlinx.coroutines.channels) are ony JVM based, and according to this
https://github.com/Kotlin/kotlinx.coroutines/issues/540
I don’t see that they will be multiplatformSimon Schubert
06/03/2020, 10:12 PMplugins {
id 'org.jetbrains.kotlin.multiplatform'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.squareup.sqldelight'
kotlin {
android("android")
jvm("jvm")
sourceSets {
androidMain {
dependencies {
implementation kotlin('stdlib')
implementation "com.squareup.sqldelight:android-driver:1.3.0"
}
}
jvmMain {
dependencies {
implementation kotlin('stdlib')
implementation "com.squareup.sqldelight:sqlite-driver:1.3.0"
implementation "org.jetbrains.kotlinx:kotlinx-html-jvm:0.7.1"
}
}
}
}
janvladimirmostert
06/03/2020, 10:15 PMjsMain {
dependencies {
implementation kotlin('stdlib-js')
implementation npm('lit-html', '1.2.1')
}
}
or should i rather do
mkdir lit-html-kt
cd lit-html-kt
npm init -y || exit
sudo npm install -g dukat || exit
npm install lit-html || exit
dukat node_modules/lit-html/lit-html.d.ts || exit
rm -rf ./*.json || exit
rm -rf ./node_modules || exit
which then generates kotlin files for this npm package ?aiidziis
06/04/2020, 9:52 AMclass DbHelper(db: Db) {
suspend fun insert(elements: List<Element>) = withContext(Dispatchers.Default) {
db.elementQueries.transaction {
db.elementQueries.insert(.....)
}
}
}
This works fine when elements list is not too big, but now we encountered use case where we need to insert larger amount of data (in worst case insert is 1200ms), and now this same approach is causing problems on iOS because this all happens on Main Thread(async) , and while the data is inserting UI is getting blocked when user interacts with UI (scrolling).
Is there a way with current coroutines versions "1.3.5-native-mt"
to improve this? afaik with current coroutines version it is not possible move insert to Background Thread?Matt Kranzler
06/04/2020, 3:21 PMJohn O'Reilly
06/04/2020, 9:05 PMRachid
06/05/2020, 2:40 PMciriti
06/06/2020, 8:44 AMjanvladimirmostert
06/06/2020, 12:37 PM@JsName("RoomState")
data class RoomState(
val numberOfRooms: Int
)
fun main() {
console.log(RoomState::class)
}
which now allows me to do
this.projectname.RoomState()
in pure JS, i exclude that console.log, RoomState is not availablekatokay
06/06/2020, 3:23 PMkotlin.mpp.enableGranularSourceSetsMetadata=true
to gradle.properties file
5. Changed shared build.gradle.kts to have
kotlin {
android()
ios()
sourceSets {
val commonMain by getting {
dependencies {
implementation(kotlin("stdlib-common"))
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
}
}
val androidMain by getting {
dependencies {
implementation(kotlin("stdlib-jdk7"))
implementation("androidx.core:core-ktx:1.2.0")
}
}
val androidTest by getting {}
}
}
This is where I get the error in both IntelliJ and gradle cli. I've also verified the gradle plugin defined for the root build.gradle.kts is classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4-M2")
and my gradle version is 6.5. I realize I might be misunderstanding something from the blog post, but hopefully someone can help clarify how this should work or look. Maybe pointing to a sample repo if one is available and known to work would help. The really odd behavior is that I can navigate from the IDE to the implementation of the ios target definition.natario1
06/06/2020, 4:03 PMDaemon will be stopped at the end of the build after running out of JVM memory
, then the build hangs. Does anyone know how to enable more memory, and is there any official documentation about how much memory is required by the Multiplatform plugin? Builds without KMP work just fine.
> Task :library:compileKotlinAndroidNativeArm32
Downloading native dependencies (LLVM, sysroot etc). This is a one-time action performed only on the first run of the compiler.
Downloading dependency: <https://download.jetbrains.com/kotlin/native/clang-llvm-8.0.0-linux-x86-64.tar.gz> (0 bytes/581.9 MiB).
Downloading dependency: <https://download.jetbrains.com/kotlin/native/clang-llvm-8.0.0-linux-x86-64.tar.gz> (140.4 MiB/581.9 MiB).
Downloading dependency: <https://download.jetbrains.com/kotlin/native/clang-llvm-8.0.0-linux-x86-64.tar.gz> (288.3 MiB/581.9 MiB).
Downloading dependency: <https://download.jetbrains.com/kotlin/native/clang-llvm-8.0.0-linux-x86-64.tar.gz> (425.8 MiB/581.9 MiB).
Downloading dependency: <https://download.jetbrains.com/kotlin/native/clang-llvm-8.0.0-linux-x86-64.tar.gz> (497.3 MiB/581.9 MiB).
Downloading dependency: <https://download.jetbrains.com/kotlin/native/clang-llvm-8.0.0-linux-x86-64.tar.gz> (580.1 MiB/581.9 MiB).
Downloading dependency: <https://download.jetbrains.com/kotlin/native/clang-llvm-8.0.0-linux-x86-64.tar.gz> (581.9 MiB/581.9 MiB). Done.
Extracting dependency: /home/runner/.konan/cache/clang-llvm-8.0.0-linux-x86-64.tar.gz into /home/runner/.konan/dependencies
Daemon will be stopped at the end of the build after running out of JVM memory
Andrew
06/07/2020, 5:17 AMAlexander Larsson
06/08/2020, 9:54 AMAlexander Larsson
06/08/2020, 12:15 PMtrevjones
06/08/2020, 3:11 PMsaket
06/08/2020, 5:54 PMsaket
06/08/2020, 5:54 PMjared
06/08/2020, 5:56 PM