This commit is contained in:
Him188 2020-01-05 18:16:11 +08:00
parent 27819d7343
commit b9e00f4169
3 changed files with 43 additions and 34 deletions

View File

@ -30,8 +30,9 @@ fun ktor(id: String, version: String) = "io.ktor:ktor-$id:$version"
description = "QQ protocol library" description = "QQ protocol library"
version = rootProject.ext.get("mirai_version")!!.toString() version = rootProject.ext.get("mirai_version")!!.toString()
val isAndroidSDKAvailable: Boolean by project
kotlin { kotlin {
val isAndroidSDKAvailable: Boolean by project
if (isAndroidSDKAvailable) { if (isAndroidSDKAvailable) {
android("android") { android("android") {
publishAllLibraryVariants() publishAllLibraryVariants()
@ -96,17 +97,19 @@ kotlin {
} }
} }
val androidMain by getting { if (isAndroidSDKAvailable) {
dependencies { val androidMain by getting {
dependencies {
}
} }
}
val androidTest by getting { val androidTest by getting {
dependencies { dependencies {
api(kotlin("test", kotlinVersion)) api(kotlin("test", kotlinVersion))
api(kotlin("test-junit", kotlinVersion)) api(kotlin("test-junit", kotlinVersion))
api(kotlin("test-annotations-common")) api(kotlin("test-annotations-common"))
api(kotlin("test-common")) api(kotlin("test-common"))
}
} }
} }

View File

@ -30,8 +30,9 @@ fun ktor(id: String, version: String) = "io.ktor:ktor-$id:$version"
description = "QQ protocol library" description = "QQ protocol library"
version = rootProject.ext.get("mirai_version")!!.toString() version = rootProject.ext.get("mirai_version")!!.toString()
val isAndroidSDKAvailable: Boolean by project
kotlin { kotlin {
val isAndroidSDKAvailable: Boolean by project
if (isAndroidSDKAvailable) { if (isAndroidSDKAvailable) {
android("android") { android("android") {
publishAllLibraryVariants() publishAllLibraryVariants()
@ -95,17 +96,19 @@ kotlin {
} }
} }
val androidMain by getting { if (isAndroidSDKAvailable) {
dependencies { val androidMain by getting {
dependencies {
}
} }
}
val androidTest by getting { val androidTest by getting {
dependencies { dependencies {
api(kotlin("test", kotlinVersion)) api(kotlin("test", kotlinVersion))
api(kotlin("test-junit", kotlinVersion)) api(kotlin("test-junit", kotlinVersion))
api(kotlin("test-annotations-common")) api(kotlin("test-annotations-common"))
api(kotlin("test-common")) api(kotlin("test-common"))
}
} }
} }

View File

@ -29,8 +29,9 @@ fun ktor(id: String, version: String) = "io.ktor:ktor-$id:$version"
description = "QQ protocol library" description = "QQ protocol library"
val isAndroidSDKAvailable: Boolean by project
kotlin { kotlin {
val isAndroidSDKAvailable: Boolean by project
if (isAndroidSDKAvailable) { if (isAndroidSDKAvailable) {
android("android") { android("android") {
publishAllLibraryVariants() publishAllLibraryVariants()
@ -108,23 +109,25 @@ kotlin {
} }
} }
val androidMain by getting { if (isAndroidSDKAvailable) {
dependencies { val androidMain by getting {
api(kotlin("reflect", kotlinVersion)) dependencies {
api(kotlin("reflect", kotlinVersion))
api(kotlinx("serialization-runtime", serializationVersion)) api(kotlinx("serialization-runtime", serializationVersion))
api(kotlinx("coroutines-android", coroutinesVersion)) api(kotlinx("coroutines-android", coroutinesVersion))
api(ktor("client-android", ktorVersion)) api(ktor("client-android", ktorVersion))
}
} }
}
val androidTest by getting { val androidTest by getting {
dependencies { dependencies {
api(kotlin("test", kotlinVersion)) api(kotlin("test", kotlinVersion))
api(kotlin("test-junit", kotlinVersion)) api(kotlin("test-junit", kotlinVersion))
api(kotlin("test-annotations-common")) api(kotlin("test-annotations-common"))
api(kotlin("test-common")) api(kotlin("test-common"))
}
} }
} }