|
| 1 | +import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask |
| 2 | + |
| 3 | +plugins { |
| 4 | + alias(libs.plugins.kotlinMultiplatform) |
| 5 | + alias(libs.plugins.androidLibrary) |
| 6 | + alias(libs.plugins.kotlinxSerialization) |
| 7 | + alias(libs.plugins.ksp) |
| 8 | +} |
| 9 | + |
| 10 | +kotlin { |
| 11 | + androidTarget { |
| 12 | + compilations.all { |
| 13 | + kotlinOptions { |
| 14 | + jvmTarget = "11" |
| 15 | + } |
| 16 | + } |
| 17 | + } |
| 18 | + |
| 19 | + compilerOptions { |
| 20 | + freeCompilerArgs.add("-Xexpect-actual-classes") |
| 21 | + } |
| 22 | + |
| 23 | + listOf( |
| 24 | + iosX64(), |
| 25 | + iosArm64(), |
| 26 | + iosSimulatorArm64() |
| 27 | + ).forEach { iosTarget -> |
| 28 | + iosTarget.binaries.framework { |
| 29 | + baseName = "ComposeApp" |
| 30 | + isStatic = true |
| 31 | + } |
| 32 | + } |
| 33 | + |
| 34 | + sourceSets { |
| 35 | + commonMain.dependencies { |
| 36 | + implementation(libs.ktor.client.core) |
| 37 | + implementation(libs.ktor.client.content.negotiation) |
| 38 | + implementation(libs.ktor.serialization.kotlinx.json) |
| 39 | + |
| 40 | + implementation(libs.koin.core) |
| 41 | + api(libs.koin.annotations) |
| 42 | + } |
| 43 | + } |
| 44 | + |
| 45 | + // KSP Common sourceSet |
| 46 | + sourceSets.named("commonMain").configure { |
| 47 | + kotlin.srcDir("build/generated/ksp/metadata/commonMain/kotlin") |
| 48 | + } |
| 49 | +} |
| 50 | + |
| 51 | +// KSP Tasks |
| 52 | +dependencies { |
| 53 | + add("kspCommonMainMetadata", libs.koin.ksp.compiler) |
| 54 | + add("kspAndroid", libs.koin.ksp.compiler) |
| 55 | + add("kspIosX64", libs.koin.ksp.compiler) |
| 56 | + add("kspIosArm64", libs.koin.ksp.compiler) |
| 57 | + add("kspIosSimulatorArm64", libs.koin.ksp.compiler) |
| 58 | +} |
| 59 | + |
| 60 | +// KSP Metadata Trigger |
| 61 | +project.tasks.withType(KotlinCompilationTask::class.java).configureEach { |
| 62 | + if(name != "kspCommonMainKotlinMetadata") { |
| 63 | + dependsOn("kspCommonMainKotlinMetadata") |
| 64 | + } |
| 65 | +} |
| 66 | + |
| 67 | +ksp { |
| 68 | + arg("KOIN_CONFIG_CHECK","true") |
| 69 | + arg("KOIN_LOG_TIMES","true") |
| 70 | +} |
| 71 | + |
| 72 | +android { |
| 73 | + namespace = "com.jetbrains.kmpapp.data" |
| 74 | + compileSdk = 34 |
| 75 | + |
| 76 | + sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml") |
| 77 | + sourceSets["main"].res.srcDirs("src/androidMain/res") |
| 78 | + sourceSets["main"].resources.srcDirs("src/commonMain/resources") |
| 79 | + |
| 80 | + defaultConfig { |
| 81 | + minSdk = 24 |
| 82 | + targetSdk = 34 |
| 83 | + } |
| 84 | + packaging { |
| 85 | + resources { |
| 86 | + excludes += "/META-INF/{AL2.0,LGPL2.1}" |
| 87 | + } |
| 88 | + } |
| 89 | + buildTypes { |
| 90 | + getByName("release") { |
| 91 | + isMinifyEnabled = false |
| 92 | + } |
| 93 | + } |
| 94 | + compileOptions { |
| 95 | + sourceCompatibility = JavaVersion.VERSION_11 |
| 96 | + targetCompatibility = JavaVersion.VERSION_11 |
| 97 | + } |
| 98 | + dependencies { |
| 99 | + debugImplementation(libs.androidx.compose.ui.tooling) |
| 100 | + } |
| 101 | +} |
0 commit comments