mirai/mirai-core-api/build.gradle.kts

116 lines
3.4 KiB
Plaintext
Raw Normal View History

2020-11-01 15:07:32 +08:00
/*
* Copyright 2019-2022 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.
2020-11-01 15:07:32 +08:00
*
* https://github.com/mamoe/mirai/blob/dev/LICENSE
2020-11-01 15:07:32 +08:00
*/
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
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")
id("signing")
id("me.him188.kotlin-jvm-blocking-bridge")
id("me.him188.kotlin-dynamic-delegation")
// id("me.him188.maven-central-publish")
2021-01-21 10:08:21 +08:00
2019-12-23 19:31:13 +08:00
`maven-publish`
}
description = "Mirai API module"
2019-12-23 19:31:13 +08:00
kotlin {
explicitApi()
2022-06-11 19:26:45 +08:00
configureJvmTargetsHierarchical()
2022-05-29 06:03:13 +08:00
configureNativeTargetsHierarchical(project)
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 {
api(kotlin("reflect"))
2022-05-17 16:43:09 +08:00
api(`kotlinx-serialization-core`)
api(`kotlinx-serialization-json`)
api(`kotlinx-coroutines-core`) // don't remove it, otherwise IDE will complain
implementation(project(":mirai-core-utils"))
implementation(project(":mirai-console-compiler-annotations"))
2022-05-17 16:43:09 +08:00
implementation(`kotlinx-serialization-protobuf`)
implementation(`kotlinx-atomicfu`)
2022-05-19 01:46:38 +08:00
implementation(`ktor-io`)
2019-12-23 19:31:13 +08:00
}
}
commonTest {
dependencies {
runtimeOnly(`log4j-core`)
2022-06-14 19:43:43 +08:00
implementation(`kotlinx-coroutines-test`)
}
}
findByName("jvmBaseMain")?.apply {
2022-05-17 16:43:09 +08:00
dependencies {
2022-06-11 19:55:25 +08:00
api(`kotlinx-coroutines-jdk8`) // use -jvm modules for this magic target 'jvmBase'
2022-05-17 16:43:09 +08:00
implementation(`jetbrains-annotations`)
implementation(`log4j-api`)
compileOnly(`slf4j-api`)
}
}
findByName("androidMain")?.apply {
dependsOn(commonMain)
dependencies {
compileOnly(`android-runtime`)
2019-12-23 19:31:13 +08:00
}
}
findByName("jvmMain")?.apply {
2019-12-23 19:31:13 +08:00
2021-02-01 12:23:04 +08:00
}
findByName("jvmTest")?.apply {
2019-12-23 19:31:13 +08:00
dependencies {
runtimeOnly(files("build/classes/kotlin/jvm/test")) // classpath is not properly set by IDE
2019-12-23 19:31:13 +08:00
}
}
2022-05-17 16:43:09 +08:00
findByName("nativeMain")?.apply {
2022-05-17 16:43:09 +08:00
dependencies {
}
}
2019-12-23 19:31:13 +08:00
}
2020-02-16 13:54:42 +08:00
}
2020-02-18 13:03:51 +08:00
if (tasks.findByName("androidMainClasses") != null) {
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
}
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()
configureBinaryValidators(setOf("jvm", "android").filterTargets())
configureRelocationForCore()
//mavenCentralPublish {
// artifactId = "mirai-core-api"
// githubProject("mamoe", "mirai")
// developer("Mamoe Technologies", email = "support@mamoe.net", url = "https://github.com/mamoe")
// licenseFromGitHubProject("AGPLv3", "dev")
// publishPlatformArtifactsInRootModule = "jvm"
//}