From 45487c7e67fb9bf381f853fba3905d1392012add Mon Sep 17 00:00:00 2001 From: Him188 Date: Tue, 24 Mar 2020 18:02:19 +0800 Subject: [PATCH] Update versions --- buildSrc/build.gradle.kts | 7 ++++ buildSrc/src/main/kotlin/versions.kt | 46 +++++++++++++++++++++ gradle.properties | 18 +------- mirai-console-graphical/build.gradle.kts | 2 + mirai-console-terminal/build.gradle.kts | 1 + mirai-console-wrapper/build.gradle.kts | 27 +++--------- mirai-console/build.gradle.kts | 52 ++++++++---------------- 7 files changed, 79 insertions(+), 74 deletions(-) create mode 100644 buildSrc/build.gradle.kts create mode 100644 buildSrc/src/main/kotlin/versions.kt diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts new file mode 100644 index 000000000..c39a297b0 --- /dev/null +++ b/buildSrc/build.gradle.kts @@ -0,0 +1,7 @@ +plugins { + `kotlin-dsl` +} + +repositories { + jcenter() +} \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/versions.kt b/buildSrc/src/main/kotlin/versions.kt new file mode 100644 index 000000000..3dd3ae4c1 --- /dev/null +++ b/buildSrc/src/main/kotlin/versions.kt @@ -0,0 +1,46 @@ +import org.gradle.kotlin.dsl.DependencyHandlerScope + +/* + * Copyright 2020 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 + */ + +object Versions { + object Mirai { + const val core = "0.30.0" + const val console = "0.3.6" + const val consoleWrapper = "0.1.3" + } + + object Kotlin { + const val stdlib = "1.4-M1" + const val coroutines = "1.3.5-1.4-M1" + const val atomicFU = "0.14.2-1.4-M1" + const val serialization = "0.20.0-1.4-M1" + const val ktor = "1.3.2-1.4-M1" + + const val io = "0.1.16" + const val coroutinesIo = "0.1.16" + const val dokka = "0.10.1" + } + + object Android { + const val androidGradlePlugin = "3.5.3" + } + + object Publishing { + const val bintray = "1.8.4-jetbrains-3" + + } + +} + +@Suppress("unused") +fun DependencyHandlerScope.kotlinx(id: String, version: String) = "org.jetbrains.kotlinx:kotlinx-$id:$version" + +@Suppress("unused") +fun DependencyHandlerScope.ktor(id: String, version: String = Versions.Kotlin.ktor) = "io.ktor:ktor-$id:$version" diff --git a/gradle.properties b/gradle.properties index 6846db10d..f6a30e62f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,21 +1,5 @@ # style guide kotlin.code.style=official # config -miraiVersion=0.29.1 -miraiConsoleVersion=0.3.6 -miraiConsoleWrapperVersion=0.1.3 kotlin.incremental.multiplatform=true -kotlin.parallel.tasks.in.project=true -# kotlin -kotlinVersion=1.3.70 -# kotlin libraries -serializationVersion=0.20.0 -coroutinesVersion=1.3.4 -atomicFuVersion=0.14.1 -kotlinXIoVersion=0.1.16 -coroutinesIoVersion=0.1.16 -# utility -ktorVersion=1.3.2 -klockVersion=1.7.0 -# gradle plugin -protobufJavaVersion=3.10.0 +kotlin.parallel.tasks.in.project=true \ No newline at end of file diff --git a/mirai-console-graphical/build.gradle.kts b/mirai-console-graphical/build.gradle.kts index ff6141833..35f97c320 100644 --- a/mirai-console-graphical/build.gradle.kts +++ b/mirai-console-graphical/build.gradle.kts @@ -13,6 +13,8 @@ plugins { apply(plugin = "com.github.johnrengelman.shadow") +version = Versions.Mirai.console + tasks.withType() { manifest { attributes["Main-Class"] = "net.mamoe.mirai.console.graphical.MiraiGraphicalLoader" diff --git a/mirai-console-terminal/build.gradle.kts b/mirai-console-terminal/build.gradle.kts index de9307458..cb2da1d3f 100644 --- a/mirai-console-terminal/build.gradle.kts +++ b/mirai-console-terminal/build.gradle.kts @@ -7,6 +7,7 @@ plugins { apply(plugin = "com.github.johnrengelman.shadow") +version = Versions.Mirai.console tasks.withType() { manifest { diff --git a/mirai-console-wrapper/build.gradle.kts b/mirai-console-wrapper/build.gradle.kts index c326a15b9..fb0704d91 100644 --- a/mirai-console-wrapper/build.gradle.kts +++ b/mirai-console-wrapper/build.gradle.kts @@ -4,18 +4,6 @@ plugins { apply(plugin = "com.github.johnrengelman.shadow") -val kotlinVersion: String by rootProject.ext -val coroutinesVersion: String by rootProject.ext -val coroutinesIoVersion: String by rootProject.ext -val atomicFuVersion: String by rootProject.ext -val kotlinXIoVersion: String by rootProject.ext - -val ktorVersion: String by rootProject.ext - -fun kotlinx(id: String, version: String) = "org.jetbrains.kotlinx:kotlinx-$id:$version" - -fun ktor(id: String, version: String) = "io.ktor:ktor-$id:$version" - tasks.withType { manifest { attributes["Main-Class"] = "net.mamoe.mirai.console.wrapper.WrapperMain" @@ -23,8 +11,6 @@ tasks.withType { } -val miraiVersion: String by rootProject.ext - kotlin { sourceSets { all { @@ -36,15 +22,13 @@ kotlin { } } -val serializationVersion: String by rootProject.ext - dependencies { //core && protocol - api(kotlin("stdlib", kotlinVersion)) - api(kotlin("serialization", kotlinVersion)) - api(kotlin("reflect", kotlinVersion)) + api(kotlin("stdlib", Versions.Kotlin.stdlib)) + api(kotlin("serialization", Versions.Kotlin.stdlib)) + api(kotlin("reflect", Versions.Kotlin.stdlib)) - api(kotlinx("coroutines-core-common", coroutinesVersion)) + api(kotlinx("coroutines-core", Versions.Kotlin.coroutines)) api(kotlinx("serialization-runtime-common", serializationVersion)) api(kotlinx("serialization-protobuf-common", serializationVersion)) api(kotlinx("io", kotlinXIoVersion)) @@ -82,7 +66,6 @@ dependencies { } -val miraiConsoleWrapperVersion: String by project.ext -version = miraiConsoleWrapperVersion +version = Versions.Mirai.consoleWrapper description = "Console with plugin support for mirai" \ No newline at end of file diff --git a/mirai-console/build.gradle.kts b/mirai-console/build.gradle.kts index 27e56ba56..4f3f39be9 100644 --- a/mirai-console/build.gradle.kts +++ b/mirai-console/build.gradle.kts @@ -1,33 +1,15 @@ import java.util.* plugins { - id("kotlinx-serialization") - id("kotlin") + kotlin("jvm") + kotlin("plugin.serialization") id("java") `maven-publish` id("com.jfrog.bintray") } - apply(plugin = "com.github.johnrengelman.shadow") -val kotlinVersion: String by rootProject.ext -val atomicFuVersion: String by rootProject.ext -val coroutinesVersion: String by rootProject.ext -val kotlinXIoVersion: String by rootProject.ext -val coroutinesIoVersion: String by rootProject.ext - -val klockVersion: String by rootProject.ext -val ktorVersion: String by rootProject.ext - -val serializationVersion: String by rootProject.ext - -fun kotlinx(id: String, version: String) = "org.jetbrains.kotlinx:kotlinx-$id:$version" - -fun ktor(id: String, version: String) = "io.ktor:ktor-$id:$version" - -val miraiVersion: String by rootProject.ext - kotlin { sourceSets { all { @@ -39,8 +21,8 @@ kotlin { } } dependencies { - compileOnly("net.mamoe:mirai-core-jvm:$miraiVersion") - compileOnly("net.mamoe:mirai-core-qqandroid-jvm:$miraiVersion") + compileOnly("net.mamoe:mirai-core-jvm:${Versions.Mirai.core}") + compileOnly("net.mamoe:mirai-core-qqandroid-jvm:${Versions.Mirai.core}") compileOnly(group = "com.alibaba", name = "fastjson", version = "1.2.62") @@ -48,23 +30,23 @@ dependencies { compileOnly(group = "com.moandjiezana.toml", name = "toml4j", version = "0.7.2") - compileOnly(kotlin("stdlib", kotlinVersion)) - compileOnly(kotlin("serialization", kotlinVersion)) - compileOnly(kotlin("reflect", kotlinVersion)) + compileOnly(kotlin("stdlib", Versions.Kotlin.stdlib)) + compileOnly(kotlin("serialization", Versions.Kotlin.stdlib)) + compileOnly(kotlin("reflect", Versions.Kotlin.stdlib)) - compileOnly(kotlinx("coroutines-io-jvm", coroutinesIoVersion)) - compileOnly(kotlinx("coroutines-core", coroutinesVersion)) - compileOnly(kotlinx("serialization-runtime", serializationVersion)) - compileOnly("org.jetbrains.kotlinx:atomicfu:$atomicFuVersion") + compileOnly(kotlinx("coroutines-io-jvm", Versions.Kotlin.coroutinesIo)) + compileOnly(kotlinx("coroutines-core", Versions.Kotlin.coroutines)) + compileOnly(kotlinx("serialization-runtime", Versions.Kotlin.serialization)) + compileOnly("org.jetbrains.kotlinx:atomicfu:${Versions.Kotlin.atomicFU}") compileOnly("org.bouncycastle:bcprov-jdk15on:1.64") - compileOnly(ktor("http-cio", ktorVersion)) - compileOnly(ktor("http-jvm", ktorVersion)) - compileOnly(ktor("io-jvm", ktorVersion)) - compileOnly(ktor("client-core-jvm", ktorVersion)) - compileOnly(ktor("client-cio", ktorVersion)) - compileOnly(ktor("network", ktorVersion)) + compileOnly(ktor("http-cio")) + compileOnly(ktor("http-jvm")) + compileOnly(ktor("io-jvm")) + compileOnly(ktor("client-core-jvm")) + compileOnly(ktor("client-cio")) + compileOnly(ktor("network")) } val miraiConsoleVersion: String by project.ext