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

111 lines
3.2 KiB
Plaintext
Raw Normal View History

2020-12-02 09:25:25 +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 {
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")
id("me.him188.kotlin-jvm-blocking-bridge")
// 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()
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`)
relocateImplementation(`ktor-io_relocated`)
2020-12-02 09:25:25 +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
}
}
findByName("jvmBaseMain")?.apply {
2022-05-17 16:43:09 +08:00
dependencies {
2022-05-19 03:54:47 +08:00
implementation(`jetbrains-annotations`)
}
}
findByName("androidMain")?.apply {
dependencies {
compileOnly(`android-runtime`)
// api1(`ktor-client-android`)
2020-12-02 09:25:25 +08:00
}
}
findByName("jvmMain")?.apply {
}
2020-12-02 09:25:25 +08:00
findByName("jvmTest")?.apply {
2020-12-02 09:25:25 +08:00
dependencies {
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
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
}
}
//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()
//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"
//}
android {
namespace = "net.mamoe.mirai.utils"
}