2020-11-01 15:07:32 +08:00
|
|
|
/*
|
2021-01-11 18:36:04 +08:00
|
|
|
* Copyright 2019-2021 Mamoe Technologies and contributors.
|
2020-11-01 15:07:32 +08:00
|
|
|
*
|
|
|
|
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
|
|
|
|
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
|
|
|
|
*
|
|
|
|
* https://github.com/mamoe/mirai/blob/master/LICENSE
|
|
|
|
*/
|
2019-12-23 19:31:13 +08:00
|
|
|
@file:Suppress("UNUSED_VARIABLE")
|
|
|
|
|
2021-12-28 01:15:56 +08:00
|
|
|
import BinaryCompatibilityConfigurator.configureBinaryValidators
|
2020-12-18 15:37:13 +08:00
|
|
|
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
|
|
|
|
|
2019-12-23 19:31:13 +08:00
|
|
|
plugins {
|
|
|
|
kotlin("multiplatform")
|
2020-03-24 10:01:03 +08:00
|
|
|
kotlin("plugin.serialization")
|
2021-01-21 10:08:21 +08:00
|
|
|
|
2021-02-25 09:35:51 +08:00
|
|
|
//id("kotlinx-atomicfu")
|
2020-10-03 12:42:13 +08:00
|
|
|
id("signing")
|
2021-12-12 22:37:01 +08:00
|
|
|
id("me.him188.kotlin-jvm-blocking-bridge")
|
2021-01-21 10:08:21 +08:00
|
|
|
|
2019-12-23 19:31:13 +08:00
|
|
|
`maven-publish`
|
|
|
|
}
|
|
|
|
|
2020-10-03 12:42:13 +08:00
|
|
|
description = "Mirai API module"
|
2019-12-23 19:31:13 +08:00
|
|
|
|
|
|
|
kotlin {
|
2020-10-03 12:42:13 +08:00
|
|
|
explicitApi()
|
|
|
|
|
2020-01-05 17:38:46 +08:00
|
|
|
if (isAndroidSDKAvailable) {
|
2021-02-01 12:23:04 +08:00
|
|
|
jvm("android") {
|
|
|
|
attributes.attribute(KotlinPlatformType.attribute, KotlinPlatformType.androidJvm)
|
2019-12-23 19:31:13 +08:00
|
|
|
}
|
2020-01-05 17:18:02 +08:00
|
|
|
} else {
|
2021-01-21 10:08:21 +08:00
|
|
|
printAndroidNotInstalled()
|
2019-12-23 19:31:13 +08:00
|
|
|
}
|
|
|
|
|
2020-11-22 14:25:49 +08:00
|
|
|
jvm("common") {
|
2020-12-18 15:37:13 +08:00
|
|
|
attributes.attribute(KotlinPlatformType.attribute, KotlinPlatformType.common)
|
2019-12-23 19:31:13 +08:00
|
|
|
}
|
|
|
|
|
2020-12-18 15:37:13 +08:00
|
|
|
jvm("jvm")
|
2020-11-22 14:25:49 +08:00
|
|
|
|
|
|
|
|
2020-10-03 13:35:05 +08:00
|
|
|
sourceSets {
|
2021-02-01 12:23:04 +08:00
|
|
|
val commonMain by getting {
|
2019-12-23 19:31:13 +08:00
|
|
|
dependencies {
|
2020-10-03 12:42:13 +08:00
|
|
|
api(kotlin("reflect"))
|
2021-09-01 18:51:13 +08:00
|
|
|
api(`kotlinx-serialization-core-jvm`)
|
|
|
|
api(`kotlinx-serialization-json-jvm`)
|
2021-12-22 02:09:12 +08:00
|
|
|
api(`kotlinx-coroutines-core-jvm`) // don't remove it, otherwise IDE will complain
|
2021-03-08 18:34:45 +08:00
|
|
|
api(`kotlinx-coroutines-jdk8`)
|
2021-01-21 10:08:21 +08:00
|
|
|
api(`ktor-client-okhttp`)
|
2020-11-30 23:30:57 +08:00
|
|
|
|
2021-09-01 18:51:13 +08:00
|
|
|
implementation(project(":mirai-core-utils"))
|
2021-12-23 08:14:57 +08:00
|
|
|
implementation(project(":mirai-console-compiler-annotations"))
|
2021-09-01 18:51:13 +08:00
|
|
|
implementation(`kotlinx-serialization-protobuf-jvm`)
|
|
|
|
implementation(`jetbrains-annotations`)
|
2021-08-06 02:31:17 +08:00
|
|
|
implementation(`log4j-api`)
|
2021-09-01 18:51:13 +08:00
|
|
|
implementation(`kotlinx-atomicfu-jvm`)
|
|
|
|
implementationKotlinxIoJvm()
|
2021-01-21 10:08:21 +08:00
|
|
|
|
2021-09-01 18:51:13 +08:00
|
|
|
compileOnly(`slf4j-api`)
|
2019-12-23 19:31:13 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-06 02:31:17 +08:00
|
|
|
commonTest {
|
|
|
|
dependencies {
|
|
|
|
runtimeOnly(`log4j-core`)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-05 18:16:11 +08:00
|
|
|
if (isAndroidSDKAvailable) {
|
2021-02-01 12:23:04 +08:00
|
|
|
val androidMain by getting {
|
|
|
|
dependsOn(commonMain)
|
2020-01-05 18:16:11 +08:00
|
|
|
dependencies {
|
2021-02-01 12:23:04 +08:00
|
|
|
compileOnly(`android-runtime`)
|
2021-09-01 18:51:13 +08:00
|
|
|
// api(`ktor-client-android`)
|
2020-01-05 18:16:11 +08:00
|
|
|
}
|
2019-12-23 19:31:13 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-01 12:23:04 +08:00
|
|
|
val jvmMain by getting {
|
2019-12-23 19:31:13 +08:00
|
|
|
|
2021-02-01 12:23:04 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
val jvmTest by getting {
|
2019-12-23 19:31:13 +08:00
|
|
|
dependencies {
|
2020-10-03 12:42:13 +08:00
|
|
|
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
|
|
|
|
2021-04-05 22:35:38 +08:00
|
|
|
if (isAndroidSDKAvailable) {
|
|
|
|
tasks.register("checkAndroidApiLevel") {
|
|
|
|
doFirst {
|
|
|
|
analyzes.AndroidApiLevelCheck.check(
|
|
|
|
buildDir.resolve("classes/kotlin/android/main"),
|
|
|
|
project.property("mirai.android.target.api.level")!!.toString().toInt(),
|
|
|
|
project
|
|
|
|
)
|
|
|
|
}
|
|
|
|
group = "verification"
|
|
|
|
this.mustRunAfter("androidMainClasses")
|
2021-02-25 00:12:58 +08:00
|
|
|
}
|
2021-04-05 22:35:38 +08:00
|
|
|
tasks.getByName("androidTest").dependsOn("checkAndroidApiLevel")
|
2021-02-25 00:12:58 +08:00
|
|
|
}
|
2020-10-03 13:35:05 +08:00
|
|
|
|
2021-01-21 14:16:03 +08:00
|
|
|
configureMppPublishing()
|
2021-12-28 01:15:56 +08:00
|
|
|
configureBinaryValidators("jvm", "android")
|