2020-12-02 09:25:25 +08:00
|
|
|
/*
|
2023-04-23 21:04:31 +08:00
|
|
|
* Copyright 2019-2023 Mamoe Technologies and contributors.
|
2020-12-02 09:25:25 +08:00
|
|
|
*
|
2022-05-17 16:43:09 +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-12-02 09:25:25 +08:00
|
|
|
*
|
2022-05-17 16:43:09 +08:00
|
|
|
* https://github.com/mamoe/mirai/blob/dev/LICENSE
|
2020-12-02 09:25:25 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
@file:Suppress("UNUSED_VARIABLE")
|
|
|
|
|
|
|
|
plugins {
|
2023-04-17 18:40:28 +08:00
|
|
|
id("com.android.library")
|
2020-12-02 09:25:25 +08:00
|
|
|
kotlin("multiplatform")
|
|
|
|
kotlin("plugin.serialization")
|
2021-01-21 10:08:21 +08:00
|
|
|
|
2021-04-14 12:51:44 +08:00
|
|
|
id("kotlinx-atomicfu")
|
2021-12-12 22:37:01 +08:00
|
|
|
id("me.him188.kotlin-jvm-blocking-bridge")
|
2022-06-26 16:03:15 +08:00
|
|
|
// id("me.him188.maven-central-publish")
|
2020-12-02 09:25:25 +08:00
|
|
|
`maven-publish`
|
|
|
|
}
|
|
|
|
|
2021-01-21 10:08:21 +08:00
|
|
|
description = "mirai-core utilities"
|
2020-12-02 09:25:25 +08:00
|
|
|
|
|
|
|
kotlin {
|
|
|
|
explicitApi()
|
2023-04-17 18:40:28 +08:00
|
|
|
apply(plugin = "explicit-api")
|
2020-12-02 09:25:25 +08:00
|
|
|
|
2022-06-11 19:26:45 +08:00
|
|
|
configureJvmTargetsHierarchical()
|
2022-05-29 06:03:13 +08:00
|
|
|
configureNativeTargetsHierarchical(project)
|
2020-12-02 09:25:25 +08:00
|
|
|
|
|
|
|
sourceSets {
|
|
|
|
val commonMain by getting {
|
|
|
|
dependencies {
|
|
|
|
api(kotlin("reflect"))
|
2022-05-17 16:43:09 +08:00
|
|
|
api(`kotlinx-serialization-core`)
|
|
|
|
api(`kotlinx-serialization-json`)
|
|
|
|
api(`kotlinx-coroutines-core`)
|
2020-12-02 09:25:25 +08:00
|
|
|
|
2022-05-17 16:43:09 +08:00
|
|
|
implementation(`kotlinx-serialization-protobuf`)
|
2022-11-27 23:09:20 +08:00
|
|
|
relocateImplementation(`ktor-io_relocated`)
|
2020-12-02 09:25:25 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-16 14:40:57 +08:00
|
|
|
val commonTest by getting {
|
|
|
|
dependencies {
|
2022-05-17 16:43:09 +08:00
|
|
|
api(yamlkt)
|
2022-06-14 19:43:43 +08:00
|
|
|
implementation(`kotlinx-coroutines-test`)
|
2022-05-17 16:43:09 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-06-25 10:40:29 +08:00
|
|
|
findByName("jvmBaseMain")?.apply {
|
2022-05-17 16:43:09 +08:00
|
|
|
dependencies {
|
2022-05-19 03:54:47 +08:00
|
|
|
implementation(`jetbrains-annotations`)
|
2021-08-16 14:40:57 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-06-25 10:40:29 +08:00
|
|
|
findByName("androidMain")?.apply {
|
|
|
|
dependencies {
|
|
|
|
compileOnly(`android-runtime`)
|
2021-09-01 18:51:13 +08:00
|
|
|
// api1(`ktor-client-android`)
|
2020-12-02 09:25:25 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-06-25 10:40:29 +08:00
|
|
|
findByName("jvmMain")?.apply {
|
|
|
|
|
|
|
|
}
|
2020-12-02 09:25:25 +08:00
|
|
|
|
2022-06-25 10:40:29 +08:00
|
|
|
findByName("jvmTest")?.apply {
|
2020-12-02 09:25:25 +08:00
|
|
|
dependencies {
|
2023-04-23 21:04:31 +08:00
|
|
|
implementation(`kotlinx-coroutines-debug`)
|
2020-12-02 09:25:25 +08:00
|
|
|
runtimeOnly(files("build/classes/kotlin/jvm/test")) // classpath is not properly set by IDE
|
|
|
|
}
|
|
|
|
}
|
2022-05-17 16:43:09 +08:00
|
|
|
|
2022-06-25 10:40:29 +08:00
|
|
|
findByName("nativeMain")?.apply {
|
2022-05-17 16:43:09 +08:00
|
|
|
dependencies {
|
2022-05-19 03:54:47 +08:00
|
|
|
// implementation("com.soywiz.korlibs.krypto:krypto:2.4.12") // ':mirai-core-utils:compileNativeMainKotlinMetadata' fails because compiler cannot find reference
|
|
|
|
}
|
|
|
|
}
|
2020-12-02 09:25:25 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-04-17 18:40:28 +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")
|
|
|
|
// }
|
|
|
|
// tasks.getByName("androidTest").dependsOn("checkAndroidApiLevel")
|
|
|
|
//}
|
|
|
|
|
|
|
|
//configureMppPublishing()
|
2022-06-26 16:03:15 +08:00
|
|
|
|
|
|
|
//mavenCentralPublish {
|
|
|
|
// artifactId = "mirai-core-utils"
|
|
|
|
// githubProject("mamoe", "mirai")
|
|
|
|
// developer("Mamoe Technologies", email = "support@mamoe.net", url = "https://github.com/mamoe")
|
|
|
|
// licenseFromGitHubProject("AGPLv3", "dev")
|
|
|
|
// publishPlatformArtifactsInRootModule = "jvm"
|
2023-04-17 18:40:28 +08:00
|
|
|
//}
|
|
|
|
|
|
|
|
android {
|
|
|
|
namespace = "net.mamoe.mirai.utils"
|
|
|
|
}
|