Add tracked dependencies to subscriptions

[no changelog]
This commit is contained in:
Linnea Gräf
2024-07-18 00:27:49 +02:00
parent e96bef2320
commit 830f3db26a

View File

@@ -30,9 +30,10 @@ class SubscribeAnnotationProcessor(
val codeGenerator: CodeGenerator, val codeGenerator: CodeGenerator,
) : SymbolProcessor { ) : SymbolProcessor {
override fun finish() { override fun finish() {
val subscriptionSet = subscriptions.mapTo(mutableSetOf()) { it.parent.containingFile!! }
val dependencies = Dependencies( val dependencies = Dependencies(
aggregating = true, aggregating = true,
*subscriptions.mapTo(mutableSetOf()) { it.parent.containingFile!! }.toTypedArray()) *subscriptionSet.toTypedArray())
val subscriptionsFile = val subscriptionsFile =
codeGenerator codeGenerator
.createNewFile(dependencies, "moe.nea.firmament.annotations.generated", "AllSubscriptions") .createNewFile(dependencies, "moe.nea.firmament.annotations.generated", "AllSubscriptions")
@@ -41,6 +42,9 @@ class SubscribeAnnotationProcessor(
appendLine("// This file is @generated by SubscribeAnnotationProcessor at ${SimpleDateFormat("yyyy-MM-dd HH:mm:ss z").format( appendLine("// This file is @generated by SubscribeAnnotationProcessor at ${SimpleDateFormat("yyyy-MM-dd HH:mm:ss z").format(
Date())}") Date())}")
appendLine("// Do not edit") appendLine("// Do not edit")
for (file in subscriptionSet) {
appendLine("// Dependency: ${file.filePath}")
}
appendLine("package moe.nea.firmament.annotations.generated") appendLine("package moe.nea.firmament.annotations.generated")
appendLine() appendLine()
appendLine("import moe.nea.firmament.events.subscription.*") appendLine("import moe.nea.firmament.events.subscription.*")