-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Description
While looking at #1495 i noticed that there's currently no nice option to configure Gradle extensions.
This
kotlin {
compilerOptions {
jvmTarget = JvmTarget.JVM_1_8
freeCompilerArgs += '-Xjsr305=strict'
}
}
requires fiddling with GradleBuild.snippets()
and manually constructing the coirrect syntax. It would be nice if GradleBuild
could offer an API to to do that more nicely.
Maybe something like this?
build.extensions().customize("kotlin", (kotlin) -> kotlin.nested("compilerOptions", (compilerOptions) -> {
compilerOptions.attributeWithType("jvmTarget", getJvmTarget(), "org.jetbrains.kotlin.gradle.dsl.JvmTarget");
if (!CollectionUtils.isEmpty(this.settings.getCompilerArgs())) {
compilerOptions.invoke("freeCompilerArgs.addAll", quote(this.settings.getCompilerArgs()));
}
}));