From 47e6328427e156b89eda19850400b27035fca2a9 Mon Sep 17 00:00:00 2001 From: Him188 Date: Wed, 24 Jun 2020 02:05:17 +0800 Subject: [PATCH] Rearrange old codegen --- .../codegen/{ => old}/JSettingCodegen.kt | 2 +- .../{ => old}/SettingValueUseSiteCodegen.kt | 23 +++++++++++++++---- .../codegen/{ => old}/ValueImplCodegen.kt | 20 +++++++++++++--- .../codegen/{ => old}/ValuesCodegen.kt | 2 +- 4 files changed, 38 insertions(+), 9 deletions(-) rename backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/{ => old}/JSettingCodegen.kt (98%) rename backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/{ => old}/SettingValueUseSiteCodegen.kt (90%) rename backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/{ => old}/ValueImplCodegen.kt (95%) rename backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/{ => old}/ValuesCodegen.kt (99%) diff --git a/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/JSettingCodegen.kt b/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/old/JSettingCodegen.kt similarity index 98% rename from backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/JSettingCodegen.kt rename to backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/old/JSettingCodegen.kt index b48892209..495649901 100644 --- a/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/JSettingCodegen.kt +++ b/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/old/JSettingCodegen.kt @@ -8,7 +8,7 @@ */ @file:Suppress("PRE_RELEASE_CLASS") -package net.mamoe.mirai.console.codegen +package net.mamoe.mirai.console.codegen.old /** * used to generate Java Setting diff --git a/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/SettingValueUseSiteCodegen.kt b/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/old/SettingValueUseSiteCodegen.kt similarity index 90% rename from backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/SettingValueUseSiteCodegen.kt rename to backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/old/SettingValueUseSiteCodegen.kt index f75ba40ba..e81d9a74d 100644 --- a/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/SettingValueUseSiteCodegen.kt +++ b/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/old/SettingValueUseSiteCodegen.kt @@ -9,7 +9,7 @@ @file:Suppress("PRE_RELEASE_CLASS") -package net.mamoe.mirai.console.codegen +package net.mamoe.mirai.console.codegen.old import org.intellij.lang.annotations.Language import java.io.File @@ -67,18 +67,33 @@ fun genAllValueUseSite(): String = buildString { // PRIMITIVE ARRAYS for (number in NUMBERS + OTHER_PRIMITIVES.filterNot { it == "String" }) { - appendln(genValueUseSite("${number}Array", "${number}Array")) + appendln( + genValueUseSite( + "${number}Array", + "${number}Array" + ) + ) } // TYPED ARRAYS for (number in NUMBERS + OTHER_PRIMITIVES) { - appendln(genValueUseSite("Array<${number}>", "Typed${number}Array")) + appendln( + genValueUseSite( + "Array<${number}>", + "Typed${number}Array" + ) + ) } // PRIMITIVE LISTS / PRIMITIVE SETS for (collectionName in listOf("List", "Set")) { for (number in NUMBERS + OTHER_PRIMITIVES) { - appendln(genValueUseSite("${collectionName}<${number}>", "${number}${collectionName}")) + appendln( + genValueUseSite( + "${collectionName}<${number}>", + "${number}${collectionName}" + ) + ) } } diff --git a/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/ValueImplCodegen.kt b/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/old/ValueImplCodegen.kt similarity index 95% rename from backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/ValueImplCodegen.kt rename to backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/old/ValueImplCodegen.kt index cc2e45a94..90114a110 100644 --- a/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/ValueImplCodegen.kt +++ b/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/old/ValueImplCodegen.kt @@ -9,7 +9,7 @@ @file:Suppress("PRE_RELEASE_CLASS") -package net.mamoe.mirai.console.codegen +package net.mamoe.mirai.console.codegen.old import org.intellij.lang.annotations.Language import java.io.File @@ -59,13 +59,27 @@ fun genAllValueImpl(): String = buildString { // PRIMITIVE for (number in NUMBERS + OTHER_PRIMITIVES) { - appendln(genPrimitiveValueImpl(number, number, "$number.serializer()", false)) + appendln( + genPrimitiveValueImpl( + number, + number, + "$number.serializer()", + false + ) + ) appendLine() } // PRIMITIVE ARRAYS for (number in NUMBERS + OTHER_PRIMITIVES.filterNot { it == "String" }) { - appendln(genPrimitiveValueImpl("${number}Array", "${number}Array", "${number}ArraySerializer()", true)) + appendln( + genPrimitiveValueImpl( + "${number}Array", + "${number}Array", + "${number}ArraySerializer()", + true + ) + ) appendLine() } diff --git a/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/ValuesCodegen.kt b/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/old/ValuesCodegen.kt similarity index 99% rename from backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/ValuesCodegen.kt rename to backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/old/ValuesCodegen.kt index dd1efc824..c25da5db8 100644 --- a/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/ValuesCodegen.kt +++ b/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/old/ValuesCodegen.kt @@ -9,7 +9,7 @@ @file:Suppress("ClassName", "unused", "PRE_RELEASE_CLASS") -package net.mamoe.mirai.console.codegen +package net.mamoe.mirai.console.codegen.old import org.intellij.lang.annotations.Language import java.io.File