https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
multiplatform
  • s

    Sam Garfinkel

    04/11/2020, 7:31 PM
    Are
    project(":foo")
    style dependencies supported when the callee is a
    kotlin("jvm")
    project and the project
    foo
    is a multiplatform project?
    d
    r
    a
    • 4
    • 6
  • p

    pablisco

    04/11/2020, 7:55 PM
    x-posting from #intellij becauses I’m not sure where this is more pertinent as it affects both subjects 🙂
    • 1
    • 1
  • k

    Kurt Renzo Acosta

    04/12/2020, 4:36 AM
    Hi, everyone! How are you currently mocking for Kotlin/Native tests? I'm using mockk but it's not for native. Right now, I'm just leaving it at that and waiting for native support but I want to put my tests in native and considering hand-writing fake classes just so I can achieve it. Is this something I should consider or is it better to wait for mockk's native support? Thanks in advance!
    s
    a
    c
    • 4
    • 17
  • d

    Davide Giuseppe Farella

    04/12/2020, 6:26 AM
    Sayin’ that I got a
    domain
    module, how can another Android module use “its jvm”, avoiding to declare an useless Android target for
    domain
    ?
    o
    • 2
    • 2
  • b

    Brendan Weinstein

    04/13/2020, 3:29 AM
    Just sanity checking, but are most folks using
    cinterop
    to manually wire objc/swift dependencies into iosMain or have folks managed to get the cocoapods plugin to smoothly do this by declaring a pod?
    k
    • 2
    • 6
  • e

    Euler

    04/13/2020, 12:19 PM
    Hi, everyone! Do you know when suspend functions in Kotlin will be supported in Swift? I am generating a framework using cinterop to import external Objective C framework into my project. The generated framework is used by an application developed in Swift. I have to follow a specification which describes the APIs of my framework. In the documentation, there are synchronous and asynchronous APIs. My problem is how to implement the APIs synchronous if suspend functions in Kotlin are not supported in Swift. https://kotlinlang.org/docs/reference/native/objc_interop.html#unsupported
    r
    v
    k
    • 4
    • 8
  • s

    Sergio Casero

    04/13/2020, 12:27 PM
    Hi folks! I just want to share with you one solution to wrap callback based libraries, like
    Firebase
    , take a look and please, if you know a better way to do that, please, share! https://gist.github.com/sergiocasero/eca986497c2025d703074cc995ed3618
    👍 1
    k
    • 2
    • 2
  • c

    curioustechizen

    04/14/2020, 8:39 AM
    Is there a way to figure out what contributes to the size of the generated iOS framework? I have a framework that's around 50MB (90MB if I generate a fat framework with iOSX64 and iOSArm64). I wonder if there's any unused stuff that's somehow getting imported into the framework. The generated header file is around 650KB so it is big (there are about 300 classes)
    🤔 1
    k
    a
    • 3
    • 12
  • s

    Sergio Casero

    04/14/2020, 8:42 AM
    Hello, is there any way to use extension functions from kotlin on swift??, for example
    fun UIViewController.hello() { println("Hello from kotlin") }
    r
    • 2
    • 1
  • p

    Patrick Jackson

    04/15/2020, 2:05 PM
    Anyone know of a fix for AS jumping to decompiled source rather than actual source file when jumping to declaration of a class/var/etc? For example cmd + click on a KMP class reference jumps to decompiled code. This only happens when doing this in code in another module. https://stackoverflow.com/questions/61230781/kotlin-multiplatform-go-to-declaration-goes-to-decompiled-code
    l
    t
    • 3
    • 3
  • b

    Brendan Weinstein

    04/16/2020, 1:53 AM
    Just sharing this here for anyone who needs a hacky workaround to make network calls with multi-threaded coroutines until ktor resolves the mutability bugs.
    👍 1
    r
    k
    a
    • 4
    • 5
  • v

    vanniktech

    04/16/2020, 4:37 PM
    Has anyone written an
    apply
    method on iOS that’s behaving similar to Kotlin’s apply?
    s
    • 2
    • 8
  • b

    Brendan Weinstein

    04/17/2020, 6:23 AM
    Just sharing a learning moment here that's probably well-covered by documentation but was still a surprise. I was running into a
    IncorrectDereferenceException
    from swift code that depends on a shared kotlin module. The error specified
    ExitEntity$impl
    as the problematic class which is a
    data class
    code generated by sqldelight. I thought IncorrectDereferenceException is just thrown when some top-level variable is accessed off the main thread and isn't annotated with @ThreadLocal or @SharedImmutable. I was able to address by making the query within the kotlin module and freezing the object before it is used on the swift-side. I started off debugging by writing an
    iosTest
    within my shared kotlin module that retrieves an ExitEntity from the database on one thread and then accesses a field of the object on a different thread. The test passes without an exception being thrown. My takeaway is that kotlin objects referenced in swift need to be frozen if passed between threads, even though the same object can be passed between threads without issue if solely in kotlin code.
    👍 1
    k
    • 2
    • 1
  • r

    Rob Murdock

    04/17/2020, 3:24 PM
    top of the brain thought with no research so far: does the multiplatform kotlin-test package only support annotation based test loading? It’d be nice to be able to register a test function on-the-fly (which would allow for Mocha-like test frameworks to be written).
    k
    • 2
    • 9
  • o

    octylFractal

    04/17/2020, 8:41 PM
    is the new (1.4-M1)
    .d.ts
    generation available in multiplatform JS? I can't seem to get it to produce the output in the build folder, only the
    .js
    files
    s
    • 2
    • 5
  • t

    treelzebub

    04/17/2020, 10:42 PM
    what's the latest news on a datetime lib from JetBrains? There was a brief mention back in december (https://blog.jetbrains.com/kotlin/2019/12/what-to-expect-in-kotlin-1-4-and-beyond/) but not much since.
    🙏 2
    s
    • 2
    • 3
  • j

    Javier

    04/18/2020, 3:37 PM
    Hello, why I can’t get the com.android.library?
    plugins {
        id("com.android.library")
        kotlin("multiplatform") version "1.4-M1"
        id("maven-publish")
    }
    d
    • 2
    • 2
  • s

    saket

    04/18/2020, 8:44 PM
    What’s interesting is that the stdlib was earlier accessible without even adding it as a dependency to my native targets
    r
    • 2
    • 5
  • j

    Javier

    04/18/2020, 8:52 PM
    I am getting this error and I have the test-common dependency
    .../commonTest/kotlin/sample/SampleTests.kt: (3, 20): Unresolved reference: Test
    • 1
    • 1
  • s

    saket

    04/18/2020, 10:55 PM
    I’m essentially trying to add the macOS equivalent for my iOS tests command:
    task checkiOS {
      def device = project.findProperty("iosDevice")?.toString() ?: "iPhone 8"
      dependsOn 'linkDebugTestIos'
      group = JavaBasePlugin.VERIFICATION_GROUP
      description = "Runs tests for target 'ios' on an iOS simulator"
    
      doLast {
        def binary = kotlin.targets.ios.binaries.getTest('DEBUG').outputFile
        exec {
          commandLine 'xcrun', 'simctl', 'spawn',  '--standalone', device, binary.absolutePath
        }
      }
    }
    tasks.check.dependsOn checkiOS
    d
    r
    • 3
    • 6
  • s

    saket

    04/19/2020, 12:55 AM
    SQLDelight is already supposed to handle linking of sqlite for native targets automatically
    j
    • 2
    • 4
  • a

    Amanjeet Singh

    04/19/2020, 1:34 PM
    I am not able to run my tests in commonTest. Am I missing some setup in configuration in Android studio?
    v
    s
    +3
    • 6
    • 13
  • d

    Davide Giuseppe Farella

    04/19/2020, 6:42 PM
    What is the entry point for
    squareup.okio
    on the shared code? The doc uses
    File
    which is only a jvm type
    Oh, nvm, I just looked at the source code and noticed that only jvm is implemented 😅 So, what is the best way for handle files on shared code? Basically I need to write a file and read its name
    a
    • 2
    • 5
  • e

    emmano

    04/19/2020, 9:05 PM
    Hello all. I have ported a Kotlin JVM library to be a multiplatform library and now I am also trying to migrate its tests. The JVM tests pass as expected, but the KN tests do not. Originally the JVM tests used
    TestCoroutineScope
    and
    TestCoroutineDispatcher
    to control delays, how can the same kind of test be written for KN? Namely, it seems that
    runBlockingTest{}
    is a JVM only construct. Probably because it uses
    DelayController
    which is not available in KN (or so it seems). Here is the test class. The first test passes in both platforms, The second one only passes in JVM land. Any help will be appreciated.
    c
    k
    • 3
    • 32
  • d

    Derek Ellis

    04/20/2020, 12:37 AM
    What's the easiest way to enable building for all native targets if there's no platform-specific native code at all? (I.e. pure Kotlin library)
    d
    • 2
    • 1
  • j

    Javier

    04/20/2020, 8:58 AM
    The blue squares for androidMain/Test sourceSets are not appearing in project view, but I uploaded the library to bintray, downloaded in another app and I think all is working (at least I can reference the androidMain code), is it a IntelliJ bug?
    s
    • 2
    • 1
  • f

    Friedger

    04/20/2020, 10:31 AM
    I am trying to add a js target to my project that I started from KaMPStart. Running ./gradlew shared:build gives me a can't read property 'prototype' of undefined error:
    /home/friedger/_repos/github/openintents/stacks-transactions-kotlin/build/js/packages/StacksTransactions-shared/kotlin/StacksTransactions-shared.js:11
    }(this, function (_, Kotlin) {
     ^
    TypeError: Cannot read property 'prototype' of undefined
        at /home/friedger/_repos/github/openintents/stacks-transactions-kotlin/build/js/packages/StacksTransactions-shared/kotlin/StacksTransactions-shared.js:265:49
    Any ideas what is going wrong?
    • 1
    • 3
  • d

    dimsuz

    04/20/2020, 11:36 AM
    What is the meta-programming story for KMP? Is it planned, is there an issue on bugtracker I can vote on? JVM has (imperfect)
    kapt
    , but I'd really like to be able to also generate common code. I know about kotlin compiler plugins, but this seems like an overkill.
    s
    • 2
    • 8
  • e

    edenman

    04/20/2020, 7:55 PM
    Trying to expose a ConflatedBroadcastChannel from a kmp module. Anybody seen this before?
    ➕ 1
    o
    • 2
    • 5
  • e

    edenman

    04/20/2020, 11:21 PM
    is there not a task to just run tests in
    commonTest
    ? I see gradle tasks for the various platforms (
    jvmTest
    ,
    jsTest
    , etc) but nothing for just running
    commonTest
    e
    g
    k
    • 4
    • 6
Powered by Linen
Title
e

edenman

04/20/2020, 11:21 PM
is there not a task to just run tests in
commonTest
? I see gradle tasks for the various platforms (
jvmTest
,
jsTest
, etc) but nothing for just running
commonTest
also if I run
jvmTest
i get this compilation error on my test in `commonTest`:
Unresolved reference: Test
e

emmano

04/21/2020, 12:04 AM
common tests need to be ran in a specific platform.
When you create tests in common your are essentially creating tests for functionality that will be shared across platforms hence it makes sense that common tests need to be ran in each platform you are targeting
e

edenman

04/21/2020, 12:09 AM
ok gotcha, that makes sense, thanks
g

gmazzo

04/21/2020, 8:14 AM
Regarding this topic, does anyone know how to share
tests
between two MP modules? I mean, given
A
and
B
, both MPP, to
B
’s
commonTest
to have all clases defined in `A`’s
commonTest
for instance. I’m playing around Gradle’s Variants but it’s not an easy task to do.
k

Kris Wong

04/21/2020, 12:57 PM
i am not aware of a way to share code across modules other than creating a shared library
View count: 1