I'm having trouble including multiple Kotlin files...
# kotlin-native
s
I'm having trouble including multiple Kotlin files in my kotlin/native gradle project. Everything works if I keep everything in a single file. As soon as I move some extension functions into another Kotlin file in the src dir, I can't access it anymore. How do I tell Gradle to compile multiple Kotlin/native files?
m
Strange, works for me without any issues... Even multiple directories For example https://github.com/msink/kotlin-libui/blob/master/samples/table/build.gradle
Copy code
konanArtifacts {
    program('table', targets: ['linux', 'mingw']) {
        //TODO: reenable macos when uiImage will be fixed
        srcDir 'src/main/kotlin'
        srcDir 'src/main/resources'
        libraries {
            artifact project(':libui-ktx'), 'libui-ktx'
        }
        target('mingw') {
            dependsOn 'windowsResources'
            inputs.file resFile
            linkerOpts "$resFile -mwindows"
        }
    }
}
s
perhaps the issue is that I have no
srcDir
specified. Let me try.
Yes 🙂 Specifying the
srcDir
did the trick. Thank you! I must have gotten lucky with it somehow finding my
Main.kt
file. Perhaps it looks for a file named main by default or something