mirai/mirai-serialization/build.gradle.kts
2020-09-22 18:56:27 +08:00

98 lines
3.0 KiB
Plaintext

@file:Suppress("UNUSED_VARIABLE")
plugins {
kotlin("multiplatform")
id("kotlinx-atomicfu")
kotlin("plugin.serialization")
id("signing")
`maven-publish`
id("com.jfrog.bintray")
}
description = "Mirai serialization module"
val isAndroidSDKAvailable: Boolean by project
kotlin {
explicitApi()
if (isAndroidSDKAvailable) {
apply(from = rootProject.file("gradle/android.gradle"))
android("android") {
publishAllLibraryVariants()
}
} else {
println(
"""Android SDK 可能未安装.
$name 的 Android 目标编译将不会进行.
这不会影响 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.
""".trimIndent()
)
}
jvm()
sourceSets.apply {
all {
languageSettings.enableLanguageFeature("InlineClasses")
languageSettings.useExperimentalAnnotation("kotlin.Experimental")
languageSettings.useExperimentalAnnotation("net.mamoe.mirai.utils.MiraiInternalAPI")
languageSettings.useExperimentalAnnotation("net.mamoe.mirai.utils.MiraiExperimentalAPI")
languageSettings.useExperimentalAnnotation("net.mamoe.mirai.LowLevelAPI")
languageSettings.useExperimentalAnnotation("kotlin.ExperimentalUnsignedTypes")
languageSettings.useExperimentalAnnotation("kotlin.experimental.ExperimentalTypeInference")
languageSettings.useExperimentalAnnotation("kotlin.time.ExperimentalTime")
languageSettings.useExperimentalAnnotation("kotlin.contracts.ExperimentalContracts")
languageSettings.progressiveMode = true
}
val commonMain by getting {
dependencies {
api(project(":mirai-core"))
}
}
val commonTest by getting {
dependencies {
api(kotlin("test-annotations-common"))
api(kotlin("test-common"))
}
}
if (isAndroidSDKAvailable) {
val androidMain by getting {
dependencies {
}
}
val androidTest by getting {
dependencies {
}
}
}
val jvmMain by getting {
dependencies {
runtimeOnly(files("build/classes/kotlin/jvm/main")) // classpath is not properly set by IDE
}
}
val jvmTest by getting {
dependencies {
implementation(kotlin("test"))
implementation(kotlin("test-junit"))
runtimeOnly(files("build/classes/kotlin/jvm/test")) // classpath is not properly set by IDE
}
}
}
}
apply(from = rootProject.file("gradle/publish.gradle"))