首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Gradle可以生成多个Kotlin Native二进制文件(对于一个操作系统)吗?

Gradle可以生成多个Kotlin Native二进制文件(对于一个操作系统)吗?
EN

Stack Overflow用户
提问于 2018-12-29 04:40:29
回答 1查看 531关注 0票数 3

我能说服Gradle生成多个二进制文件吗?我有几个Kotlin包,它们的文件都有一个适当的"fun main(...)“但是默认的IntelliJ build.gradle文件只允许我指定一个"compilations.main.entryPoint“。我可以将主函数放入Kotlin类或对象中,如果这会有帮助的话。

将entryPoint参数更改为数组不起作用:)

如果目前不可能,它是Gradle的通用限制,还是仅限于“kotlin-多平台”插件?

代码语言:javascript
复制
plugins {
    id 'kotlin-multiplatform' version '1.3.11'
}

repositories {
    mavenCentral()
}

kotlin {
    targets {
        // For ARM, preset should be changed to presets.iosArm32 or presets.iosArm64
        // For Linux, preset should be changed to e.g. presets.linuxX64
        // For MacOS, preset should be changed to e.g. presets.macosX64
        fromPreset(presets.mingwX64, 'mingw')

        configure([mingw]) {
            // Comment to generate Kotlin/Native library (KLIB) instead of executable file:
            compilations.main.outputKinds('executable')
            // Change to specify fully qualified name of your application's entry point:
            compilations.main.entryPoint = 'hello.main'
        }
    }
    sourceSets {
        // Note: To enable common source sets please comment out 'kotlin.import.noCommonSourceSets' property
        // in gradle.properties file and re-import your project in IDE.
        mingwMain {
        }
        mingwTest {
        }
    }
}

task runProgram {
    def buildType = 'debug' // 'release' - Change to 'debug' to run application with debug symbols.
    dependsOn "link${buildType.capitalize()}ExecutableMingw"
    doLast {
        def programFile = kotlin.targets.mingw.compilations.main.getBinary('EXECUTABLE', buildType)
        exec {
            executable programFile
            args ''
        }
    }
}
EN

回答 1

Stack Overflow用户

发布于 2018-12-30 22:50:35

https://github.com/JetBrains/kotlin-native/issues/2505中,我刚刚得到了答案,这在Kotlin Native 1.3.20中是可能的!

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53964059

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档