@@ -190,8 +190,7 @@ open class AndroidXComposeMultiplatformExtensionImpl @Inject constructor(
190190 iosArm64(" uikitArm64" )
191191 iosSimulatorArm64(" uikitSimArm64" )
192192
193- val commonMain = sourceSets.getByName(" commonMain" )
194- val nativeMain = sourceSets.create(" nativeMain" )
193+ val nativeMain = getOrCreateNativeMain()
195194 val darwinMain = sourceSets.create(" darwinMain" )
196195 val macosMain = sourceSets.create(" macosMain" )
197196 val macosX64Main = sourceSets.getByName(" macosX64Main" )
@@ -200,7 +199,6 @@ open class AndroidXComposeMultiplatformExtensionImpl @Inject constructor(
200199 val uikitX64Main = sourceSets.getByName(" uikitX64Main" )
201200 val uikitArm64Main = sourceSets.getByName(" uikitArm64Main" )
202201 val uikitSimArm64Main = sourceSets.getByName(" uikitSimArm64Main" )
203- nativeMain.dependsOn(commonMain)
204202 darwinMain.dependsOn(nativeMain)
205203 macosMain.dependsOn(darwinMain)
206204 macosX64Main.dependsOn(macosMain)
@@ -210,8 +208,7 @@ open class AndroidXComposeMultiplatformExtensionImpl @Inject constructor(
210208 uikitArm64Main.dependsOn(uikitMain)
211209 uikitSimArm64Main.dependsOn(uikitMain)
212210
213- val commonTest = sourceSets.getByName(" commonTest" )
214- val nativeTest = sourceSets.create(" nativeTest" )
211+ val nativeTest = getOrCreateNativeTest()
215212 val darwinTest = sourceSets.create(" darwinTest" )
216213 val macosTest = sourceSets.create(" macosTest" )
217214 val macosX64Test = sourceSets.getByName(" macosX64Test" )
@@ -220,7 +217,6 @@ open class AndroidXComposeMultiplatformExtensionImpl @Inject constructor(
220217 val uikitX64Test = sourceSets.getByName(" uikitX64Test" )
221218 val uikitArm64Test = sourceSets.getByName(" uikitArm64Test" )
222219 val uikitSimArm64Test = sourceSets.getByName(" uikitSimArm64Test" )
223- nativeTest.dependsOn(commonTest)
224220 darwinTest.dependsOn(nativeTest)
225221 macosTest.dependsOn(darwinTest)
226222 macosX64Test.dependsOn(macosTest)
@@ -231,12 +227,25 @@ open class AndroidXComposeMultiplatformExtensionImpl @Inject constructor(
231227 uikitSimArm64Test.dependsOn(uikitTest)
232228 }
233229
234- override fun linuxX64 (): Unit = multiplatformExtension.run {
230+ override fun linux (): Unit = multiplatformExtension.run {
235231 linuxX64()
236- }
237-
238- override fun linuxArm64 (): Unit = multiplatformExtension.run {
239232 linuxArm64()
233+
234+ val nativeMain = getOrCreateNativeMain()
235+ val linuxMain = sourceSets.create(" linuxMain" )
236+ val linuxX64Main = sourceSets.getByName(" linuxX64Main" )
237+ val linuxArm64Main = sourceSets.getByName(" linuxArm64Main" )
238+ linuxMain.dependsOn(nativeMain)
239+ linuxX64Main.dependsOn(linuxMain)
240+ linuxArm64Main.dependsOn(linuxMain)
241+
242+ val nativeTest = getOrCreateNativeTest()
243+ val linuxTest = sourceSets.create(" linuxTest" )
244+ val linuxX64Test = sourceSets.getByName(" linuxX64Test" )
245+ val linuxArm64Test = sourceSets.getByName(" linuxArm64Test" )
246+ linuxTest.dependsOn(nativeTest)
247+ linuxX64Test.dependsOn(linuxTest)
248+ linuxArm64Test.dependsOn(linuxTest)
240249 }
241250
242251 private fun getOrCreateJvmMain (): KotlinSourceSet =
@@ -245,6 +254,12 @@ open class AndroidXComposeMultiplatformExtensionImpl @Inject constructor(
245254 private fun getOrCreateJvmTest (): KotlinSourceSet =
246255 getOrCreateSourceSet(" jvmTest" , " commonTest" )
247256
257+ private fun getOrCreateNativeMain (): KotlinSourceSet =
258+ getOrCreateSourceSet(" nativeMain" , " commonMain" )
259+
260+ private fun getOrCreateNativeTest (): KotlinSourceSet =
261+ getOrCreateSourceSet(" nativeTest" , " commonTest" )
262+
248263 private fun getOrCreateSourceSet (
249264 name : String ,
250265 dependsOnSourceSetName : String
0 commit comments