-
-
Notifications
You must be signed in to change notification settings - Fork 302
Using Kotlin with the Bnd Gradle Plugin for Workspace Builds
Kotlin is a statically typed language that runs on the JVM. There is a Gradle plugin to compile Kotlin source using the Gradle build tool.
In order to use Kotlin source code with the Bnd Gradle Plugin for Workspace Builds, you will need to establish the proper compile dependencies for the compileKotlin
task. The Bnd Gradle Plugin for Workspace Builds sets up the proper compile dependencies for the compileJava
task, but the compileKotlin
task does not depend upon the compileJava
. In fact, it is the other way around. The Kotlin Gradle plugin has the compileJava
task depend upon the compileKotlin
task. This means that the compileKotlin
task will not have the proper compile dependencies on other Bnd projects.
This can be easily fixed in your gradle scripts but adding the proper dependencies to the compileKotlin
task:
bnd.project.getDependson()*.getName().each { dependency ->
compileKotlin.dependsOn(":${dependency}:assemble")
}
This can be done in a project's build.gradle
file for projects with Kotlin source code or it can be done in the base build.gradle
for multi-project builds in a subprojects
block.