How to declare kotlin compile args globally withou...
# gradle
p
How to declare kotlin compile args globally without copy-paste for every subproject? Currently using this snippet
Copy code
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
    kotlinOptions {
        allWarningsAsErrors = true
        freeCompilerArgs = ["-Xprogressive"]
    }
}
g
Put to root project and wrap to
allprojects
block
c
In kotlin-dsl, I use more concise and idiomatic syntax, like this:
Copy code
tasks.withType<KotlinCompile> {
	kotlinOptions {
		allWarningsAsErrors = true
		freeCompilerArgs = listOf("-Xjsr305=strict", "-Xprogressive")
	}
}
configure(allprojects)
is still needed of course, I'm only commenting on the
withType
part
👍 1