I\'m compiling a Kotlin library jar with Gradle using the Kotlin gradle plugin:
apply plugin: \'kotlin\'
I\'m trying to find a way to pass a sim
You can specify compiler args inside kotlinOptions
closure on tasks of KotlinCompile
type. For all of them, for instance:
allprojects {
...
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
jvmTarget = '1.6'
freeCompilerArgs += '-include-runtime'
}
}
}
Kotlin docs: using Gradle
If anyone is using the kotlin DSL you can try this too:
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
val compileKotlin: KotlinCompile by tasks
compileKotlin.kotlinOptions.includeRuntime = true
Try this:
compileKotlin {
kotlinOptions.includeRuntime = true
}
UPD btw this exact option includeRuntime
couldn't work because it is not Gradle way. There are many options to build jar with dependencies in Gradle: Gradle – Create a Jar file with dependencies, Gradle Shadow