From 5368e6b809f7bc5510deaef01c4daa2fad0273ba Mon Sep 17 00:00:00 2001 From: Him188 Date: Thu, 18 Nov 2021 03:05:50 +0000 Subject: [PATCH] Upgrade buildscript for Kotlin 1.6.0, use Gradle 7.2 --- buildSrc/build.gradle.kts | 4 ++-- buildSrc/src/main/kotlin/JvmPublishing.kt | 2 +- buildSrc/src/main/kotlin/ProjectConfigure.kt | 4 ++-- buildSrc/src/main/kotlin/Versions.kt | 18 +++++++++--------- gradle.properties | 6 ++---- gradle/wrapper/gradle-wrapper.properties | 2 +- mirai-core-all/build.gradle.kts | 2 +- settings.gradle.kts | 1 - 8 files changed, 18 insertions(+), 21 deletions(-) diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 2bd0a700b..1a34a3836 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -51,8 +51,8 @@ dependencies { api("com.github.jengelman.gradle.plugins", "shadow", version("shadow")) api("org.jetbrains.kotlin", "kotlin-gradle-plugin", version("kotlinCompiler")) - api("org.jetbrains.kotlin", "kotlin-compiler-embeddable", version("kotlinCompiler")) - api(ktor("client-okhttp", "1.4.3")) +// api("org.jetbrains.kotlin", "kotlin-compiler-embeddable", version("kotlinCompiler")) +// api(ktor("client-okhttp", "1.4.3")) api("com.android.tools.build", "gradle", version("androidGradlePlugin")) api(asm("tree")) api(asm("util")) diff --git a/buildSrc/src/main/kotlin/JvmPublishing.kt b/buildSrc/src/main/kotlin/JvmPublishing.kt index 666bc614f..9451e4d25 100644 --- a/buildSrc/src/main/kotlin/JvmPublishing.kt +++ b/buildSrc/src/main/kotlin/JvmPublishing.kt @@ -38,7 +38,7 @@ fun Project.configureRemoteRepos() { // sonatype val keys = SecretKeys.getCache(project) repositories { - if (System.getenv("MIRAI_IS_SNAPSHOTS_PUBLISHING").toBoolean()) { + if (System.getenv("MIRAI_IS_SNAPSHOTS_PUBLISHING")?.toBoolean() == true) { maven { name = "MiraiRepo" setUrl(System.getenv("SNAPSHOTS_PUBLISHING_URL")) diff --git a/buildSrc/src/main/kotlin/ProjectConfigure.kt b/buildSrc/src/main/kotlin/ProjectConfigure.kt index 10c107e32..a95af3d4e 100644 --- a/buildSrc/src/main/kotlin/ProjectConfigure.kt +++ b/buildSrc/src/main/kotlin/ProjectConfigure.kt @@ -32,7 +32,7 @@ fun Project.configureJvmTarget() { val defaultVer = JavaVersion.VERSION_1_8 tasks.withType(KotlinJvmCompile::class.java) { - kotlinOptions.languageVersion = "1.5" + kotlinOptions.languageVersion = "1.6" kotlinOptions.jvmTarget = defaultVer.toString() kotlinOptions.freeCompilerArgs += "-Xjvm-default=all" } @@ -151,7 +151,7 @@ val experimentalAnnotations = arrayOf( "net.mamoe.mirai.console.util.ConsoleInternalApi", "net.mamoe.mirai.console.util.ConsoleExperimentalApi", - "kotlinx.io.core.internal.DangerousInternalIoApi", + "kotlinx.io.core.internal.DangerousInternalIoApi" ) fun Project.configureKotlinExperimentalUsages() { diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index 33d2f2788..8c6fff48d 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -20,21 +20,21 @@ object Versions { const val console = project const val consoleTerminal = project - const val kotlinCompiler = "1.5.30" - const val kotlinStdlib = "1.5.30" + const val kotlinCompiler = "1.6.0" + const val kotlinStdlib = kotlinCompiler const val dokka = "1.6.0" - const val coroutines = "1.5.1" - const val atomicFU = "0.16.3" + const val coroutines = "1.6.0" + const val atomicFU = "0.17.0" const val serialization = "1.2.2" - const val ktor = "1.5.4" + const val ktor = "1.6.5" const val binaryValidator = "0.4.0" const val io = "0.1.16" const val coroutinesIo = "0.1.16" - const val blockingBridge = "1.10.6-1530.2" + const val blockingBridge = "1.10.6-160.1" const val androidGradlePlugin = "4.1.1" const val android = "4.1.1.4" @@ -54,9 +54,9 @@ object Versions { // If you the versions below, you need to sync changes to mirai-console/buildSrc/src/main/kotlin/Versions.kt const val yamlkt = "0.10.2" - const val intellijGradlePlugin = "1.1" - const val kotlinIntellijPlugin = "211-1.5.20-release-284-IJ7442.40" // keep to newest as kotlinCompiler - const val intellij = "2021.1.3" // don't update easily unless you want your disk space -= 500MB + const val intellijGradlePlugin = "1.3.0" +// const val kotlinIntellijPlugin = "211-1.5.20-release-284-IJ7442.40" // keep to newest as kotlinCompiler + const val intellij = "2021.3" // don't update easily unless you want your disk space -= 500MB } diff --git a/gradle.properties b/gradle.properties index d6d206af1..7b10f90aa 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,13 +6,11 @@ # # https://github.com/mamoe/mirai/blob/master/LICENSE # - # style guide kotlin.code.style=official # config kotlin.incremental.multiplatform=true -kotlin.parallel.tasks.in.project=true -org.gradle.jvmargs=-Xmx4096m -Dfile.encoding=UTF-8 +org.gradle.jvmargs=-Xmx4096m -Dfile.encoding=UTF-8 --illegal-access=permit -Dkotlin.daemon.jvm.options=--illegal-access=permit --add-opens java.base/java.util=ALL-UNNAMED org.gradle.parallel=true org.gradle.vfs.watch=true kotlin.mpp.enableGranularSourceSetsMetadata=true @@ -22,5 +20,5 @@ systemProp.org.gradle.internal.publish.checksums.insecure=true gnsp.disableApplyOnlyOnRootProjectEnforcement=true # We may target 15 with Kotlin 1.5 IR mirai.android.target.api.level=24 - +# Enable if you want to use mavenLocal for both Gradle plugin and project dependencies resolutions. systemProp.use.maven.local=false \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index f10c7268d..0423505e4 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -6,7 +6,7 @@ # # https://github.com/mamoe/mirai/blob/master/LICENSE # -distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStorePath=wrapper/dists diff --git a/mirai-core-all/build.gradle.kts b/mirai-core-all/build.gradle.kts index b8fee75bb..08485b129 100644 --- a/mirai-core-all/build.gradle.kts +++ b/mirai-core-all/build.gradle.kts @@ -25,6 +25,6 @@ dependencies { api(project(":mirai-core-utils")) } -if (!System.getenv("MIRAI_IS_SNAPSHOTS_PUBLISHING").toBoolean()) { +if (System.getenv("MIRAI_IS_SNAPSHOTS_PUBLISHING")?.toBoolean() != true) { configurePublishing("mirai-core-all") } \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index ccc1caf58..99a2761cb 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -12,7 +12,6 @@ pluginManagement { if (System.getProperty("use.maven.local") == "true") { mavenLocal() } -// mavenLocal() gradlePluginPortal() mavenCentral() google()