Skip to content

Commit 18e0baa

Browse files
committed
Kapt: Allow empty .kt files list in kapt in order to support kapt with Java-only source files. (KT-15675)
1 parent 38b79a5 commit 18e0baa

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

plugins/kapt3/src/org/jetbrains/kotlin/kapt3/Kapt3Extension.kt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,6 @@ abstract class AbstractKapt3Extension(
126126

127127
fun doNotGenerateCode() = AnalysisResult.Companion.success(BindingContext.EMPTY, module, shouldGenerateCode = false)
128128

129-
if (files.isEmpty()) {
130-
logger.info("No Kotlin source files, aborting")
131-
return if (aptOnly) doNotGenerateCode() else null
132-
}
133-
134129
logger.info { "Initial analysis took ${System.currentTimeMillis() - pluginInitializedTime} ms" }
135130
logger.info { "Kotlin files to compile: " + files.map { it.virtualFile?.name ?: "<in memory ${it.hashCode()}>" } }
136131

@@ -154,6 +149,12 @@ abstract class AbstractKapt3Extension(
154149
if (thr !is KaptError || thr.kind != KaptError.Kind.ERROR_RAISED) {
155150
logger.exception(thr)
156151
}
152+
153+
// We don't have any Kotlin files, so there isn't anything we can report diagnostic on
154+
if (files.isEmpty()) {
155+
throw thr
156+
}
157+
157158
bindingTrace.report(ErrorsKapt3.KAPT3_PROCESSING_ERROR.on(files.first()))
158159
return null // Compilation will be aborted anyway because of the error above
159160
} finally {

0 commit comments

Comments
 (0)