diff --git a/README.md b/README.md index 82203cb35..79859f2f4 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,6 @@ Mirai 是一个在全平台下运行,提供 QQ 协议支持的高效率机器 高效率 QQ 机器人框架,机器人核心来自 [mirai](https://github.com/mamoe/mirai) ![Gradle CI](https://github.com/mamoe/mirai-console/workflows/Gradle%20CI/badge.svg?branch=master) -[![Download](https://api.bintray.com/packages/him188moe/mirai/mirai-console/images/download.svg)](https://bintray.com/him188moe/mirai/mirai-console/) [![Gitter](https://badges.gitter.im/mamoe/mirai.svg)](https://gitter.im/mamoe/mirai?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) ## 使用 diff --git a/backend/mirai-console/build.gradle.kts b/backend/mirai-console/build.gradle.kts index 188201994..3db66cf0f 100644 --- a/backend/mirai-console/build.gradle.kts +++ b/backend/mirai-console/build.gradle.kts @@ -17,7 +17,6 @@ plugins { kotlin("plugin.serialization") id("java") `maven-publish` - id("com.jfrog.bintray") id("net.mamoe.kotlin-jvm-blocking-bridge") } diff --git a/build.gradle.kts b/build.gradle.kts index 354f341b7..1a178eec4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -16,7 +16,6 @@ import org.jetbrains.kotlin.utils.addToStdlib.safeAs plugins { kotlin("jvm") version Versions.kotlinCompiler kotlin("plugin.serialization") version Versions.kotlinCompiler - id("com.jfrog.bintray") version Versions.bintray apply false id("net.mamoe.kotlin-jvm-blocking-bridge") version Versions.blockingBridge apply false id("com.gradle.plugin-publish") version "0.12.0" apply false //id("com.bmuschko.nexus") version "2.3.1" apply false @@ -32,7 +31,6 @@ allprojects { repositories { mavenLocal() - maven(url = "https://dl.bintray.com/kotlin/kotlin-eap") jcenter() mavenCentral() } diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 443597f65..43642e0d2 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -1,3 +1,12 @@ +/* + * Copyright 2019-2021 Mamoe Technologies and contributors. + * + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + plugins { `kotlin-dsl` } @@ -5,7 +14,6 @@ plugins { repositories { mavenLocal() jcenter() - maven(url = "https://dl.bintray.com/kotlin/kotlin-eap") mavenCentral() } @@ -31,6 +39,5 @@ dependencies { compileOnly(gradleApi()) compileOnly("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.0") - compileOnly("com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.5") api("com.github.jengelman.gradle.plugins:shadow:6.0.0") } \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/PublishingHelpers.kt b/buildSrc/src/main/kotlin/PublishingHelpers.kt index 58a3a00ed..046ba9d52 100644 --- a/buildSrc/src/main/kotlin/PublishingHelpers.kt +++ b/buildSrc/src/main/kotlin/PublishingHelpers.kt @@ -28,13 +28,6 @@ import kotlin.reflect.KProperty * https://github.com/mamoe/mirai/blob/master/LICENSE */ -/** - * Configures the [bintray][com.jfrog.bintray.gradle.BintrayExtension] extension. - */ -@PublishedApi -internal fun Project.`bintray`(configure: com.jfrog.bintray.gradle.BintrayExtension.() -> Unit): Unit = - (this as org.gradle.api.plugins.ExtensionAware).extensions.configure("bintray", configure) - @PublishedApi internal operator fun RegisteringDomainObjectDelegateProviderWithTypeAndAction.provideDelegate( receiver: Any?, @@ -62,78 +55,7 @@ internal fun Project.`publishing`(configure: org.gradle.api.publish.PublishingEx inline fun Project.configurePublishing( artifactId: String, - bintrayRepo: String = "mirai", - bintrayPkgName: String = artifactId, vcs: String = "https://github.com/mamoe/mirai-console" ) { - - tasks.register("ensureBintrayAvailable") { - doLast { - if (!Bintray.isBintrayAvailable(project)) { - error("bintray isn't available. ") - } - } - } - - if (Bintray.isBintrayAvailable(project)) { - bintray { - val keyProps = Properties() - val keyFile = file("../keys.properties") - if (keyFile.exists()) keyFile.inputStream().use { keyProps.load(it) } - if (keyFile.exists()) keyFile.inputStream().use { keyProps.load(it) } - - user = Bintray.getUser(project) - key = Bintray.getKey(project) - - publish = true - override = true - - setPublications("mavenJava") - setConfigurations("archives") - - pkg.apply { - repo = bintrayRepo - name = bintrayPkgName - setLicenses("AGPLv3") - publicDownloadNumbers = true - vcsUrl = vcs - } - } - - @Suppress("DEPRECATION") - val sourcesJar by tasks.registering(Jar::class) { - classifier = "sources" - from(sourceSets["main"].allSource) - } - - publishing { - /* - repositories { - maven { - // change to point to your repo, e.g. http://my.org/repo - url = uri("$buildDir/repo") - } - }*/ - publications { - register("mavenJava", MavenPublication::class) { - from(components["java"]) - - groupId = rootProject.group.toString() - this.artifactId = artifactId - version = version - - pom.withXml { - val root = asNode() - root.appendNode("description", description) - root.appendNode("name", project.name) - root.appendNode("url", vcs) - root.children().last() - } - - artifact(sourcesJar.get()) - } - } - } - } else println("bintray isn't available. NO PUBLICATIONS WILL BE SET") - +// stub } \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index bf4e59b3a..8bdcddd16 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -31,8 +31,6 @@ object Versions { const val androidGradle = "3.6.2" - const val bintray = "1.8.5" - const val blockingBridge = "1.6.0" const val junit = "5.4.2" diff --git a/buildSrc/src/main/kotlin/upload/Bintray.kt b/buildSrc/src/main/kotlin/upload/Bintray.kt deleted file mode 100644 index 9c77d8180..000000000 --- a/buildSrc/src/main/kotlin/upload/Bintray.kt +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright 2019-2020 Mamoe Technologies and contributors. - * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found through the following link. - * - * https://github.com/mamoe/mirai/blob/master/LICENSE - */ - -@file:Suppress("DuplicatedCode") - -package upload - -import org.gradle.api.Project -import org.gradle.kotlin.dsl.provideDelegate -import java.io.File - -object Bintray { - - @JvmStatic - fun isBintrayAvailable(project: Project): Boolean { - return kotlin.runCatching { - getUser(project) - getKey(project) - }.isSuccess - } - - @JvmStatic - fun getUser(project: Project): String { - kotlin.runCatching { - @Suppress("UNUSED_VARIABLE", "LocalVariableName") - val bintray_user: String by project - return bintray_user - } - - kotlin.runCatching { - @Suppress("UNUSED_VARIABLE", "LocalVariableName") - val bintray_user: String by project.rootProject - return bintray_user - } - - System.getProperty("bintray_user", null)?.let { - return it.trim() - } - - File(File(System.getProperty("user.dir")).parent, "/bintray.user.txt").let { local -> - if (local.exists()) { - return local.readText().trim() - } - } - - File(File(System.getProperty("user.dir")), "/bintray.user.txt").let { local -> - if (local.exists()) { - return local.readText().trim() - } - } - - project.file("bintray.user.txt").let { local -> - if (local.exists()) { - return local.readText().trim() - } - } - - project.rootProject.file("bintray.user.txt").let { local -> - if (local.exists()) { - return local.readText().trim() - } - } - - error( - "Cannot find bintray user, " + - "please specify by creating a file bintray.user.txt in project dir, " + - "or by providing JVM parameter 'bintray_user'" - ) - } - - @JvmStatic - fun getKey(project: Project): String { - kotlin.runCatching { - @Suppress("UNUSED_VARIABLE", "LocalVariableName") - val bintray_key: String by project - return bintray_key - } - - kotlin.runCatching { - @Suppress("UNUSED_VARIABLE", "LocalVariableName") - val bintray_key: String by project.rootProject - return bintray_key - } - - System.getProperty("bintray_key", null)?.let { - return it.trim() - } - - File(File(System.getProperty("user.dir")).parent, "/bintray.key.txt").let { local -> - if (local.exists()) { - return local.readText().trim() - } - } - - File(File(System.getProperty("user.dir")), "/bintray.key.txt").let { local -> - if (local.exists()) { - return local.readText().trim() - } - } - - project.file("bintray.key.txt").let { local -> - if (local.exists()) { - return local.readText().trim() - } - } - - project.rootProject.file("bintray.key.txt").let { local -> - if (local.exists()) { - return local.readText().trim() - } - } - - - error( - "Cannot find bintray key, " + - "please specify by creating a file bintray.key.txt in project dir, " + - "or by providing JVM parameter 'bintray_key'" - ) - } - -} \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/upload/CuiCloud.kt b/buildSrc/src/main/kotlin/upload/CuiCloud.kt deleted file mode 100644 index df5ca35ef..000000000 --- a/buildSrc/src/main/kotlin/upload/CuiCloud.kt +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright 2019-2020 Mamoe Technologies and contributors. - * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found through the following link. - * - * https://github.com/mamoe/mirai/blob/master/LICENSE - */ - -package upload - -import io.ktor.client.request.* -import io.ktor.client.request.forms.* -import io.ktor.client.statement.* -import io.ktor.http.* -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.delay -import kotlinx.coroutines.runBlocking -import kotlinx.coroutines.withContext -import org.gradle.api.Project -import org.gradle.kotlin.dsl.provideDelegate -import java.io.File -import java.util.* -import kotlin.contracts.ExperimentalContracts -import kotlin.contracts.InvocationKind -import kotlin.contracts.contract - -@Suppress("DEPRECATION") -object CuiCloud { - private fun getUrl(project: Project): String { - kotlin.runCatching { - @Suppress("UNUSED_VARIABLE", "LocalVariableName") - val cui_cloud_url: String by project - return cui_cloud_url - } - - System.getProperty("cui_cloud_url", null)?.let { - return it.trim() - } - File(File(System.getProperty("user.dir")).parent, "/cuiUrl.txt").let { local -> - if (local.exists()) { - return local.readText().trim() - } - } - - File(File(System.getProperty("user.dir")), "/cuiUrl.txt").let { local -> - if (local.exists()) { - return local.readText().trim() - } - } - error("cannot find url for CuiCloud") - } - - private fun getKey(project: Project): String { - kotlin.runCatching { - @Suppress("UNUSED_VARIABLE", "LocalVariableName") - val cui_cloud_key: String by project - return cui_cloud_key - } - - System.getProperty("cui_cloud_key", null)?.let { - return it.trim() - } - File(File(System.getProperty("user.dir")).parent, "/cuiToken.txt").let { local -> - if (local.exists()) { - return local.readText().trim() - } - } - - File(File(System.getProperty("user.dir")), "/cuiToken.txt").let { local -> - if (local.exists()) { - return local.readText().trim() - } - } - - error("cannot find key for CuiCloud") - } - - fun upload(file: File, project: Project) { - val cuiCloudUrl = getUrl(project) - val key = getKey(project) - - - val bytes = file.readBytes() - - runBlocking { - var first = true - retryCatching(1000) { - if (!first) { - println() - println() - println("Upload failed. Waiting 15s") - delay(15_000) - } - first = false - uploadToCuiCloud( - cuiCloudUrl, - key, - "/mirai/${project.name}/${file.nameWithoutExtension}.mp4", - bytes - ) - }.getOrThrow() - } - } - - @UseExperimental(ExperimentalStdlibApi::class) - private suspend fun uploadToCuiCloud( - cuiCloudUrl: String, - cuiToken: String, - filePath: String, - content: ByteArray - ) { - println("filePath=$filePath") - println("content=${content.size / 1024 / 1024} MB") - - val response = withContext(Dispatchers.IO) { - Http.post(cuiCloudUrl) { - body = MultiPartFormDataContent( - formData { - append("base64", Base64.getEncoder().encodeToString(content)) - append("filePath", filePath) - append("large", "true") - append("key", cuiToken) - } - ) - } - } - println(response.status) - - val buffer = ByteArray(4096) - val resp = buildList { - while (true) { - val read = response.content.readAvailable(buffer, 0, buffer.size) - if (read == -1) { - break - } - addAll(buffer.toList().take(read)) - } - } - println(String(resp.toByteArray())) - - if (!response.status.isSuccess()) { - error("Cui cloud response: ${response.status}") - } - } -} - - -@OptIn(ExperimentalContracts::class) -@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE", "RESULT_CLASS_IN_RETURN_TYPE") -@kotlin.internal.InlineOnly -internal inline fun retryCatching(n: Int, onFailure: (Throwable) -> Unit = {}, block: () -> R): Result { - contract { - callsInPlace(block, InvocationKind.AT_LEAST_ONCE) - } - require(n >= 0) { "param n for retryCatching must not be negative" } - var exception: Throwable? = null - repeat(n) { - try { - return Result.success(block()) - } catch (e: Throwable) { - try { - exception?.addSuppressed(e) - } catch (e: Throwable) { - } - exception = e - onFailure(e) - } - } - return Result.failure(exception!!) -} -inline fun buildList(builderAction: MutableList.() -> Unit): List { - return ArrayList().apply(builderAction) -} diff --git a/docs/Run.md b/docs/Run.md index c7ecae2b4..c057e2abf 100644 --- a/docs/Run.md +++ b/docs/Run.md @@ -75,8 +75,6 @@ PluginManager.INSTANCE.enablePlugin(Plugin.INSTANCE) #### 从 JCenter 下载模块 -mirai 在版本发布时会将发布的构建存放于 [mirai-bintray-repo]。 - - mirai-core 会提供 [mirai-core-all] - mirai-console 与其各个模块都会提供 `-all` 的 Shadowed 构建 @@ -134,5 +132,4 @@ java -cp "./libs/*" net.mamoe.mirai.console.terminal.MiraiConsoleTerminalLoader 使用 `./start-mirai-console --help` 查看 mirai-console-terminal 支持的启动参数。 [mirai-repo]: https://github.com/project-mirai/mirai-repo/tree/master/shadow -[mirai-bintray-repo]: https://bintray.com/him188moe/mirai -[mirai-core-all]: https://bintray.com/him188moe/mirai/mirai-core-all +[mirai-core-all]: https://repo.maven.apache.org/maven2/net/mamoe/mirai-core-all/ diff --git a/frontend/mirai-console-graphical/build.gradle.kts b/frontend/mirai-console-graphical/build.gradle.kts index 12bbba3b6..9f26dc5a1 100644 --- a/frontend/mirai-console-graphical/build.gradle.kts +++ b/frontend/mirai-console-graphical/build.gradle.kts @@ -1,9 +1,17 @@ +/* + * Copyright 2019-2021 Mamoe Technologies and contributors. + * + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + plugins { id("kotlinx-serialization") id("org.openjfx.javafxplugin") version "0.0.8" id("kotlin") id("java") - id("com.jfrog.bintray") `maven-publish` } diff --git a/frontend/mirai-console-terminal/build.gradle.kts b/frontend/mirai-console-terminal/build.gradle.kts index 8e4c803a1..9027d6a08 100644 --- a/frontend/mirai-console-terminal/build.gradle.kts +++ b/frontend/mirai-console-terminal/build.gradle.kts @@ -12,7 +12,6 @@ plugins { kotlin("plugin.serialization") id("java") `maven-publish` - id("com.jfrog.bintray") } dependencies { @@ -31,6 +30,6 @@ version = Versions.consoleTerminal description = "Console Terminal CLI frontend for mirai" -configurePublishing("mirai-console-terminal", bintrayPkgName = "mirai-console-terminal") +configurePublishing("mirai-console-terminal") // endregion \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index a96e1bf1d..97ff89877 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -13,7 +13,6 @@ pluginManagement { mavenLocal() gradlePluginPortal() jcenter() - maven(url = "https://dl.bintray.com/kotlin/kotlin-eap") mavenCentral() } } diff --git a/tools/compiler-annotations/build.gradle.kts b/tools/compiler-annotations/build.gradle.kts index df49450bd..272c8dfcd 100644 --- a/tools/compiler-annotations/build.gradle.kts +++ b/tools/compiler-annotations/build.gradle.kts @@ -13,7 +13,6 @@ plugins { kotlin("jvm") id("java") `maven-publish` - id("com.jfrog.bintray") } version = Versions.console diff --git a/tools/compiler-common/build.gradle.kts b/tools/compiler-common/build.gradle.kts index 57f5548e4..68380100c 100644 --- a/tools/compiler-common/build.gradle.kts +++ b/tools/compiler-common/build.gradle.kts @@ -13,7 +13,6 @@ plugins { kotlin("jvm") id("java") `maven-publish` - id("com.jfrog.bintray") } repositories { diff --git a/tools/gradle-plugin/build.gradle.kts b/tools/gradle-plugin/build.gradle.kts index 7074e480d..6c7b8057e 100644 --- a/tools/gradle-plugin/build.gradle.kts +++ b/tools/gradle-plugin/build.gradle.kts @@ -17,7 +17,6 @@ plugins { id("java") //signing `maven-publish` - id("com.jfrog.bintray") id("com.github.johnrengelman.shadow") } @@ -40,7 +39,7 @@ dependencies { api("com.github.jengelman.gradle.plugins:shadow:6.0.0") api(`jetbrains-annotations`) - api("com.jfrog.bintray.gradle:gradle-bintray-plugin:${Versions.bintray}") + api("com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.5") testApi(kotlin("test-junit5")) diff --git a/tools/gradle-plugin/src/main/kotlin/VersionConstants.kt b/tools/gradle-plugin/src/main/kotlin/VersionConstants.kt index 47b6f1a02..8f37100e3 100644 --- a/tools/gradle-plugin/src/main/kotlin/VersionConstants.kt +++ b/tools/gradle-plugin/src/main/kotlin/VersionConstants.kt @@ -10,6 +10,6 @@ package net.mamoe.mirai.console.gradle internal object VersionConstants { - const val CONSOLE_VERSION = "2.6.2" // value is written here automatically during build - const val CORE_VERSION = "2.6.2" // value is written here automatically during build + const val CONSOLE_VERSION = "2.6.4" // value is written here automatically during build + const val CORE_VERSION = "2.6.4" // value is written here automatically during build } \ No newline at end of file diff --git a/tools/intellij-plugin/build.gradle.kts b/tools/intellij-plugin/build.gradle.kts index 574d412cf..36c190d78 100644 --- a/tools/intellij-plugin/build.gradle.kts +++ b/tools/intellij-plugin/build.gradle.kts @@ -13,7 +13,6 @@ plugins { kotlin("jvm") id("java") `maven-publish` - id("com.jfrog.bintray") id("org.jetbrains.intellij") version Versions.intellijGradlePlugin }