只为 Kotlin/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 将为每个可执行文件触发构建。在某些时候,制作所有可执行二进制文件开始需要很长时间。是否可以只构建一个可执行文件?类似于 gradle buildFoo

有Gradle插件自己生成的任务run(execName)(buildtype)Executable(OS)。此外,您可以使用任务 link(execName)(buildtype)Executable(OS) 生成二进制文件。