11import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
22import org.jetbrains.kotlin.gradle.dsl.JvmTarget
3+ import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
34import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetTree
45import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
56import org.jetbrains.kotlin.konan.target.HostManager
@@ -67,28 +68,86 @@ kotlin {
6768 optIn(" kotlin.RequiresOptIn" )
6869 }
6970 }
70- val commonMain by getting {
71- dependencies {
72- api(project(" :sqllin-driver" ))
73- implementation(libs.kotlinx.serialization)
74- implementation(libs.kotlinx.coroutines)
75- }
71+ commonMain.dependencies {
72+ api(project(" :sqllin-driver" ))
73+ implementation(libs.kotlinx.serialization)
74+ implementation(libs.kotlinx.coroutines)
7675 }
77- val commonTest by getting {
78- dependencies {
79- implementation(kotlin(" test" ))
80- }
76+ commonTest.dependencies {
77+ implementation(kotlin(" test" ))
8178 }
82- val androidInstrumentedTest by getting {
79+ androidInstrumentedTest {
80+ setCommonTestDir()
8381 dependencies {
8482 implementation(libs.androidx.test.core)
8583 implementation(libs.androidx.test.runner)
8684 implementation(libs.androidx.test.rules)
8785 }
8886 }
87+ jvmTest {
88+ setCommonTestDir()
89+ }
90+
91+ iosX64Test {
92+ setNativeTestDir()
93+ }
94+ iosArm64Test {
95+ setNativeTestDir()
96+ }
97+ iosSimulatorArm64Test {
98+ setNativeTestDir()
99+ }
100+
101+
102+ macosX64Test {
103+ setNativeTestDir()
104+ }
105+ macosArm64Test {
106+ setNativeTestDir()
107+ }
108+
109+ watchosX64Test {
110+ setNativeTestDir()
111+ }
112+ watchosArm32Test {
113+ setNativeTestDir()
114+ }
115+ watchosArm64Test {
116+ setNativeTestDir()
117+ }
118+ watchosDeviceArm64Test {
119+ setNativeTestDir()
120+ }
121+ watchosSimulatorArm64Test {
122+ setNativeTestDir()
123+ }
124+
125+ tvosX64Test {
126+ setNativeTestDir()
127+ }
128+ tvosArm64Test {
129+ setNativeTestDir()
130+ }
131+ tvosSimulatorArm64Test {
132+ setNativeTestDir()
133+ }
134+
135+ linuxX64Test {
136+ setNativeTestDir()
137+ }
138+ linuxArm64Test {
139+ setNativeTestDir()
140+ }
141+
142+ mingwX64Test {
143+ setNativeTestDir()
144+ }
89145 }
90146}
91147
148+ fun KotlinSourceSet.setCommonTestDir (vararg path : String ) = kotlin.srcDirs(" src/commonTestCode/kotlin" , path)
149+ fun KotlinSourceSet.setNativeTestDir () = setCommonTestDir(" src/nativeTestCode/kotlin" )
150+
92151gradle.taskGraph.whenReady {
93152 if (! project.hasProperty(" onCICD" ))
94153 return @whenReady
@@ -106,14 +165,14 @@ gradle.taskGraph.whenReady {
106165
107166android {
108167 namespace = " com.ctrip.sqllin.dsl"
109- compileSdk = 34
168+ compileSdk = 35
110169 defaultConfig {
111170 minSdk = 23
112171 testInstrumentationRunner = " androidx.test.runner.AndroidJUnitRunner"
113172 }
114173 compileOptions {
115174 sourceCompatibility = JavaVersion .VERSION_11
116- targetCompatibility = JavaVersion .VERSION_17
175+ targetCompatibility = JavaVersion .VERSION_21
117176 }
118177}
119178
@@ -145,13 +204,15 @@ dependencies {
145204 " kspWatchosX64Test" ,
146205 " kspWatchosArm32Test" ,
147206 " kspWatchosArm64Test" ,
207+ " kspWatchosDeviceArm64Test" ,
148208 " kspWatchosSimulatorArm64Test" ,
149209
150210 " kspTvosX64Test" ,
151211 " kspTvosArm64Test" ,
152212 " kspTvosSimulatorArm64Test" ,
153213
154214 " kspLinuxX64Test" ,
215+ " kspLinuxArm64Test" ,
155216
156217 " kspMingwX64Test" ,
157218 )
0 commit comments