From 92a5babf1c4a2a8cad636c10498452d4a1d20e42 Mon Sep 17 00:00:00 2001 From: Karlatemp Date: Wed, 18 May 2022 13:25:15 +0800 Subject: [PATCH] Using a released version to run gradle tests --- .../src/integTest/kotlin/AbstractTest.kt | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/mirai-console/tools/gradle-plugin/src/integTest/kotlin/AbstractTest.kt b/mirai-console/tools/gradle-plugin/src/integTest/kotlin/AbstractTest.kt index 0e6c651a6..56f7b2c8d 100644 --- a/mirai-console/tools/gradle-plugin/src/integTest/kotlin/AbstractTest.kt +++ b/mirai-console/tools/gradle-plugin/src/integTest/kotlin/AbstractTest.kt @@ -66,16 +66,44 @@ abstract class AbstractTest { buildFile = File(tempDir, "build.gradle") buildFile.delete() + val ktVersion = "1.6.0" + val replacedMiraiVersion = "2.11.0-RC2" buildFile.writeText( """ plugins { - id("org.jetbrains.kotlin.jvm") version "1.6.0" + id("org.jetbrains.kotlin.jvm") version "$ktVersion" id("net.mamoe.mirai-console") } repositories { mavenCentral() } + // Mirai dev versions not available in gradle test. + // So using a released version to run tests + ({ + def modules = [ + 'mirai-core-api', + 'mirai-core-api-jvm', + 'mirai-core', + 'mirai-core-jvm', + 'mirai-core-utils', + 'mirai-core-utils-jvm', + 'mirai-console', + 'mirai-console-terminal', + 'mirai-console-compiler-annotations', + 'mirai-console-compiler-common', + ]; + allprojects { configurations.all { resolutionStrategy.eachDependency { DependencyResolveDetails details -> + if (details.requested.group == 'net.mamoe') { + if (modules.contains(details.requested.name)) { + details.useVersion '$replacedMiraiVersion' + } + } + if (details.requested.group == 'org.jetbrains.kotlin') { + details.useVersion '$ktVersion' + } + } } } + })(); """ )