From 44a0979aec0472cedbf96af04b4c83e5a908202d Mon Sep 17 00:00:00 2001 From: ForteScarlet Date: Tue, 6 Aug 2024 18:09:32 +0800 Subject: [PATCH] build(deps): Update simbot from 4.0.0 to 4.5.0 --- buildSrc/src/main/kotlin/P.kt | 10 +- .../kotlin/changelog/GenerateChangelog.kt | 2 +- .../kook-dokka-partial-configure.gradle.kts | 5 +- ...ook-multiplatform-maven-publish.gradle.kts | 76 +++++++----- ...simbot-kook-changelog-generator.gradle.kts | 50 ++------ .../simbot-kook-maven-publish.gradle.kts | 115 ------------------ .../simbot-kook-module-conventions.gradle.kts | 10 +- .../simbot-kook-nexus-publish.gradle.kts | 38 +++--- .../simbot-kook-suspend-transform.gradle.kts | 46 +++---- gradle/libs.versions.toml | 4 +- 10 files changed, 110 insertions(+), 246 deletions(-) delete mode 100644 buildSrc/src/main/kotlin/simbot-kook-maven-publish.gradle.kts diff --git a/buildSrc/src/main/kotlin/P.kt b/buildSrc/src/main/kotlin/P.kt index 4e876f8b..3eda9e1e 100644 --- a/buildSrc/src/main/kotlin/P.kt +++ b/buildSrc/src/main/kotlin/P.kt @@ -21,10 +21,7 @@ @file:Suppress("MemberVisibilityCanBePrivate", "unused") import love.forte.gradle.common.core.project.ProjectDetail -import love.forte.gradle.common.core.project.Version -import love.forte.gradle.common.core.project.minus import love.forte.gradle.common.core.property.systemProp -import love.forte.gradle.common.core.project.version as v /* * Copyright (c) 2022-2022 ForteScarlet @@ -52,10 +49,11 @@ object P : ProjectDetail() { override val homepage: String get() = HOMEPAGE - private val baseVersion = v(4, 0, 0) + const val VERSION = "4.0.0-beta5" + const val NEXT_VERSION = "4.0.0-beta6" - val snapshotVersion = baseVersion - Version.SNAPSHOT - override val version = if (isSnapshot()) snapshotVersion else baseVersion + override val snapshotVersion = "$NEXT_VERSION-SNAPSHOT" + override val version = if (isSnapshot()) snapshotVersion else VERSION override val group: String get() = GROUP override val description: String get() = DESCRIPTION diff --git a/buildSrc/src/main/kotlin/changelog/GenerateChangelog.kt b/buildSrc/src/main/kotlin/changelog/GenerateChangelog.kt index 02f95b4d..e7bb7dc4 100644 --- a/buildSrc/src/main/kotlin/changelog/GenerateChangelog.kt +++ b/buildSrc/src/main/kotlin/changelog/GenerateChangelog.kt @@ -33,7 +33,7 @@ import java.util.* data class CommitLog(val message: String, val hash: MutableList, val pre: String?) fun Project.generateChangelog(tag: String) { - println("Generate change log for $tag ...") + logger.lifecycle("Generate change log for {} ...", tag) // configurations.runtimeClasspath val changelogDir = rootProject.file(".changelog").also { it.mkdirs() diff --git a/buildSrc/src/main/kotlin/kook-dokka-partial-configure.gradle.kts b/buildSrc/src/main/kotlin/kook-dokka-partial-configure.gradle.kts index 9d1c2669..71118d2e 100644 --- a/buildSrc/src/main/kotlin/kook-dokka-partial-configure.gradle.kts +++ b/buildSrc/src/main/kotlin/kook-dokka-partial-configure.gradle.kts @@ -48,7 +48,7 @@ tasks.withType().configureEach { } dokkaSourceSets.configureEach { - version = P.version.toString() + version = P.version documentedVisibilities.set( listOf( DokkaConfiguration.Visibility.PUBLIC, @@ -83,6 +83,9 @@ tasks.withType().configureEach { sourceLink { localDirectory.set(projectDir.resolve("src")) val relativeTo = projectDir.relativeTo(rootProject.projectDir) + .path + .replace('\\', '/') + remoteUrl.set(URI.create("${P.HOMEPAGE}/tree/main/$relativeTo/src/").toURL()) remoteLineSuffix.set("#L") } diff --git a/buildSrc/src/main/kotlin/kook-multiplatform-maven-publish.gradle.kts b/buildSrc/src/main/kotlin/kook-multiplatform-maven-publish.gradle.kts index 6eb3acc0..adcb126f 100644 --- a/buildSrc/src/main/kotlin/kook-multiplatform-maven-publish.gradle.kts +++ b/buildSrc/src/main/kotlin/kook-multiplatform-maven-publish.gradle.kts @@ -1,24 +1,29 @@ /* - * Copyright (c) 2023. ForteScarlet. + * Copyright (c) 2023-2024. ForteScarlet. * - * This file is part of simbot-component-kook. + * This file is part of simbot-component-kook. * - * simbot-component-kook 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-kook 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-kook 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. + * simbot-component-kook 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-kook, - * If not, see . + * You should have received a copy of the GNU Lesser General Public License + * along with simbot-component-kook, + * If not, see . */ import love.forte.gradle.common.core.Gpg import love.forte.gradle.common.core.project.setup import love.forte.gradle.common.core.property.systemProp -import love.forte.gradle.common.publication.configure.multiplatformConfigPublishing +import love.forte.gradle.common.publication.configure.configPublishMaven +import love.forte.gradle.common.publication.configure.publishingExtension +import love.forte.gradle.common.publication.configure.setupPom plugins { kotlin("multiplatform") @@ -30,30 +35,43 @@ plugins { setup(P) val p = project -multiplatformConfigPublishing { - project = P - isSnapshot = project.version.toString().contains("SNAPSHOT", true) - - val jarJavadoc by tasks.registering(Jar::class) { - group = "documentation" - archiveClassifier.set("javadoc") - if (!(isSnapshot || isSnapshot() || isSimbotLocal())) { - archiveClassifier.set("javadoc") - from(tasks.findByName("dokkaHtml")) +val isSnapshot = project.version.toString().contains("SNAPSHOT", true) + +val jarJavadoc by tasks.registering(Jar::class) { + group = "documentation" + archiveClassifier.set("javadoc") + if (!(isSnapshot || isSnapshot() || isSimbotLocal())) { + dependsOn(tasks.dokkaHtml) + from(tasks.dokkaHtml.flatMap { it.outputDirectory }) + } +} + +publishing { + repositories { + mavenLocal() + if (isSnapshot) { + configPublishMaven(SnapshotRepository) + } else { + configPublishMaven(ReleaseRepository) } } - artifact(jarJavadoc) - releasesRepository = ReleaseRepository - snapshotRepository = SnapshotRepository - gpg = Gpg.ofSystemPropOrNull() + publications { + withType { + artifacts { + artifact(jarJavadoc) + } - if (isSimbotLocal()) { - mainHost = null + setupPom(project.name, P) + } } +} - publicationsFromMainHost += listOf("wasm", "wasm32", "wasm_js") - mainHostSupportedTargets += listOf("wasm", "wasm32", "wasm_js") +signing { + val gpg = Gpg.ofSystemPropOrNull() ?: return@signing + val (keyId, secretKey, password) = gpg + useInMemoryPgpKeys(keyId, secretKey, password) + sign(publishingExtension.publications) } // TODO see https://github.com/gradle-nexus/publish-plugin/issues/208#issuecomment-1465029831 diff --git a/buildSrc/src/main/kotlin/simbot-kook-changelog-generator.gradle.kts b/buildSrc/src/main/kotlin/simbot-kook-changelog-generator.gradle.kts index dacc7c03..e7745e6f 100644 --- a/buildSrc/src/main/kotlin/simbot-kook-changelog-generator.gradle.kts +++ b/buildSrc/src/main/kotlin/simbot-kook-changelog-generator.gradle.kts @@ -1,18 +1,21 @@ /* - * Copyright (c) 2022-2023. ForteScarlet. + * Copyright (c) 2022-2024. ForteScarlet. * - * This file is part of simbot-component-kook. + * This file is part of simbot-component-kook. * - * simbot-component-kook 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-kook 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-kook 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. + * simbot-component-kook 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-kook, - * If not, see . + * You should have received a copy of the GNU Lesser General Public License + * along with simbot-component-kook, + * If not, see . */ import changelog.generateChangelog @@ -52,30 +55,3 @@ tasks.create("createChangelog") { } } -tasks.create("updateWebsiteVersionJson") { - group = "documentation" - doFirst { - val version = P.version.toString() - - val websiteVersionJsonDir = rootProject.file("website/static") - if (!websiteVersionJsonDir.exists()) { - websiteVersionJsonDir.mkdirs() - } - val websiteVersionJsonFile = File(websiteVersionJsonDir, "version.json") - if (!websiteVersionJsonFile.exists()) { - websiteVersionJsonFile.createNewFile() - } - - websiteVersionJsonFile.writeText( - """ - { - "version": "$version" - } - """.trimIndent() - ) - } -} - -//fun repoRow(moduleName: String, group: String, id: String, version: String): String { -// return "| $moduleName | [$moduleName: v$version](https://repo1.maven.org/maven2/${group.replace(".", "/")}/${id.replace(".", "/")}/$version) | [$moduleName: v$version](https://search.maven.org/artifact/$group/$id/$version/jar) |" -//} diff --git a/buildSrc/src/main/kotlin/simbot-kook-maven-publish.gradle.kts b/buildSrc/src/main/kotlin/simbot-kook-maven-publish.gradle.kts deleted file mode 100644 index 2719882e..00000000 --- a/buildSrc/src/main/kotlin/simbot-kook-maven-publish.gradle.kts +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2022-2023. ForteScarlet. - * - * This file is part of simbot-component-kook. - * - * simbot-component-kook 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-kook 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-kook, - * If not, see . - */ - -import love.forte.gradle.common.core.Gpg -import love.forte.gradle.common.publication.configure.jvmConfigPublishing -import util.checkPublishConfigurable -import util.isCi -import util.isLinux - -/* - * Copyright (c) 2022 ForteScarlet - * - * 本文件是 simbot-component-kaiheila 的一部分。 - * - * simbot-component-kaiheila 是自由软件:你可以再分发之和/或依照由自由软件基金会发布的 GNU 通用公共许可证修改之,无论是版本 3 许可证,还是(按你的决定)任何以后版都可以。 - * - * 发布 simbot-component-kaiheila 是希望它能有用,但是并无保障;甚至连可销售和符合某个特定的目的都不保证。请参看 GNU 通用公共许可证,了解详情。 - * - * 你应该随程序获得一份 GNU 通用公共许可证的复本。如果没有,请看: - * https://www.gnu.org/licenses - * https://www.gnu.org/licenses/gpl-3.0-standalone.html - * https://www.gnu.org/licenses/lgpl-3.0-standalone.html - * - * - */ - -plugins { - id("signing") - id("maven-publish") -} - -val (isSnapshotOnly, isReleaseOnly, isPublishConfigurable) = checkPublishConfigurable() - - -logger.info("isSnapshotOnly: {}", isSnapshotOnly) -logger.info("isReleaseOnly: {}", isReleaseOnly) -logger.info("isPublishConfigurable: {}", isPublishConfigurable) - -if (!isCi || isLinux) { - checkPublishConfigurable { - jvmConfigPublishing { - project = P - publicationName = "kookDist" - isSnapshot = isSnapshot().also { - logger.info("jvmConfigPublishing.isSnapshot: {}", it) - } - val jarSources by tasks.registering(Jar::class) { - archiveClassifier.set("sources") - from(sourceSets["main"].allSource) - } - - val jarJavadoc by tasks.registering(Jar::class) { - if (!(isSnapshot || isSnapshot())) { - dependsOn(tasks.dokkaHtml) - from(tasks.dokkaHtml.flatMap { it.outputDirectory }) - } - archiveClassifier.set("javadoc") - } - - artifact(jarSources) - artifact(jarJavadoc) - - releasesRepository = ReleaseRepository - snapshotRepository = SnapshotRepository - gpg = if (isSnapshot()) null else Gpg.ofSystemPropOrNull() - } - - publishing { - publications.withType { - show() - } - } - - - } -} - -// TODO see https://github.com/gradle-nexus/publish-plugin/issues/208#issuecomment-1465029831 -val signingTasks: TaskCollection = tasks.withType() -tasks.withType().configureEach { - mustRunAfter(signingTasks) -} - -fun MavenPublication.show() { - //// show project info - println("========================================================") - println("== MavenPublication for ${project.name}") - println("== maven.pub.group: $group") - println("== maven.pub.name: $name") - println("== project.version: ${project.version}") - println("== maven.pub.version: $version") - println("== maven.pub.description: $description") - println("========================================================") -} - - -inline val Project.sourceSets: SourceSetContainer - get() = extensions.getByName("sourceSets") as SourceSetContainer - -internal val TaskContainer.dokkaHtml: TaskProvider - get() = named("dokkaHtml") diff --git a/buildSrc/src/main/kotlin/simbot-kook-module-conventions.gradle.kts b/buildSrc/src/main/kotlin/simbot-kook-module-conventions.gradle.kts index 89592872..22fe81e5 100644 --- a/buildSrc/src/main/kotlin/simbot-kook-module-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/simbot-kook-module-conventions.gradle.kts @@ -49,7 +49,7 @@ plugins { setup(P) if (isSnapshot()) { - version = P.snapshotVersion.toString() + version = P.snapshotVersion } repositories { @@ -95,14 +95,6 @@ configurations.all { resolutionStrategy.cacheChangingModulesFor(0, "seconds") } - -//// show project info -logger.info("========================================================") -logger.info("== project.group: ${group}") -logger.info("== project.name: ${name}") -logger.info("== project.version: ${version}") -logger.info("========================================================") - idea { module { isDownloadSources = true diff --git a/buildSrc/src/main/kotlin/simbot-kook-nexus-publish.gradle.kts b/buildSrc/src/main/kotlin/simbot-kook-nexus-publish.gradle.kts index 86034901..7a4e6d44 100644 --- a/buildSrc/src/main/kotlin/simbot-kook-nexus-publish.gradle.kts +++ b/buildSrc/src/main/kotlin/simbot-kook-nexus-publish.gradle.kts @@ -1,23 +1,26 @@ /* - * Copyright (c) 2022-2023. ForteScarlet. + * Copyright (c) 2022-2024. ForteScarlet. * - * This file is part of simbot-component-kook. + * This file is part of simbot-component-kook. * - * simbot-component-kook 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-kook 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-kook 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. + * simbot-component-kook 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-kook, - * If not, see . + * You should have received a copy of the GNU Lesser General Public License + * along with simbot-component-kook, + * If not, see . */ import love.forte.gradle.common.core.project.setup import love.forte.gradle.common.core.repository.Repositories -import love.forte.gradle.common.publication.configure.nexusPublishConfig +import java.time.Duration /* * Copyright (c) 2022 ForteScarlet @@ -48,17 +51,22 @@ if (userInfo == null) { logger.warn("sonatype.username or sonatype.password is null, cannot config nexus publishing.") } -nexusPublishConfig { - projectDetail = P +nexusPublishing { + packageGroup.set(P.GROUP) useStaging = project.provider { !project.version.toString().endsWith("SNAPSHOT", ignoreCase = true) } - repositoriesConfig = { + + transitionCheckOptions { + maxRetries = 114514 + delayBetween = Duration.ofSeconds(2) + } + + repositories { sonatype { snapshotRepositoryUrl.set(uri(Repositories.Snapshot.URL)) username.set(userInfo?.username) password.set(userInfo?.password) } } - } diff --git a/buildSrc/src/main/kotlin/simbot-kook-suspend-transform.gradle.kts b/buildSrc/src/main/kotlin/simbot-kook-suspend-transform.gradle.kts index 5a7f265c..fefd987e 100644 --- a/buildSrc/src/main/kotlin/simbot-kook-suspend-transform.gradle.kts +++ b/buildSrc/src/main/kotlin/simbot-kook-suspend-transform.gradle.kts @@ -1,20 +1,23 @@ /* - * Copyright (c) 2023. ForteScarlet. + * Copyright (c) 2023-2024. ForteScarlet. * - * This file is part of simbot-component-kook. + * This file is part of simbot-component-kook. * - * simbot-component-kook 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-kook 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-kook 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. + * simbot-component-kook 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-kook, - * If not, see . + * You should have received a copy of the GNU Lesser General Public License + * along with simbot-component-kook, + * If not, see . */ -import love.forte.simbot.gradle.suspendtransforms.SuspendTransforms +import love.forte.simbot.gradle.suspendtransforms.addSimbotJvmTransformers plugins { id("love.forte.plugin.suspend-transform") @@ -24,25 +27,6 @@ suspendTransform { includeRuntime = false includeAnnotation = false - addJvmTransformers( - // @JvmBlocking - SuspendTransforms.jvmBlockingTransformer, - // @JvmAsync - SuspendTransforms.jvmAsyncTransformer, - - // @ST - SuspendTransforms.suspendTransTransformerForJvmBlocking, - SuspendTransforms.suspendTransTransformerForJvmAsync, - SuspendTransforms.suspendTransTransformerForJvmReserve, - - // @STP - SuspendTransforms.jvmSuspendTransPropTransformerForBlocking, - SuspendTransforms.jvmSuspendTransPropTransformerForAsync, - SuspendTransforms.jvmSuspendTransPropTransformerForReserve, - ) - - // addJsTransformers( - // SuspendTransforms.suspendTransTransformerForJsPromise, - // ) + addSimbotJvmTransformers() } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c31b60e4..390ffab1 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -7,9 +7,9 @@ openjdk-jmh = "1.37" ktor = "2.3.12" log4j = "2.23.0" # simbot -simbot = "4.0.0" +simbot = "4.5.0" suspendTransform = "0.9.0" -gradleCommon = "0.4.0" +gradleCommon = "0.6.0" # ksp ksp = "2.0.0-1.0.24" # https://square.github.io/kotlinpoet/