• r

    Rachid

    2 years ago
    I have a multiplatform project and am writing unit tests for common code. It appears that Mockk isn't supported yet. Does anyone know how to mock classes in common source sets?
    r
    h
    +2
    11 replies
    Copy to Clipboard
  • ciriti

    ciriti

    2 years ago
    Hi guys, do you know if it possible to use encryption with sqldelight?
    ciriti
    m
    +1
    6 replies
    Copy to Clipboard
  • j

    janvladimirmostert

    2 years ago
    Is it possible to mark certain classes / functions to be excluded from DCE? I'm trying to build a KotlinJS library that will be consumed by handwritten JavaScript and unless i specifically console.log that class, it gets removed by DCE
    @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 available
    j
    christophsturm
    5 replies
    Copy to Clipboard
  • k

    katokay

    2 years ago
    Following the 1.4-M2 blog post to change some of my gradle setup for a multiplatform mobile project and I keep getting the error "KotlinTarget with name 'ios' not found." Any help to get this working would be appreciated!1. Upgraded Kotlin IntelliJ plugin to the latest one from 1.4-M2 2. Create new Kotlin project using the experimental wizard, chose to use kts for the gradle files 3. Everything builds fine after this step 4. Added
    kotlin.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.
    k
    zalewski.se
    +1
    5 replies
    Copy to Clipboard
  • natario1

    natario1

    2 years ago
    When running gradle multiplatform builds in CI (GitHub Actions), I get the warning
    Daemon 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
    natario1
    Erik Christensen
    2 replies
    Copy to Clipboard
  • a

    Andrew

    2 years ago
    A MP library will obviously be consumed by multiple targets, but to start I'm not even sure how to do it for the first at the moment. I'd like my Android studio library to use this shared code but no idea what the workflow looks like. For example 1) Make a code change in shared library 2) ??? 3) Run android app with that code change. Currently I have a shared JVM gradle library I reference with a relative path in my settings.gradle so android studio sees that as a 2nd module and my code changes work seamlessly. Attempting the same with an MP project didn't work.
    a
    e
    +1
    7 replies
    Copy to Clipboard
  • a

    Alexander Larsson

    2 years ago
    Does anyone know if I can use the new 1.4 M2 Kotlin Plugin but still use an older version of Kotlin? The new project creator is really nice for setting up an MPP project so have been trying to use it but going back to an older Kotlin plugin version after project creation does not work for me.
    a
    gildor
    +1
    5 replies
    Copy to Clipboard
  • a

    Alexander Larsson

    2 years ago
    Does anyone know of any good seed project for an iOS/Android MPP Library? Something like https://github.com/Dallanosm/kotlin-multiplatform-seed but for iOS / Android library (I do not want the apps code to be in the project).
    a
    s
    +2
    5 replies
    Copy to Clipboard
  • t

    trevjones

    2 years ago
    Is anyone aware of an mpp http/s server? The usecase is mock web server deployable to android/iOS/node to try and make things a bit more self contained in a test pipeline.
    t
    c
    +1
    8 replies
    Copy to Clipboard
  • saket

    saket

    2 years ago
    is this what you’re looking for? https://youtrack.jetbrains.com/issue/KT-38685
    saket
    1 replies
    Copy to Clipboard