Kapt, minor: make Gradle API a bit cleaner

This commit is contained in:
Yan Zhulanow
2018-03-16 20:37:40 +03:00
parent b3fbec9ec3
commit dc8eb7446f
@@ -32,6 +32,7 @@ open class KaptExtension {
open var mapDiagnosticLocations: Boolean = false
@Deprecated("Use `annotationProcessor()` and `annotationProcessors()` instead")
open var processors: String = ""
/** Explicit opt-in switch for Kapt caching. Should be used when annotation processors used by this project are
@@ -48,6 +49,15 @@ open class KaptExtension {
private var apOptionsClosure: Closure<*>? = null
private var javacOptionsClosure: Closure<*>? = null
open fun annotationProcessor(fqName: String) {
val oldProcessors = this.processors
this.processors = if (oldProcessors.isEmpty()) fqName else "$oldProcessors,$fqName"
}
open fun annotationProcessors(vararg fqName: String) {
fqName.forEach(this::annotationProcessor)
}
open fun arguments(closure: Closure<*>) {
apOptionsActions += { apOptions ->
apOptions.execute(closure)