diff options
author | Linnea Gräf <nea@nea.moe> | 2024-07-20 15:10:49 +0200 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-07-20 16:20:56 +0200 |
commit | 3ad44b992fbb6859b01a99eae1a317ea67754e4d (patch) | |
tree | daf1d3b317d51af547c69d13fe36322de7425cca /symbols/src/main/kotlin/process/SubscribeAnnotationProcessor.kt | |
parent | 9b1b1446814f971e914c034aab00c95fdae87163 (diff) | |
download | Firmament-3ad44b992fbb6859b01a99eae1a317ea67754e4d.tar.gz Firmament-3ad44b992fbb6859b01a99eae1a317ea67754e4d.tar.bz2 Firmament-3ad44b992fbb6859b01a99eae1a317ea67754e4d.zip |
Make builds reproducible allowing for verifying builds
[no changelog]
Diffstat (limited to 'symbols/src/main/kotlin/process/SubscribeAnnotationProcessor.kt')
-rw-r--r-- | symbols/src/main/kotlin/process/SubscribeAnnotationProcessor.kt | 17 |
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>() |