1
+ plugins {
2
+ alias(libs.plugins.kotlin.multiplatform)
3
+ alias(libs.plugins.android.kotlin.multiplatform.library)
4
+ alias(libs.plugins.android.lint)
5
+ }
6
+
7
+ kotlin {
8
+
9
+ // Target declarations - add or remove as needed below. These define
10
+ // which platforms this KMP module supports.
11
+ // See: https://kotlinlang.org/docs/multiplatform-discover-project.html#targets
12
+ androidLibrary {
13
+ namespace = " com.example.kmp.kmp_shared"
14
+ compileSdk = 36
15
+ minSdk = 24
16
+
17
+ withHostTestBuilder {
18
+ }
19
+
20
+ withDeviceTestBuilder {
21
+ sourceSetTreeName = " test"
22
+ }.configure {
23
+ instrumentationRunner = " androidx.test.runner.AndroidJUnitRunner"
24
+ }
25
+ }
26
+
27
+ // For iOS targets, this is also where you should
28
+ // configure native binary output. For more information, see:
29
+ // https://kotlinlang.org/docs/multiplatform-build-native-binaries.html#build-xcframeworks
30
+
31
+ // A step-by-step guide on how to include this library in an XCode
32
+ // project can be found here:
33
+ // https://developer.android.com/kotlin/multiplatform/migrate
34
+ val xcfName = " kmp-sharedKit"
35
+
36
+ iosX64 {
37
+ binaries.framework {
38
+ baseName = xcfName
39
+ }
40
+ }
41
+
42
+ iosArm64 {
43
+ binaries.framework {
44
+ baseName = xcfName
45
+ }
46
+ }
47
+
48
+ iosSimulatorArm64 {
49
+ binaries.framework {
50
+ baseName = xcfName
51
+ }
52
+ }
53
+
54
+ // Source set declarations.
55
+ // Declaring a target automatically creates a source set with the same name. By default, the
56
+ // Kotlin Gradle Plugin creates additional source sets that depend on each other, since it is
57
+ // common to share sources between related targets.
58
+ // See: https://kotlinlang.org/docs/multiplatform-hierarchy.html
59
+ sourceSets {
60
+ commonMain {
61
+ dependencies {
62
+ implementation(libs.jetbrains.kotlin.stdlib)
63
+ // Add KMP dependencies here
64
+ }
65
+ }
66
+
67
+ commonTest {
68
+ dependencies {
69
+ implementation(libs.kotlin.test)
70
+ }
71
+ }
72
+
73
+ androidMain {
74
+ dependencies {
75
+ // Add Android-specific dependencies here. Note that this source set depends on
76
+ // commonMain by default and will correctly pull the Android artifacts of any KMP
77
+ // dependencies declared in commonMain.
78
+ }
79
+ }
80
+
81
+ getByName(" androidDeviceTest" ) {
82
+ dependencies {
83
+ implementation(libs.androidx.test.runner)
84
+ implementation(libs.androidx.test.core)
85
+ implementation(libs.androidx.test.ext.junit)
86
+ }
87
+ }
88
+
89
+ iosMain {
90
+ dependencies {
91
+ // Add iOS-specific dependencies here. This a source set created by Kotlin Gradle
92
+ // Plugin (KGP) that each specific iOS target (e.g., iosX64) depends on as
93
+ // part of KMP’s default source set hierarchy. Note that this source set depends
94
+ // on common by default and will correctly pull the iOS artifacts of any
95
+ // KMP dependencies declared in commonMain.
96
+ }
97
+ }
98
+ }
99
+
100
+ }
0 commit comments