Kapt: Allow empty .kt files list in kapt in order to support kapt with Java-only source files. (KT-15675)

This commit is contained in:
Yan Zhulanow
2017-01-30 18:48:07 +03:00
parent 38b79a51d5
commit 18e0baa13e
@@ -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 ?: "<in memory ${it.hashCode()}>" } }
@@ -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 {