diff --git a/Writerside/d.tree b/Writerside/d.tree index 163705b0..92be3181 100644 --- a/Writerside/d.tree +++ b/Writerside/d.tree @@ -16,8 +16,8 @@ - - + + diff --git a/Writerside/topics/api-list.md b/Writerside/topics/api-list.md new file mode 100644 index 00000000..39a2000c --- /dev/null +++ b/Writerside/topics/api-list.md @@ -0,0 +1,264 @@ +# API列表 + +此处会列举 `API 模块` 中、`love.forte.simbot.qguild.api` 包下定义的所有 `QQGuildApi` 实现。 + +> 对于一个具体的API的详细说明,我们建议你前往 [API 文档](https://docs.simbot.forte.love/) 或源码注释查阅, +> 因为那是最贴合真实情况且最全面的。 + + + + +> `love.forte.simbot.qguild.api.announces.CreateAnnouncesApi` + + + + +> `love.forte.simbot.qguild.api.announces.DeleteAnnouncesApi` + + + + +> `love.forte.simbot.qguild.api.apipermission.DemandApiPermissionApi` + + + + +> `love.forte.simbot.qguild.api.apipermission.GetApiPermissionListApi` + + + + +> `love.forte.simbot.qguild.api.channel.CreateChannelApi` + + + + +> `love.forte.simbot.qguild.api.channel.DeleteChannelApi` + + + + +> `love.forte.simbot.qguild.api.channel.GetChannelApi` + + + + +> `love.forte.simbot.qguild.api.channel.GetChannelOnlineNumsApi` + + + + +> `love.forte.simbot.qguild.api.channel.GetGuildChannelListApi` + + + + +> `love.forte.simbot.qguild.api.channel.ModifyChannelApi` + + + + +> `love.forte.simbot.qguild.api.channel.permissions.GetChannelMemberPermissionsApi` + + + + +> `love.forte.simbot.qguild.api.channel.permissions.GetChannelRolePermissionsApi` + + + + +> `love.forte.simbot.qguild.api.channel.permissions.ModifyChannelMemberPermissionsApi` + + + + +> `love.forte.simbot.qguild.api.channel.permissions.ModifyChannelRolePermissionsApi` + + + + +> `love.forte.simbot.qguild.api.channel.pins.AddPinsMessageApi` + + + + +> `love.forte.simbot.qguild.api.channel.pins.DeletePinsMessageApi` + + + + +> `love.forte.simbot.qguild.api.channel.pins.GetPinsMessageApi` + + + + +> `love.forte.simbot.qguild.api.channel.schedules.CreateScheduleApi` + + + + +> `love.forte.simbot.qguild.api.channel.schedules.DeleteScheduleApi` + + + + +> `love.forte.simbot.qguild.api.channel.schedules.GetScheduleApi` + + + + +> `love.forte.simbot.qguild.api.channel.schedules.GetScheduleListApi` + + + + +> `love.forte.simbot.qguild.api.channel.schedules.ModifyScheduleApi` + + + + +> `love.forte.simbot.qguild.api.forum.DeleteThreadApi` + + + + +> `love.forte.simbot.qguild.api.forum.GetThreadApi` + + + + +> `love.forte.simbot.qguild.api.forum.GetThreadListApi` + + + + +> `love.forte.simbot.qguild.api.forum.PublishThreadApi` + + + + +> `love.forte.simbot.qguild.api.GatewayApis$Normal` + + + + +> `love.forte.simbot.qguild.api.GatewayApis$Shared` + + + + +> `love.forte.simbot.qguild.api.guild.GetGuildApi` + + + + +> `love.forte.simbot.qguild.api.guild.mute.MuteAllApi` + + + + +> `love.forte.simbot.qguild.api.guild.mute.MuteMemberApi` + + + + +> `love.forte.simbot.qguild.api.guild.mute.MuteMultiMemberApi` + + + + +> `love.forte.simbot.qguild.api.member.DeleteMemberApi` + + + + +> `love.forte.simbot.qguild.api.member.GetGuildMemberListApi` + + + + +> `love.forte.simbot.qguild.api.member.GetGuildRoleMemberListApi` + + + + +> `love.forte.simbot.qguild.api.member.GetMemberApi` + + + + +> `love.forte.simbot.qguild.api.message.DeleteMessageApi` + + + + +> `love.forte.simbot.qguild.api.message.direct.CreateDmsApi` + + + + +> `love.forte.simbot.qguild.api.message.direct.DeleteDmsApi` + + + + +> `love.forte.simbot.qguild.api.message.direct.DmsSendApi` + + + + +> `love.forte.simbot.qguild.api.message.GetMessageApi` + + + + +> `love.forte.simbot.qguild.api.message.MessageSendApi` + + + + +> `love.forte.simbot.qguild.api.message.setting.GetMessageSettingApi` + + + + +> `love.forte.simbot.qguild.api.role.AddMemberRoleApi` + + + + +> `love.forte.simbot.qguild.api.role.CreateGuildRoleApi` + + + + +> `love.forte.simbot.qguild.api.role.DeleteGuildRoleApi` + + + + +> `love.forte.simbot.qguild.api.role.GetGuildRoleListApi` + + + + +> `love.forte.simbot.qguild.api.role.ModifyGuildRoleApi` + + + + +> `love.forte.simbot.qguild.api.role.RemoveMemberRoleApi` + + + + +> `love.forte.simbot.qguild.api.user.GetBotGuildListApi` + + + + +> `love.forte.simbot.qguild.api.user.GetBotInfoApi` + + + diff --git a/Writerside/topics/api.md b/Writerside/topics/api.md deleted file mode 100644 index 10e49c17..00000000 --- a/Writerside/topics/api.md +++ /dev/null @@ -1,9 +0,0 @@ -# 概述 - -提供一些针对QQ频道提供的一些特殊消息、具体功能概念实现的描述。 - -比如, - -即为一种特殊类型的消息,而 - -便是一种功能概念实现。 diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index b675d32a..ef8d18e0 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -22,6 +22,7 @@ plugins { repositories { mavenCentral() gradlePluginPortal() + mavenLocal() } val kotlinVersion: String = libs.versions.kotlin.get() @@ -44,5 +45,8 @@ dependencies { implementation(libs.bundles.gradle.common) } - - +//tasks.withType { +// kotlinOptions { +// languageVersion = "2.0" +// } +//} diff --git a/buildSrc/src/main/kotlin/K2Config.kt b/buildSrc/src/main/kotlin/K2Config.kt new file mode 100644 index 00000000..31661a38 --- /dev/null +++ b/buildSrc/src/main/kotlin/K2Config.kt @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2024. ForteScarlet. + * + * This file is part of simbot-component-qq-guild. + * + * simbot-component-qq-guild is free software: you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + * + * simbot-component-qq-guild is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with simbot-component-qq-guild. + * If not, see . + */ + +import org.gradle.api.Project +import org.gradle.kotlin.dsl.withType + + +fun Project.useK2(languageVersion: String = "2.0") { + tasks.withType { + kotlinOptions { + // useK2 + this.languageVersion = languageVersion + } + } +} diff --git a/buildSrc/src/main/kotlin/P.kt b/buildSrc/src/main/kotlin/P.kt index efdce511..d98a5e74 100644 --- a/buildSrc/src/main/kotlin/P.kt +++ b/buildSrc/src/main/kotlin/P.kt @@ -59,7 +59,7 @@ object P { override val homepage: String get() = HOMEPAGE - private val baseVersion = v(4, 0, 0) - v("dev6") + private val baseVersion = v(4, 0, 0) - v("dev7") val snapshotVersion = baseVersion - Version.SNAPSHOT override val version = if (isSnapshot()) snapshotVersion else baseVersion diff --git a/buildSrc/src/main/kotlin/simbot-tcg-suspend-transform-configure.gradle.kts b/buildSrc/src/main/kotlin/simbot-tcg-suspend-transform-configure.gradle.kts index ea7af7fe..f7ba0e0f 100644 --- a/buildSrc/src/main/kotlin/simbot-tcg-suspend-transform-configure.gradle.kts +++ b/buildSrc/src/main/kotlin/simbot-tcg-suspend-transform-configure.gradle.kts @@ -63,3 +63,5 @@ suspendTransform { // SuspendTransforms.suspendTransTransformerForJsPromise, // ) } + + diff --git a/builder-generator/build.gradle.kts b/builder-generator/build.gradle.kts deleted file mode 100644 index 6bb17202..00000000 --- a/builder-generator/build.gradle.kts +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2023. ForteScarlet. - * - * This file is part of simbot-component-tencent-guild. - * - * simbot-component-tencent-guild is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * - * simbot-component-tencent-guild is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License along with simbot-component-tencent-guild. If not, see . - */ - -plugins { - kotlin("jvm") -} - -repositories { - mavenCentral() -} - -//buildscript { -// dependencies { -// classpath(kotlin("gradle-plugin")) -// } -//} - -dependencies { - api("com.google.devtools.ksp:symbol-processing-api:1.8.10-1.0.9") - api("com.squareup:kotlinpoet:1.12.0") - api("com.squareup:kotlinpoet-ksp:1.12.0") - -} - -tasks.withType().configureEach { - kotlinOptions { - javaParameters = true - jvmTarget = "1.8" - freeCompilerArgs = freeCompilerArgs + listOf("-Xjvm-default=all") - } -} - -tasks.withType { - sourceCompatibility = "1.8" - targetCompatibility = "1.8" - options.encoding = "UTF-8" -} diff --git a/builder-generator/src/main/kotlin/bgenor/BuilderGeneratorSymbolProcessor.kt b/builder-generator/src/main/kotlin/bgenor/BuilderGeneratorSymbolProcessor.kt deleted file mode 100644 index c7e3c2c5..00000000 --- a/builder-generator/src/main/kotlin/bgenor/BuilderGeneratorSymbolProcessor.kt +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright (c) 2023. ForteScarlet. - * - * This file is part of simbot-component-tencent-guild. - * - * simbot-component-tencent-guild is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * - * simbot-component-tencent-guild is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License along with simbot-component-tencent-guild. If not, see . - */ - -package bgenor - -import com.google.devtools.ksp.isPublic -import com.google.devtools.ksp.processing.Resolver -import com.google.devtools.ksp.processing.SymbolProcessor -import com.google.devtools.ksp.processing.SymbolProcessorEnvironment -import com.google.devtools.ksp.symbol.* -import com.squareup.kotlinpoet.* -import com.squareup.kotlinpoet.ksp.toClassName -import com.squareup.kotlinpoet.ksp.toTypeName -import com.squareup.kotlinpoet.ksp.writeTo - - -/** - * - * @author ForteScarlet - */ -class BuilderGeneratorSymbolProcessor(private val environment: SymbolProcessorEnvironment) : SymbolProcessor { - private val logger get() = environment.logger - override fun process(resolver: Resolver): List { - val classes = resolver.getSymbolsWithAnnotation("bgenor.GenerateBuilder", false) - .filterIsInstance() - .toSet() - - logger.info("annotated @bgenor.GenerateBuilder classes: ${classes.joinToString { it.simpleName.asString() }}") - - val codeGenerator = BgenorCodeGenerator(environment) - - classes.forEach { ksClass -> - val context = BgenorContext() - - ksClass.primaryConstructor?.also { context.resolvePrimaryConstructor(it) } - - ksClass.getAllProperties().forEach { - context.resolveProperty(it) - } - - codeGenerator.generate(resolver, ksClass, context) - } - - return emptyList() - } - - -} - -internal class BgenorContext { - internal val constructorParams = mutableListOf() - internal val properties = mutableListOf() - - - fun resolvePrimaryConstructor(func: KSFunctionDeclaration) { - for (parameter in func.parameters) { - constructorParams.add(Param(parameter)) - } - } - - fun resolveProperty(property: KSPropertyDeclaration) { - if (!property.isMutable) { - return - } - - if (!property.isPublic()) { - return - } - - properties.add(Property(property)) - } - - internal data class Property(val property: KSPropertyDeclaration) - internal data class Param(val property: KSValueParameter) - -} - - -private class BgenorCodeGenerator( - private val environment: SymbolProcessorEnvironment, -) { - fun generate( - resolver: Resolver, - target: KSClassDeclaration, - context: BgenorContext - ) { - val targetClassName = target.simpleName.asString() + "Builder" - - val fileSpecBuilder = FileSpec.builder( - target.packageName.asString(), - "${target.simpleName.asString()}$\$Builder" - ) - - - val constructorProperties = context.constructorParams.map { param -> - val p = param.property - - - val modifiers: Array - val initNull: Boolean - if (p.hasDefault) { - modifiers = arrayOf(KModifier.PUBLIC) - initNull = true - } else { - modifiers = arrayOf(KModifier.PUBLIC, KModifier.LATEINIT) - initNull = false - } - - - - PropertySpec.builder( - p.name!!.asString(), - p.type.toTypeName().copy(nullable = initNull), *modifiers - ).apply { -// this.addKdoc() // TODO - mutable() - if (initNull) { - initializer("null") - } - }.build() - } - - - val builderClass = TypeSpec.classBuilder("${target.simpleName.asString()}Builder").apply { - addProperties(constructorProperties) - addFunction(FunSpec.builder("build").apply { - returns(target.toClassName()) - - propertySpecs.forEach { p -> - addCode( - """ - val ${p.name} = this.${p.name} - - """.trimIndent() - ) - } - - addCode( - """ - return TODO() - """.trimIndent() - ) - }.build()) - }.build() - - - fileSpecBuilder.addType(builderClass).build().writeTo(environment.codeGenerator, false) - } - -} - - - - - - - diff --git a/builder-generator/src/main/kotlin/bgenor/BuilderGeneratorSymbolProcessorProvider.kt b/builder-generator/src/main/kotlin/bgenor/BuilderGeneratorSymbolProcessorProvider.kt deleted file mode 100644 index 7fd8b14d..00000000 --- a/builder-generator/src/main/kotlin/bgenor/BuilderGeneratorSymbolProcessorProvider.kt +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2023. ForteScarlet. - * - * This file is part of simbot-component-tencent-guild. - * - * simbot-component-tencent-guild is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * - * simbot-component-tencent-guild is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License along with simbot-component-tencent-guild. If not, see . - */ - -package bgenor - -import com.google.devtools.ksp.processing.SymbolProcessor -import com.google.devtools.ksp.processing.SymbolProcessorEnvironment -import com.google.devtools.ksp.processing.SymbolProcessorProvider - - -/** - * - * @author ForteScarlet - */ -class BuilderGeneratorSymbolProcessorProvider : SymbolProcessorProvider { - override fun create(environment: SymbolProcessorEnvironment): SymbolProcessor { - return BuilderGeneratorSymbolProcessor(environment) - } -} - - - diff --git a/builder-generator/src/main/kotlin/bgenor/annotations.kt b/builder-generator/src/main/kotlin/bgenor/annotations.kt deleted file mode 100644 index 9d4a2d06..00000000 --- a/builder-generator/src/main/kotlin/bgenor/annotations.kt +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (c) 2023. ForteScarlet. - * - * This file is part of simbot-component-tencent-guild. - * - * simbot-component-tencent-guild is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * - * simbot-component-tencent-guild is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License along with simbot-component-tencent-guild. If not, see . - */ - -package bgenor - - -@Target(AnnotationTarget.CLASS) -@Retention(AnnotationRetention.BINARY) -annotation class GenerateBuilder() diff --git a/builder-generator/src/main/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider b/builder-generator/src/main/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider deleted file mode 100644 index f8e4f014..00000000 --- a/builder-generator/src/main/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider +++ /dev/null @@ -1,13 +0,0 @@ -# -# Copyright (c) 2023. ForteScarlet. -# -# This file is part of simbot-component-tencent-guild. -# -# simbot-component-tencent-guild is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. -# -# simbot-component-tencent-guild is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License along with simbot-component-tencent-guild. If not, see . -# - -bgenor.BuilderGeneratorSymbolProcessorProvider diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a67c2234..06f5f592 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,5 @@ [versions] -kotlin = "1.9.21" +kotlin = "1.9.22" kotlinx-coroutines = "1.7.3" kotlinx-serialization = "1.6.2" kotlinx-datetime = "0.5.0" @@ -10,8 +10,8 @@ openjdk-jmh = "1.35" log4j = "2.20.0" reactor = "3.6.2" # simbot -simbot = "4.0.0-dev14" -suspendTransform = "0.6.0" +simbot = "4.0.0-dev15" +suspendTransform = "0.7.0-beta1" gradleCommon = "0.2.0" [libraries] @@ -27,7 +27,7 @@ simbot-common-core = { group = "love.forte.simbot.common", name = "simbot-common simbot-common-suspend = { group = "love.forte.simbot.common", name = "simbot-common-suspend-runner", version.ref = "simbot" } simbot-common-annotations = { group = "love.forte.simbot.common", name = "simbot-common-annotations", version.ref = "simbot" } simbot-common-loop = { group = "love.forte.simbot.common", name = "simbot-common-stage-loop", version.ref = "simbot" } -simbot-gradle = { group = "love.forte.simbot.gradle", name = "simbot-gradle-suspendtransforms", version.ref = "simbot" } +simbot-gradle = { group = "love.forte.simbot.gradle", name = "simbot-gradle-suspendtransforms", version = "4.0.0-dev15" } # jetbrains-annotation jetbrains-annotations = "org.jetbrains:annotations:24.0.1" diff --git a/simbot-component-qq-guild-api/build.gradle.kts b/simbot-component-qq-guild-api/build.gradle.kts index 75e30b72..5330410f 100644 --- a/simbot-component-qq-guild-api/build.gradle.kts +++ b/simbot-component-qq-guild-api/build.gradle.kts @@ -29,6 +29,7 @@ plugins { setup(P.ComponentQQGuild) +useK2() configJavaCompileWithModule("simbot.component.qqguild.api") //apply(plugin = "qq-guild-dokka-partial-configure") apply(plugin = "qq-guild-multiplatform-maven-publish") diff --git a/simbot-component-qq-guild-core/build.gradle.kts b/simbot-component-qq-guild-core/build.gradle.kts index 48c8eb04..eb4c1bac 100644 --- a/simbot-component-qq-guild-core/build.gradle.kts +++ b/simbot-component-qq-guild-core/build.gradle.kts @@ -29,6 +29,7 @@ plugins { setup(P.ComponentQQGuild) +useK2() configJavaCompileWithModule("simbot.component.qqguild.core") apply(plugin = "qq-guild-multiplatform-maven-publish") @@ -69,6 +70,7 @@ kotlin { commonTest.dependencies { implementation(kotlin("test")) + implementation(kotlin("reflect")) implementation(libs.kotlinx.coroutines.test) implementation(libs.kotlinx.serialization.json) api(libs.simbot.core) diff --git a/simbot-component-qq-guild-stdlib/build.gradle.kts b/simbot-component-qq-guild-stdlib/build.gradle.kts index e0aae6c6..72f2e372 100644 --- a/simbot-component-qq-guild-stdlib/build.gradle.kts +++ b/simbot-component-qq-guild-stdlib/build.gradle.kts @@ -29,6 +29,7 @@ plugins { setup(P.ComponentQQGuild) +useK2() configJavaCompileWithModule("simbot.component.qqguild.stdlib") apply(plugin = "qq-guild-multiplatform-maven-publish")