Using a released version to run gradle tests

This commit is contained in:
Karlatemp 2022-05-18 13:25:15 +08:00
parent a1a517c03f
commit 92a5babf1c
No known key found for this signature in database
GPG Key ID: C6B606FF23D8FED7

View File

@ -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'
}
} } }
})();
"""
)