From 63957b183ba99b5273d724aa86f11b0b8c60b4c8 Mon Sep 17 00:00:00 2001 From: Him188 <Him188@mamoe.net> Date: Thu, 23 Dec 2021 00:12:06 +0000 Subject: [PATCH] Make mirai-console-compiler-annotations multiplatform --- .../tools/compiler-annotations/build.gradle.kts | 17 ++++++++++++++--- .../{ => commonMain/kotlin}/CheckerConstants.kt | 0 .../{ => commonMain/kotlin}/ResolveContext.kt | 4 +++- .../{ => commonMain/kotlin}/RestrictedScope.kt | 0 4 files changed, 17 insertions(+), 4 deletions(-) rename mirai-console/tools/compiler-annotations/src/{ => commonMain/kotlin}/CheckerConstants.kt (100%) rename mirai-console/tools/compiler-annotations/src/{ => commonMain/kotlin}/ResolveContext.kt (96%) rename mirai-console/tools/compiler-annotations/src/{ => commonMain/kotlin}/RestrictedScope.kt (100%) diff --git a/mirai-console/tools/compiler-annotations/build.gradle.kts b/mirai-console/tools/compiler-annotations/build.gradle.kts index 272c8dfcd..229515489 100644 --- a/mirai-console/tools/compiler-annotations/build.gradle.kts +++ b/mirai-console/tools/compiler-annotations/build.gradle.kts @@ -9,9 +9,10 @@ @file:Suppress("UnusedImport") +import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType + plugins { - kotlin("jvm") - id("java") + kotlin("multiplatform") `maven-publish` } @@ -20,6 +21,16 @@ description = "Mirai Console compiler annotations" kotlin { explicitApi() + + jvm("android") { + attributes.attribute(KotlinPlatformType.attribute, KotlinPlatformType.androidJvm) + } + + jvm("common") { + attributes.attribute(KotlinPlatformType.attribute, KotlinPlatformType.common) + } + + jvm("jvm") } -configurePublishing("mirai-console-compiler-annotations") \ No newline at end of file +configureMppPublishing() \ No newline at end of file diff --git a/mirai-console/tools/compiler-annotations/src/CheckerConstants.kt b/mirai-console/tools/compiler-annotations/src/commonMain/kotlin/CheckerConstants.kt similarity index 100% rename from mirai-console/tools/compiler-annotations/src/CheckerConstants.kt rename to mirai-console/tools/compiler-annotations/src/commonMain/kotlin/CheckerConstants.kt diff --git a/mirai-console/tools/compiler-annotations/src/ResolveContext.kt b/mirai-console/tools/compiler-annotations/src/commonMain/kotlin/ResolveContext.kt similarity index 96% rename from mirai-console/tools/compiler-annotations/src/ResolveContext.kt rename to mirai-console/tools/compiler-annotations/src/commonMain/kotlin/ResolveContext.kt index 0646d9db0..693c6e63a 100644 --- a/mirai-console/tools/compiler-annotations/src/ResolveContext.kt +++ b/mirai-console/tools/compiler-annotations/src/commonMain/kotlin/ResolveContext.kt @@ -82,7 +82,9 @@ public annotation class ResolveContext( */ RESTRICTED_NO_ARG_CONSTRUCTOR, // NOT_CONSTRUCTABLE_TYPE - RESTRICTED_CONSOLE_COMMAND_OWNER, ; + RESTRICTED_CONSOLE_COMMAND_OWNER, + + RESTRICTED_ABSTRACT_MESSAGE_KEYS; public companion object } diff --git a/mirai-console/tools/compiler-annotations/src/RestrictedScope.kt b/mirai-console/tools/compiler-annotations/src/commonMain/kotlin/RestrictedScope.kt similarity index 100% rename from mirai-console/tools/compiler-annotations/src/RestrictedScope.kt rename to mirai-console/tools/compiler-annotations/src/commonMain/kotlin/RestrictedScope.kt