Kapt: Remove duplicating check, this also removes the senseless warning (KT-21425)
This commit is contained in:
committed by
Yan Zhulanow
parent
4c96453a4b
commit
d58665b5a8
-3
@@ -203,9 +203,6 @@ class Kapt3KotlinGradleSubplugin : KotlinGradleSubplugin<KotlinCompile> {
|
|||||||
pluginOptions += SubpluginOption("aptMode", aptMode)
|
pluginOptions += SubpluginOption("aptMode", aptMode)
|
||||||
disableAnnotationProcessingInJavaTask()
|
disableAnnotationProcessingInJavaTask()
|
||||||
|
|
||||||
// Skip annotation processing in kotlinc if no kapt dependencies were provided
|
|
||||||
if (kaptClasspath.isEmpty()) return pluginOptions
|
|
||||||
|
|
||||||
kaptClasspath.forEach { pluginOptions += SubpluginOption("apclasspath", it.absolutePath) }
|
kaptClasspath.forEach { pluginOptions += SubpluginOption("apclasspath", it.absolutePath) }
|
||||||
|
|
||||||
javaCompile.source(generatedFilesDir)
|
javaCompile.source(generatedFilesDir)
|
||||||
|
|||||||
@@ -218,14 +218,18 @@ class Kapt3ComponentRegistrar : ComponentRegistrar {
|
|||||||
|
|
||||||
val annotationProcessors = configuration.get(Kapt3ConfigurationKeys.ANNOTATION_PROCESSORS) ?: ""
|
val annotationProcessors = configuration.get(Kapt3ConfigurationKeys.ANNOTATION_PROCESSORS) ?: ""
|
||||||
|
|
||||||
val apClasspath = configuration.get(ANNOTATION_PROCESSOR_CLASSPATH)?.map(::File)
|
val apClasspath = configuration.get(ANNOTATION_PROCESSOR_CLASSPATH)?.map(::File) ?: emptyList()
|
||||||
|
|
||||||
if (sourcesOutputDir == null || classFilesOutputDir == null || apClasspath == null || stubsOutputDir == null) {
|
if (apClasspath.isEmpty()) {
|
||||||
|
// Skip annotation processing if no annotation processors were provided
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sourcesOutputDir == null || classFilesOutputDir == null || stubsOutputDir == null) {
|
||||||
if (aptMode != AptMode.WITH_COMPILATION) {
|
if (aptMode != AptMode.WITH_COMPILATION) {
|
||||||
val nonExistentOptionName = when {
|
val nonExistentOptionName = when {
|
||||||
sourcesOutputDir == null -> "Sources output directory"
|
sourcesOutputDir == null -> "Sources output directory"
|
||||||
classFilesOutputDir == null -> "Classes output directory"
|
classFilesOutputDir == null -> "Classes output directory"
|
||||||
apClasspath == null -> "Annotation processing classpath"
|
|
||||||
stubsOutputDir == null -> "Stubs output directory"
|
stubsOutputDir == null -> "Stubs output directory"
|
||||||
else -> throw IllegalStateException()
|
else -> throw IllegalStateException()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user