2019-12-23 19:31:13 +08:00
|
|
|
@file:Suppress("UNUSED_VARIABLE")
|
|
|
|
|
|
|
|
plugins {
|
|
|
|
kotlin("multiplatform")
|
|
|
|
id("kotlinx-atomicfu")
|
2020-03-24 10:01:03 +08:00
|
|
|
kotlin("plugin.serialization")
|
2019-12-23 19:31:13 +08:00
|
|
|
`maven-publish`
|
2020-03-24 10:01:03 +08:00
|
|
|
id("com.jfrog.bintray")
|
2019-12-23 19:31:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
description = "QQ protocol library"
|
|
|
|
|
2020-01-05 18:16:11 +08:00
|
|
|
val isAndroidSDKAvailable: Boolean by project
|
|
|
|
|
2019-12-23 19:31:13 +08:00
|
|
|
kotlin {
|
2020-01-05 17:38:46 +08:00
|
|
|
if (isAndroidSDKAvailable) {
|
2020-01-21 14:49:42 +08:00
|
|
|
apply(from = rootProject.file("gradle/android.gradle"))
|
2020-01-05 17:18:02 +08:00
|
|
|
android("android") {
|
|
|
|
publishAllLibraryVariants()
|
2019-12-23 19:31:13 +08:00
|
|
|
}
|
2020-01-05 17:18:02 +08:00
|
|
|
} else {
|
|
|
|
println(
|
|
|
|
"""Android SDK 可能未安装.
|
|
|
|
$name 的 Android 目标编译将不会进行.
|
2020-01-05 17:38:46 +08:00
|
|
|
这不会影响 Android 以外的平台的编译.
|
|
|
|
""".trimIndent()
|
|
|
|
)
|
|
|
|
println(
|
|
|
|
"""Android SDK might not be installed.
|
|
|
|
Android target of $name will not be compiled.
|
|
|
|
It does no influence on the compilation of other platforms.
|
2020-01-05 17:18:02 +08:00
|
|
|
""".trimIndent()
|
|
|
|
)
|
2019-12-23 19:31:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
jvm("jvm") {
|
|
|
|
}
|
|
|
|
|
|
|
|
sourceSets {
|
|
|
|
all {
|
|
|
|
languageSettings.enableLanguageFeature("InlineClasses")
|
|
|
|
languageSettings.useExperimentalAnnotation("kotlin.Experimental")
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
api(project(":mirai-core"))
|
|
|
|
}
|
|
|
|
}
|
2020-03-24 10:01:03 +08:00
|
|
|
|
2019-12-23 19:31:13 +08:00
|
|
|
commonMain {
|
|
|
|
dependencies {
|
2020-03-24 10:01:03 +08:00
|
|
|
api(kotlin("stdlib", Versions.Kotlin.stdlib))
|
|
|
|
api(kotlinx("serialization-runtime-common", Versions.Kotlin.serialization))
|
|
|
|
api(kotlinx("serialization-protobuf-common", Versions.Kotlin.serialization))
|
|
|
|
api("org.jetbrains.kotlinx:atomicfu:${Versions.Kotlin.atomicFU}")
|
|
|
|
api(kotlinx("io", Versions.Kotlin.io))
|
|
|
|
api(kotlinx("coroutines-io", Versions.Kotlin.coroutinesIo))
|
|
|
|
api(kotlinx("coroutines-core", Versions.Kotlin.coroutines))
|
2019-12-23 19:31:13 +08:00
|
|
|
}
|
|
|
|
}
|
2020-03-24 10:01:03 +08:00
|
|
|
|
2019-12-23 19:31:13 +08:00
|
|
|
commonTest {
|
|
|
|
dependencies {
|
2020-03-24 10:01:03 +08:00
|
|
|
implementation(kotlin("test-annotations-common"))
|
|
|
|
implementation(kotlin("test-common"))
|
2019-12-30 16:31:28 +08:00
|
|
|
implementation(kotlin("script-runtime"))
|
2019-12-23 19:31:13 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-05 18:16:11 +08:00
|
|
|
if (isAndroidSDKAvailable) {
|
|
|
|
val androidMain by getting {
|
|
|
|
dependencies {
|
2020-03-24 10:01:03 +08:00
|
|
|
api(kotlinx("serialization-protobuf", Versions.Kotlin.serialization))
|
2020-01-05 18:16:11 +08:00
|
|
|
}
|
2019-12-23 19:31:13 +08:00
|
|
|
}
|
|
|
|
|
2020-01-05 18:16:11 +08:00
|
|
|
val androidTest by getting {
|
|
|
|
dependencies {
|
2020-03-24 10:01:03 +08:00
|
|
|
implementation(kotlin("test", Versions.Kotlin.stdlib))
|
|
|
|
implementation(kotlin("test-junit", Versions.Kotlin.stdlib))
|
2020-02-12 13:52:07 +08:00
|
|
|
implementation(kotlin("test-annotations-common"))
|
|
|
|
implementation(kotlin("test-common"))
|
2020-01-05 18:16:11 +08:00
|
|
|
}
|
2019-12-23 19:31:13 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
val jvmMain by getting {
|
|
|
|
dependencies {
|
2020-02-07 10:11:47 +08:00
|
|
|
runtimeOnly(files("build/classes/kotlin/jvm/main")) // classpath is not properly set by IDE
|
2020-03-24 10:01:03 +08:00
|
|
|
api(kotlinx("serialization-runtime", Versions.Kotlin.serialization))
|
|
|
|
//api(kotlinx("serialization-protobuf", Versions.Kotlin.serialization))
|
2020-03-13 21:06:57 +08:00
|
|
|
|
2019-12-23 19:31:13 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
val jvmTest by getting {
|
|
|
|
dependencies {
|
2020-03-24 10:01:03 +08:00
|
|
|
implementation(kotlin("test", Versions.Kotlin.stdlib))
|
|
|
|
implementation(kotlin("test-junit", Versions.Kotlin.stdlib))
|
2019-12-23 19:31:13 +08:00
|
|
|
implementation("org.pcap4j:pcap4j-distribution:1.8.2")
|
|
|
|
|
2020-02-07 10:11:47 +08:00
|
|
|
runtimeOnly(files("build/classes/kotlin/jvm/main")) // classpath is not properly set by IDE
|
|
|
|
runtimeOnly(files("build/classes/kotlin/jvm/test")) // classpath is not properly set by IDE
|
2019-12-23 19:31:13 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-02-16 13:54:42 +08:00
|
|
|
}
|
2020-02-18 13:03:51 +08:00
|
|
|
|
2020-02-16 13:54:42 +08:00
|
|
|
apply(from = rootProject.file("gradle/publish.gradle"))
|