diff --git a/plugins/kapt3/src/org/jetbrains/kotlin/kapt3/Kapt3Extension.kt b/plugins/kapt3/src/org/jetbrains/kotlin/kapt3/Kapt3Extension.kt index 57bb336cf1d..fcfd5f71913 100644 --- a/plugins/kapt3/src/org/jetbrains/kotlin/kapt3/Kapt3Extension.kt +++ b/plugins/kapt3/src/org/jetbrains/kotlin/kapt3/Kapt3Extension.kt @@ -126,11 +126,6 @@ abstract class AbstractKapt3Extension( fun doNotGenerateCode() = AnalysisResult.Companion.success(BindingContext.EMPTY, module, shouldGenerateCode = false) - if (files.isEmpty()) { - logger.info("No Kotlin source files, aborting") - return if (aptOnly) doNotGenerateCode() else null - } - logger.info { "Initial analysis took ${System.currentTimeMillis() - pluginInitializedTime} ms" } logger.info { "Kotlin files to compile: " + files.map { it.virtualFile?.name ?: "" } } @@ -154,6 +149,12 @@ abstract class AbstractKapt3Extension( if (thr !is KaptError || thr.kind != KaptError.Kind.ERROR_RAISED) { logger.exception(thr) } + + // We don't have any Kotlin files, so there isn't anything we can report diagnostic on + if (files.isEmpty()) { + throw thr + } + bindingTrace.report(ErrorsKapt3.KAPT3_PROCESSING_ERROR.on(files.first())) return null // Compilation will be aborted anyway because of the error above } finally {