mirai/mirai-core/build.gradle.kts

128 lines
4.3 KiB
Plaintext
Raw Normal View History

2019-11-15 10:39:00 +08:00
@file:Suppress("UNUSED_VARIABLE")
2019-10-30 23:00:29 +08:00
plugins {
id("kotlinx-atomicfu")
kotlin("multiplatform")
2019-11-06 21:22:23 +08:00
id("com.android.library")
2019-11-17 12:52:48 +08:00
id("kotlinx-serialization")
2019-11-15 10:39:00 +08:00
`maven-publish`
2019-11-25 14:15:08 +08:00
id("com.jfrog.bintray") version "1.8.4-jetbrains-3" // DO NOT CHANGE THIS VERSION UNLESS YOU WANT TO WASTE YOUR TIME
2019-10-30 23:00:29 +08:00
}
2019-11-23 22:34:57 +08:00
apply(from = rootProject.file("gradle/publish.gradle"))
2019-11-15 10:39:00 +08:00
2019-11-17 12:52:48 +08:00
val kotlinVersion: String by rootProject.ext
val atomicFuVersion: String by rootProject.ext
val coroutinesVersion: String by rootProject.ext
val kotlinXIoVersion: String by rootProject.ext
val coroutinesIoVersion: String by rootProject.ext
val klockVersion: String by rootProject.ext
val ktorVersion: String by rootProject.ext
val serializationVersion: String by rootProject.ext
2019-12-02 17:57:14 +08:00
fun kotlinx(id: String, version: String) = "org.jetbrains.kotlinx:kotlinx-$id:$version"
2019-10-30 23:00:29 +08:00
2019-12-02 17:57:14 +08:00
fun ktor(id: String, version: String) = "io.ktor:ktor-$id:$version"
2019-11-23 22:34:57 +08:00
2019-12-02 23:04:58 +08:00
description = "QQ protocol library"
2019-10-30 23:00:29 +08:00
2019-11-06 21:22:23 +08:00
kotlin {
android("android") {
2019-11-23 22:34:57 +08:00
publishAllLibraryVariants()
2019-11-06 21:22:23 +08:00
project.android {
compileSdkVersion(29)
2019-11-23 22:34:57 +08:00
2019-11-06 21:22:23 +08:00
defaultConfig {
minSdkVersion(15)
}
2019-11-23 22:34:57 +08:00
// sourceSets.filterIsInstance(com.android.build.gradle.api.AndroidSourceSet::class.java).forEach {
// it.manifest.srcFile("src/androidMain/res/AndroidManifest.xml")
// it.res.srcDirs(file("src/androidMain/res"))
// }
//(sourceSets["main"] as AndroidSourceSet).java.srcDirs(file("src/androidMain/kotlin"))
2019-10-30 23:00:29 +08:00
}
}
2019-11-23 22:34:57 +08:00
jvm("jvm") {
2019-11-06 21:22:23 +08:00
}
2019-10-30 23:00:29 +08:00
2019-11-23 22:34:57 +08:00
sourceSets {
all {
languageSettings.enableLanguageFeature("InlineClasses")
languageSettings.useExperimentalAnnotation("kotlin.Experimental")
2019-11-08 20:51:40 +08:00
2019-11-23 22:34:57 +08:00
dependencies {
api(kotlin("stdlib", kotlinVersion))
api(kotlin("serialization", kotlinVersion))
2019-10-30 23:00:29 +08:00
2019-12-02 17:57:14 +08:00
api("org.jetbrains.kotlinx:atomicfu:$atomicFuVersion")
api(kotlinx("io", kotlinXIoVersion))
api(kotlinx("coroutines-io", coroutinesIoVersion))
api(kotlinx("coroutines-core", coroutinesVersion))
2019-11-23 22:34:57 +08:00
}
2019-10-30 23:00:29 +08:00
}
2019-11-23 22:34:57 +08:00
commonMain {
dependencies {
api(kotlin("reflect", kotlinVersion))
api(kotlin("serialization", kotlinVersion))
2019-12-02 17:57:14 +08:00
api(kotlinx("coroutines-core-common", coroutinesVersion))
api(kotlinx("serialization-runtime-common", serializationVersion))
2019-11-23 22:34:57 +08:00
api("com.soywiz.korlibs.klock:klock:$klockVersion")
2019-12-02 17:57:14 +08:00
api(ktor("http-cio", ktorVersion))
api(ktor("http", ktorVersion))
api(ktor("client-core-jvm", ktorVersion))
api(ktor("client-cio", ktorVersion))
api(ktor("client-core", ktorVersion))
api(ktor("network", ktorVersion))
2019-11-23 22:34:57 +08:00
//implementation("io.ktor:ktor-io:1.3.0-beta-1")
}
2019-11-22 19:10:10 +08:00
}
2019-11-23 22:34:57 +08:00
commonTest {
dependencies {
api(kotlin("test-annotations-common"))
api(kotlin("test-common"))
}
kotlin.setSrcDirs(listOf("src/$name/kotlin"))
2019-11-13 19:49:21 +08:00
}
2019-10-31 23:11:55 +08:00
2019-11-23 22:34:57 +08:00
val androidMain by getting {
dependencies {
api(kotlin("reflect", kotlinVersion))
2019-10-30 23:00:29 +08:00
2019-12-02 17:57:14 +08:00
api(kotlinx("serialization-runtime", serializationVersion))
api(kotlinx("coroutines-android", coroutinesVersion))
2019-11-17 12:52:48 +08:00
2019-12-02 17:57:14 +08:00
api(ktor("client-android", ktorVersion))
2019-11-23 22:34:57 +08:00
}
2019-10-30 23:00:29 +08:00
}
2019-11-23 22:34:57 +08:00
val jvmMain by getting {
2019-11-15 10:39:00 +08:00
dependencies {
2019-12-05 20:12:44 +08:00
//api(kotlin("stdlib-jdk8", kotlinVersion))
//api(kotlin("stdlib-jdk7", kotlinVersion))
2019-11-23 22:34:57 +08:00
api(kotlin("reflect", kotlinVersion))
2019-12-02 17:57:14 +08:00
api(ktor("client-core-jvm", ktorVersion))
api(kotlinx("io-jvm", kotlinXIoVersion))
api(kotlinx("serialization-runtime", serializationVersion))
2019-11-15 10:39:00 +08:00
}
}
2019-11-23 22:34:57 +08:00
val jvmTest by getting {
dependencies {
api(kotlin("test", kotlinVersion))
api(kotlin("test-annotations-common", kotlinVersion))
api(kotlin("test-junit5", kotlinVersion))
api("org.junit.jupiter:junit-jupiter-api:5.5.2")
2019-11-15 10:39:00 +08:00
}
2019-11-23 22:34:57 +08:00
kotlin.outputDir = file("build/classes/kotlin/jvm/test")
kotlin.setSrcDirs(listOf("src/$name/kotlin"))
2019-11-15 10:39:00 +08:00
}
}
2019-11-23 22:34:57 +08:00
}