From 89ac4e863c0169f224dd7c0ec5cb7c02f72344b8 Mon Sep 17 00:00:00 2001 From: Him188 Date: Thu, 14 May 2020 16:05:42 +0800 Subject: [PATCH] Fix tests --- backend/mirai-console/build.gradle.kts | 7 ++++--- buildSrc/src/main/kotlin/versions.kt | 7 +++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/backend/mirai-console/build.gradle.kts b/backend/mirai-console/build.gradle.kts index 1e48bf4f7..312cf19ec 100644 --- a/backend/mirai-console/build.gradle.kts +++ b/backend/mirai-console/build.gradle.kts @@ -3,7 +3,7 @@ import upload.Bintray import java.util.* plugins { - kotlin("jvm") + id("kotlin") kotlin("plugin.serialization") id("java") `maven-publish` @@ -27,9 +27,10 @@ kotlin { } } } + dependencies { - compileOnly("net.mamoe:mirai-core:${Versions.Mirai.core}") - compileOnly(kotlin("stdlib")) // embedded by core + compileAndRuntime("net.mamoe:mirai-core:${Versions.Mirai.core}") + compileAndRuntime(kotlin("stdlib")) api("com.google.code.gson:gson:2.8.6") api(group = "org.yaml", name = "snakeyaml", version = "1.25") diff --git a/buildSrc/src/main/kotlin/versions.kt b/buildSrc/src/main/kotlin/versions.kt index 68e5161e8..2e1176452 100644 --- a/buildSrc/src/main/kotlin/versions.kt +++ b/buildSrc/src/main/kotlin/versions.kt @@ -1,3 +1,4 @@ +import org.gradle.api.artifacts.dsl.DependencyHandler import org.gradle.kotlin.dsl.DependencyHandlerScope /* @@ -31,3 +32,9 @@ fun DependencyHandlerScope.kotlinx(id: String, version: String) = "org.jetbrains @Suppress("unused") fun DependencyHandlerScope.ktor(id: String, version: String = Versions.Kotlin.ktor) = "io.ktor:ktor-$id:$version" + +@Suppress("unused") +fun DependencyHandler.compileAndRuntime(any: Any) { + add("compileOnly", any) + add("runtimeOnly", any) +}