|
|
@@ -1,20 +1,15 @@
|
|
|
@file:Suppress("UNUSED_VARIABLE")
|
|
|
|
|
|
-import com.android.build.gradle.api.AndroidSourceSet
|
|
|
-
|
|
|
plugins {
|
|
|
id("kotlinx-atomicfu")
|
|
|
kotlin("multiplatform")
|
|
|
id("com.android.library")
|
|
|
id("kotlinx-serialization")
|
|
|
-
|
|
|
`maven-publish`
|
|
|
+ id("com.jfrog.bintray") version "1.8.4-jetbrains-3"
|
|
|
}
|
|
|
|
|
|
-group = "net.mamoe.mirai"
|
|
|
-version = "0.1.0"
|
|
|
-
|
|
|
-description = "Mirai core"
|
|
|
+apply(from = rootProject.file("gradle/publish.gradle"))
|
|
|
|
|
|
val kotlinVersion: String by rootProject.ext
|
|
|
val atomicFuVersion: String by rootProject.ext
|
|
|
@@ -27,166 +22,107 @@ val ktorVersion: String by rootProject.ext
|
|
|
|
|
|
val serializationVersion: String by rootProject.ext
|
|
|
|
|
|
-fun org.jetbrains.kotlin.gradle.plugin.KotlinDependencyHandler.kotlinx(id: String, version: String) {
|
|
|
- implementation("org.jetbrains.kotlinx:$id:$version")
|
|
|
-}
|
|
|
+fun kotlinx(id: String, version: String) = "org.jetbrains.kotlinx:$id:$version"
|
|
|
|
|
|
-fun org.jetbrains.kotlin.gradle.plugin.KotlinDependencyHandler.ktor(id: String, version: String) {
|
|
|
- implementation("io.ktor:$id:$version")
|
|
|
-}
|
|
|
+fun ktor(id: String, version: String) = "io.ktor:$id:$version"
|
|
|
+
|
|
|
+
|
|
|
+description = "Tencent QQ protocol library"
|
|
|
|
|
|
kotlin {
|
|
|
android("android") {
|
|
|
- project.plugins.apply("com.android.library")
|
|
|
- //publishLibraryVariants("release", "debug")
|
|
|
+ publishAllLibraryVariants()
|
|
|
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"))
|
|
|
- }
|
|
|
- }
|
|
|
- jvm("jvm") {
|
|
|
- // withJava()
|
|
|
- }
|
|
|
-
|
|
|
- /*
|
|
|
- val proto = sourceSets["proto"].apply {
|
|
|
-
|
|
|
- }*/
|
|
|
-
|
|
|
- val commonMain = sourceSets["commonMain"].apply {
|
|
|
- dependencies {
|
|
|
- kotlin("kotlin-reflect", kotlinVersion)
|
|
|
- //kotlin("kotlin-serialization", kotlinVersion)
|
|
|
-
|
|
|
- kotlinx("kotlinx-coroutines-core-common", coroutinesVersion)
|
|
|
- kotlinx("kotlinx-serialization-runtime-common", serializationVersion)
|
|
|
-
|
|
|
- api("com.soywiz.korlibs.klock:klock:$klockVersion")
|
|
|
-
|
|
|
- ktor("ktor-http-cio", ktorVersion)
|
|
|
- ktor("ktor-http", ktorVersion)
|
|
|
- ktor("ktor-client-core-jvm", ktorVersion)
|
|
|
- ktor("ktor-client-cio", ktorVersion)
|
|
|
- ktor("ktor-client-core", ktorVersion)
|
|
|
- ktor("ktor-network", ktorVersion)
|
|
|
- //implementation("io.ktor:ktor-io:1.3.0-beta-1")
|
|
|
+ // 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"))
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- sourceSets["androidMain"].apply {
|
|
|
- dependencies {
|
|
|
- dependsOn(commonMain)
|
|
|
-
|
|
|
- kotlin("kotlin-reflect", kotlinVersion)
|
|
|
-
|
|
|
- kotlinx("kotlinx-serialization-runtime", serializationVersion)
|
|
|
- kotlinx("kotlinx-coroutines-android", coroutinesVersion)
|
|
|
-
|
|
|
- ktor("ktor-client-android", ktorVersion)
|
|
|
- }
|
|
|
+ jvm("jvm") {
|
|
|
}
|
|
|
|
|
|
- sourceSets["jvmMain"].apply {
|
|
|
- dependencies {
|
|
|
- dependsOn(commonMain)
|
|
|
+ sourceSets {
|
|
|
+ all {
|
|
|
+ languageSettings.enableLanguageFeature("InlineClasses")
|
|
|
+ languageSettings.useExperimentalAnnotation("kotlin.Experimental")
|
|
|
|
|
|
- kotlin("kotlin-stdlib-jdk8", kotlinVersion)
|
|
|
- kotlin("kotlin-stdlib-jdk7", kotlinVersion)
|
|
|
- kotlin("kotlin-reflect", kotlinVersion)
|
|
|
+ dependencies {
|
|
|
+ api(kotlin("stdlib", kotlinVersion))
|
|
|
+ api(kotlin("serialization", kotlinVersion))
|
|
|
|
|
|
- ktor("ktor-client-core-jvm", ktorVersion)
|
|
|
- kotlinx("kotlinx-io-jvm", kotlinXIoVersion)
|
|
|
- kotlinx("kotlinx-serialization-runtime", serializationVersion)
|
|
|
+ api(kotlinx("atomicfu", atomicFuVersion))
|
|
|
+ api(kotlinx("kotlinx-io", kotlinXIoVersion))
|
|
|
+ api(kotlinx("kotlinx-coroutines-io", coroutinesIoVersion))
|
|
|
+ api(kotlinx("kotlinx-coroutines-core", coroutinesVersion))
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- sourceSets["commonTest"].apply {
|
|
|
- dependencies {
|
|
|
- kotlin("kotlin-test-annotations-common")
|
|
|
- kotlin("kotlin-test-common")
|
|
|
+ commonMain {
|
|
|
+ dependencies {
|
|
|
+ api(kotlin("reflect", kotlinVersion))
|
|
|
+ api(kotlin("serialization", kotlinVersion))
|
|
|
+ api(kotlinx("kotlinx-coroutines-core-common", coroutinesVersion))
|
|
|
+ api(kotlinx("kotlinx-serialization-runtime-common", serializationVersion))
|
|
|
+
|
|
|
+ api("com.soywiz.korlibs.klock:klock:$klockVersion")
|
|
|
+
|
|
|
+ api(ktor("ktor-http-cio", ktorVersion))
|
|
|
+ api(ktor("ktor-http", ktorVersion))
|
|
|
+ api(ktor("ktor-client-core-jvm", ktorVersion))
|
|
|
+ api(ktor("ktor-client-cio", ktorVersion))
|
|
|
+ api(ktor("ktor-client-core", ktorVersion))
|
|
|
+ api(ktor("ktor-network", ktorVersion))
|
|
|
+ //implementation("io.ktor:ktor-io:1.3.0-beta-1")
|
|
|
+ }
|
|
|
}
|
|
|
- kotlin.setSrcDirs(listOf("src/$name/kotlin"))
|
|
|
- }
|
|
|
-
|
|
|
- sourceSets["jvmTest"].apply {
|
|
|
- dependencies {
|
|
|
- kotlin("kotlin-test", kotlinVersion)
|
|
|
- kotlin("kotlin-test-annotations-common", kotlinVersion)
|
|
|
- kotlin("kotlin-test-junit5", kotlinVersion)
|
|
|
- implementation("org.junit.jupiter:junit-jupiter-api:5.5.2")
|
|
|
+ commonTest {
|
|
|
+ dependencies {
|
|
|
+ api(kotlin("test-annotations-common"))
|
|
|
+ api(kotlin("test-common"))
|
|
|
+ }
|
|
|
+ kotlin.setSrcDirs(listOf("src/$name/kotlin"))
|
|
|
}
|
|
|
- kotlin.outputDir = file("build/classes/kotlin/jvm/test")
|
|
|
- kotlin.setSrcDirs(listOf("src/$name/kotlin"))
|
|
|
- }
|
|
|
|
|
|
- sourceSets.all {
|
|
|
- languageSettings.enableLanguageFeature("InlineClasses")
|
|
|
- languageSettings.useExperimentalAnnotation("kotlin.Experimental")
|
|
|
+ val androidMain by getting {
|
|
|
+ dependencies {
|
|
|
+ api(kotlin("reflect", kotlinVersion))
|
|
|
|
|
|
- dependencies {
|
|
|
- kotlin("kotlin-stdlib", kotlinVersion)
|
|
|
- kotlin("kotlin-serialization", kotlinVersion)
|
|
|
+ api(kotlinx("kotlinx-serialization-runtime", serializationVersion))
|
|
|
+ api(kotlinx("kotlinx-coroutines-android", coroutinesVersion))
|
|
|
|
|
|
- kotlinx("atomicfu", atomicFuVersion)
|
|
|
- kotlinx("kotlinx-io", kotlinXIoVersion)
|
|
|
- kotlinx("kotlinx-coroutines-io", coroutinesIoVersion)
|
|
|
- kotlinx("kotlinx-coroutines-core", coroutinesVersion)
|
|
|
+ api(ktor("ktor-client-android", ktorVersion))
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- sourceSets {
|
|
|
- getByName("commonMain") {
|
|
|
+
|
|
|
+ val jvmMain by getting {
|
|
|
dependencies {
|
|
|
- implementation(kotlin("reflect"))
|
|
|
+ api(kotlin("stdlib-jdk8", kotlinVersion))
|
|
|
+ api(kotlin("stdlib-jdk7", kotlinVersion))
|
|
|
+ api(kotlin("reflect", kotlinVersion))
|
|
|
+
|
|
|
+ api(ktor("ktor-client-core-jvm", ktorVersion))
|
|
|
+ api(kotlinx("kotlinx-io-jvm", kotlinXIoVersion))
|
|
|
+ api(kotlinx("kotlinx-serialization-runtime", serializationVersion))
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
-}
|
|
|
|
|
|
-/*
|
|
|
-publishing {
|
|
|
- publications.withType<MavenPublication>().apply {
|
|
|
- val jvm by getting {}
|
|
|
- val metadata by getting { }
|
|
|
- }
|
|
|
-}*/
|
|
|
-
|
|
|
-/*
|
|
|
-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")
|
|
|
+ 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")
|
|
|
}
|
|
|
+ kotlin.outputDir = file("build/classes/kotlin/jvm/test")
|
|
|
+ kotlin.setSrcDirs(listOf("src/$name/kotlin"))
|
|
|
}
|
|
|
}
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-fun loadProperties(filename: String): Properties = Properties().apply { load(DataInputStream(rootProject.file(filename).inputStream())) }
|
|
|
-*/
|
|
|
+}
|