Skip to content

Commit 08c720e

Browse files
committed
Fix file generation issue on rebuild (#862)
1 parent 5af90e0 commit 08c720e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

querydsl-tooling/querydsl-ksp-codegen/src/main/kotlin/com/querydsl/ksp/codegen/QueryDslProcessor.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ class QueryDslProcessor(
2828
override fun finish() {
2929
val models = typeProcessor.process()
3030
models.forEach { model ->
31+
if (model.originatingFile == null) {
32+
// skip models without originating file. This happens when the model is from a compiled dependency,
33+
// so we don't have access to the source file. It is expected the Q class is packaged alongside the
34+
// compiled dependency.
35+
return@forEach
36+
}
37+
3138
val typeSpec = QueryModelRenderer.render(model)
3239
FileSpec.builder(model.className)
3340
.indent(settings.indent)
@@ -36,7 +43,7 @@ class QueryDslProcessor(
3643
.writeTo(
3744
codeGenerator = codeGenerator,
3845
aggregating = false,
39-
originatingKSFiles = listOfNotNull(model.originatingFile)
46+
originatingKSFiles = listOf(model.originatingFile)
4047
)
4148
}
4249
}

0 commit comments

Comments
 (0)