|
|
@@ -1,7 +1,9 @@
|
|
|
+import com.android.build.gradle.api.AndroidSourceSet
|
|
|
+
|
|
|
plugins {
|
|
|
id("kotlinx-atomicfu")
|
|
|
kotlin("multiplatform")
|
|
|
- //id("com.android.library")
|
|
|
+ id("com.android.library")
|
|
|
//id("kotlin-android-extensions")
|
|
|
}
|
|
|
|
|
|
@@ -13,75 +15,74 @@ val coroutinesIoVersion = rootProject.ext["coroutinesio_version"].toString()
|
|
|
|
|
|
val klockVersion = rootProject.ext["klock_version"].toString()
|
|
|
val ktorVersion = rootProject.ext["ktor_version"].toString()
|
|
|
-/*
|
|
|
-//apply()
|
|
|
-android {
|
|
|
- compileSdkVersion(29)
|
|
|
- buildToolsVersion("29.0.2")
|
|
|
- defaultConfig {
|
|
|
- applicationId = "com.youngfeng.kotlindsl"
|
|
|
- minSdkVersion(15)
|
|
|
- targetSdkVersion(27)
|
|
|
- versionCode = 1
|
|
|
- versionName = "1.0"
|
|
|
- // testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner"
|
|
|
- }
|
|
|
|
|
|
- buildTypes {
|
|
|
- getByName("release") {
|
|
|
- isMinifyEnabled = true
|
|
|
- //proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
|
|
|
+kotlin {
|
|
|
+ android("android") {
|
|
|
+ project.plugins.apply("com.android.library")
|
|
|
+
|
|
|
+ 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"))
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- sourceSets.forEach {
|
|
|
- println(it)
|
|
|
- // it.languageSettings.enableLanguageFeature("InlineClasses")
|
|
|
- }
|
|
|
-}
|
|
|
-*/
|
|
|
-kotlin {
|
|
|
- // android("android")
|
|
|
jvm("jvm")
|
|
|
|
|
|
- sourceSets["commonMain"].apply {
|
|
|
+ val commonMain = sourceSets["commonMain"].apply {
|
|
|
dependencies {
|
|
|
-
|
|
|
- implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion")
|
|
|
-
|
|
|
+ api("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion")
|
|
|
implementation("com.soywiz.korlibs.klock:klock:$klockVersion")
|
|
|
|
|
|
- api("io.ktor:ktor-client-core:$ktorVersion")
|
|
|
- api("io.ktor:ktor-network:$ktorVersion")
|
|
|
- api("io.ktor:ktor-http:$ktorVersion")
|
|
|
+ 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")
|
|
|
|
|
|
+ implementation("io.ktor:ktor-client-core:$ktorVersion")
|
|
|
+ implementation("io.ktor:ktor-network:$ktorVersion")
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /*
|
|
|
sourceSets["androidMain"].apply {
|
|
|
dependencies {
|
|
|
+ dependsOn(commonMain)
|
|
|
implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion")
|
|
|
|
|
|
- implementation("io.ktor:ktor-http:$ktorVersion")
|
|
|
- implementation("io.ktor:ktor-client-core:$ktorVersion")
|
|
|
implementation("io.ktor:ktor-client-android:$ktorVersion")
|
|
|
|
|
|
}
|
|
|
languageSettings.enableLanguageFeature("InlineClasses")
|
|
|
- }*/
|
|
|
+ }
|
|
|
|
|
|
sourceSets["jvmMain"].apply {
|
|
|
dependencies {
|
|
|
+ dependsOn(commonMain)
|
|
|
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
|
|
|
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7")
|
|
|
|
|
|
implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion")
|
|
|
|
|
|
- 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")
|
|
|
|
|
|
}
|
|
|
}
|
|
|
@@ -90,10 +91,10 @@ kotlin {
|
|
|
kotlin.setSrcDirs(listOf("src/$name/kotlin"))
|
|
|
}
|
|
|
|
|
|
- sourceSets.forEach {
|
|
|
- it.languageSettings.enableLanguageFeature("InlineClasses")
|
|
|
+ sourceSets.all {
|
|
|
+ languageSettings.enableLanguageFeature("InlineClasses")
|
|
|
|
|
|
- it.dependencies {
|
|
|
+ dependencies {
|
|
|
implementation("org.jetbrains.kotlin:kotlin-stdlib")
|
|
|
implementation("org.jetbrains.kotlinx:atomicfu:$atomicFuVersion")
|
|
|
implementation("org.jetbrains.kotlinx:kotlinx-io:$kotlinXIoVersion")
|