Kapt: Remove duplicating check, this also removes the senseless warning (KT-21425)

This commit is contained in:
Yan Zhulanow
2017-11-27 16:39:12 +09:00
committed by Yan Zhulanow
parent 4c96453a4b
commit d58665b5a8
2 changed files with 7 additions and 6 deletions
@@ -203,9 +203,6 @@ class Kapt3KotlinGradleSubplugin : KotlinGradleSubplugin<KotlinCompile> {
pluginOptions += SubpluginOption("aptMode", aptMode)
disableAnnotationProcessingInJavaTask()
// Skip annotation processing in kotlinc if no kapt dependencies were provided
if (kaptClasspath.isEmpty()) return pluginOptions
kaptClasspath.forEach { pluginOptions += SubpluginOption("apclasspath", it.absolutePath) }
javaCompile.source(generatedFilesDir)
@@ -218,14 +218,18 @@ class Kapt3ComponentRegistrar : ComponentRegistrar {
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) {
val nonExistentOptionName = when {
sourcesOutputDir == null -> "Sources output directory"
classFilesOutputDir == null -> "Classes output directory"
apClasspath == null -> "Annotation processing classpath"
stubsOutputDir == null -> "Stubs output directory"
else -> throw IllegalStateException()
}