aboutsummaryrefslogtreecommitdiff
path: root/symbols/src/main/kotlin/process/SubscribeAnnotationProcessor.kt
diff options
context:
space:
mode:
Diffstat (limited to 'symbols/src/main/kotlin/process/SubscribeAnnotationProcessor.kt')
-rw-r--r--symbols/src/main/kotlin/process/SubscribeAnnotationProcessor.kt17
1 files changed, 14 insertions, 3 deletions
diff --git a/symbols/src/main/kotlin/process/SubscribeAnnotationProcessor.kt b/symbols/src/main/kotlin/process/SubscribeAnnotationProcessor.kt
index 0999878..6d88b69 100644
--- a/symbols/src/main/kotlin/process/SubscribeAnnotationProcessor.kt
+++ b/symbols/src/main/kotlin/process/SubscribeAnnotationProcessor.kt
@@ -30,6 +30,7 @@ class SubscribeAnnotationProcessor(
val codeGenerator: CodeGenerator,
) : SymbolProcessor {
override fun finish() {
+ subscriptions.sort()
val subscriptionSet = subscriptions.mapTo(mutableSetOf()) { it.parent.containingFile!! }
val dependencies = Dependencies(
aggregating = true,
@@ -39,8 +40,7 @@ class SubscribeAnnotationProcessor(
.createNewFile(dependencies, "moe.nea.firmament.annotations.generated", "AllSubscriptions")
.bufferedWriter()
subscriptionsFile.apply {
- appendLine("// This file is @generated by SubscribeAnnotationProcessor at ${SimpleDateFormat("yyyy-MM-dd HH:mm:ss z").format(
- Date())}")
+ appendLine("// This file is @generated by SubscribeAnnotationProcessor")
appendLine("// Do not edit")
for (file in subscriptionSet) {
appendLine("// Dependency: ${file.filePath}")
@@ -70,7 +70,18 @@ class SubscribeAnnotationProcessor(
val parent: KSClassDeclaration,
val child: KSFunctionDeclaration,
val type: KSType,
- )
+ ) : Comparable<Subscription> {
+ override fun compareTo(other: Subscription): Int {
+ var compare = parent.qualifiedName!!.asString().compareTo(other.parent.qualifiedName!!.asString())
+ if (compare != 0) return compare
+ compare = other.child.simpleName.asString().compareTo(child.simpleName.asString())
+ if (compare != 0) return compare
+ compare = other.type.declaration.qualifiedName!!.asString()
+ .compareTo(type.declaration.qualifiedName!!.asString())
+ if (compare != 0) return compare
+ return 0
+ }
+ }
val subscriptions = mutableListOf<Subscription>()