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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user