Kapt3: Support 'processors' option in Gradle plugin (KT-8558)
Also warn if kapt3 options are used without the "apply plugin: 'kotlin-kapt'" specified.
This commit is contained in:
+8
@@ -51,6 +51,14 @@ internal fun Project.initKapt(
|
||||
val kaptExtension = extensions.getByType(KaptExtension::class.java)
|
||||
val kotlinAfterJavaTask: KotlinCompile?
|
||||
|
||||
fun warnUnsupportedKapt1Option(optionName: String) {
|
||||
kotlinTask.logger.kotlinWarn("'$optionName' option is not supported by this kapt implementation. " +
|
||||
"Please add the \"apply plugin: 'kotlin-kapt\" line to your build script to enable it.")
|
||||
}
|
||||
|
||||
if (kaptExtension.processors.isNotEmpty()) warnUnsupportedKapt1Option("processors")
|
||||
if (kaptExtension.correctErrorTypes) warnUnsupportedKapt1Option("correctErrorTypes")
|
||||
|
||||
if (kaptExtension.generateStubs) {
|
||||
kotlinAfterJavaTask = createKotlinAfterJavaTask(javaTask, kotlinTask, kotlinOptions, tasksProvider)
|
||||
|
||||
|
||||
+5
@@ -173,6 +173,11 @@ class Kapt3KotlinGradleSubplugin : KotlinGradleSubplugin<KotlinCompile> {
|
||||
pluginOptions += SubpluginOption("sources", generatedFilesDir.canonicalPath)
|
||||
pluginOptions += SubpluginOption("classes", getKaptClasssesDir(project, sourceSetName).canonicalPath)
|
||||
|
||||
val annotationProcessors = kaptExtension.processors
|
||||
if (annotationProcessors.isNotEmpty()) {
|
||||
pluginOptions += SubpluginOption("processors", annotationProcessors)
|
||||
}
|
||||
|
||||
val androidPlugin = variantData?.let {
|
||||
project.extensions.findByName("android") as? BaseExtension
|
||||
}
|
||||
|
||||
+2
@@ -30,6 +30,8 @@ open class KaptExtension {
|
||||
|
||||
open var correctErrorTypes: Boolean = false
|
||||
|
||||
open var processors: String = ""
|
||||
|
||||
private var closure: Closure<*>? = null
|
||||
|
||||
open fun arguments(closure: Closure<*>) {
|
||||
|
||||
Reference in New Issue
Block a user