Search code examples
kotlinkotlin-native

Build only one executable for Kotlin/Native project


Kotlin/Native allows to produce multiple binaries.

kotlin {
    binaries {
        executable()                       // Executable with default name.
        executable("foo")                  // Custom binary name.
        executable("bar", listOf(RELEASE)) // Custom build types.
        ...
    }
}

gradle build will trigger build for each executable. At some point it's starting to take a long time to make all the executable binaries. Is it possible to build only one executable? Something like gradle buildFoo


Solution

  • There are tasks with names constructed as run(execName)(buildtype)Executable(OS) that the Gradle plugin generates by himself. Also, you can use a task link(execName)(buildtype)Executable(OS) to produce a binary file.