mirai/mirai-core/build.gradle.kts

163 lines
5.3 KiB
Plaintext
Raw Normal View History

2019-11-15 10:39:00 +08:00
@file:Suppress("UNUSED_VARIABLE")
2019-11-06 21:22:23 +08:00
import com.android.build.gradle.api.AndroidSourceSet
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-15 10:39:00 +08:00
`maven-publish`
2019-10-30 23:00:29 +08:00
//id("kotlin-android-extensions")
}
2019-11-15 10:39:00 +08:00
group = "net.mamoe.mirai"
version = "0.1.0"
description = "Mirai core"
2019-10-30 23:00:29 +08:00
val kotlinVersion = rootProject.ext["kotlin_version"].toString()
val atomicFuVersion = rootProject.ext["atomicfu_version"].toString()
val coroutinesVersion = rootProject.ext["coroutines_version"].toString()
val kotlinXIoVersion = rootProject.ext["kotlinxio_version"].toString()
val coroutinesIoVersion = rootProject.ext["coroutinesio_version"].toString()
val klockVersion = rootProject.ext["klock_version"].toString()
val ktorVersion = rootProject.ext["ktor_version"].toString()
2019-11-06 21:22:23 +08:00
kotlin {
android("android") {
project.plugins.apply("com.android.library")
2019-11-15 16:47:39 +08:00
//publishLibraryVariants("release", "debug")
2019-11-06 21:22:23 +08:00
project.android {
compileSdkVersion(29)
buildToolsVersion("29.0.2")
defaultConfig {
minSdkVersion(15)
targetSdkVersion(29)
versionCode = 1
versionName = "1.0"
// testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
getByName("release") {
isMinifyEnabled = false
//proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
}
}
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-15 10:39:00 +08:00
jvm("jvm") {
// withJava()
}
2019-10-30 23:00:29 +08:00
2019-11-06 21:22:23 +08:00
val commonMain = sourceSets["commonMain"].apply {
2019-10-30 23:00:29 +08:00
dependencies {
2019-11-15 10:39:00 +08:00
kotlin("kotlin-reflect", kotlinVersion)
//api("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion")
2019-10-30 23:00:29 +08:00
implementation("com.soywiz.korlibs.klock:klock:$klockVersion")
2019-11-15 10:39:00 +08:00
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-common:$coroutinesVersion")
2019-10-30 23:00:29 +08:00
2019-11-06 21:22:23 +08:00
implementation("io.ktor:ktor-http-cio:$ktorVersion")
implementation("io.ktor:ktor-http:$ktorVersion")
implementation("io.ktor:ktor-client-core-jvm:$ktorVersion")
implementation("io.ktor:ktor-client-cio:$ktorVersion")
2019-10-30 23:00:29 +08:00
2019-11-15 10:39:00 +08:00
//implementation("io.ktor:ktor-io:1.3.0-beta-1")
2019-11-06 21:22:23 +08:00
implementation("io.ktor:ktor-client-core:$ktorVersion")
implementation("io.ktor:ktor-network:$ktorVersion")
2019-10-30 23:00:29 +08:00
}
}
sourceSets["androidMain"].apply {
dependencies {
2019-11-06 21:22:23 +08:00
dependsOn(commonMain)
2019-11-08 20:51:40 +08:00
api("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion")
2019-10-30 23:00:29 +08:00
2019-11-08 19:21:29 +08:00
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion")
2019-10-31 23:11:55 +08:00
implementation("io.ktor:ktor-client-android:$ktorVersion")
2019-10-30 23:00:29 +08:00
}
2019-11-06 21:22:23 +08:00
}
2019-10-30 23:00:29 +08:00
sourceSets["jvmMain"].apply {
dependencies {
2019-11-06 21:22:23 +08:00
dependsOn(commonMain)
2019-11-08 20:51:40 +08:00
2019-10-30 23:00:29 +08:00
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7")
2019-11-08 20:51:40 +08:00
api("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion")
2019-10-30 23:00:29 +08:00
implementation("io.ktor:ktor-client-core-jvm:$ktorVersion")
2019-11-08 20:51:40 +08:00
implementation("org.jetbrains.kotlinx:kotlinx-io-jvm:$kotlinXIoVersion")
2019-10-30 23:00:29 +08:00
}
}
2019-10-31 23:11:55 +08:00
sourceSets["jvmTest"].apply {
2019-11-13 19:49:21 +08:00
dependencies {
}
2019-11-11 21:17:03 +08:00
kotlin.outputDir = file("build/classes/kotlin/jvm/test")
2019-10-31 23:11:55 +08:00
kotlin.setSrcDirs(listOf("src/$name/kotlin"))
2019-11-13 19:49:21 +08:00
2019-10-31 23:11:55 +08:00
}
2019-11-06 21:22:23 +08:00
sourceSets.all {
languageSettings.enableLanguageFeature("InlineClasses")
2019-11-16 00:47:25 +08:00
languageSettings.useExperimentalAnnotation("kotlin.Experimental")
2019-10-30 23:00:29 +08:00
2019-11-06 21:22:23 +08:00
dependencies {
2019-10-30 23:00:29 +08:00
implementation("org.jetbrains.kotlin:kotlin-stdlib")
implementation("org.jetbrains.kotlinx:atomicfu:$atomicFuVersion")
implementation("org.jetbrains.kotlinx:kotlinx-io:$kotlinXIoVersion")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-io:$coroutinesIoVersion")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion")
}
}
2019-11-15 10:39:00 +08:00
sourceSets {
getByName("commonMain") {
dependencies {
implementation(kotlin("reflect"))
}
}
}
2019-10-30 23:00:29 +08:00
}
2019-11-15 10:39:00 +08:00
2019-11-15 16:47:39 +08:00
/*
2019-11-15 10:39:00 +08:00
publishing {
publications.withType<MavenPublication>().apply {
val jvm by getting {}
val metadata by getting { }
}
2019-11-15 16:47:39 +08:00
}*/
2019-11-15 10:39:00 +08:00
/*
publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/mamoe/mirai")
credentials {
val local = loadProperties("local.properties")
username = local["miraiCorePublicationUsername"]?.toString()?:error("Cannot find miraiCorePublicationUsername")
password = local["miraiCorePublicationKey"].toString()?:error("Cannot find miraiCorePublicationKey")
}
}
}
}
fun loadProperties(filename: String): Properties = Properties().apply { load(DataInputStream(rootProject.file(filename).inputStream())) }
*/