@@ -6,11 +6,11 @@ import com.github.guilhe.kmp.composeuiviewcontroller.common.FILE_NAME_ARGS
66import com.github.guilhe.kmp.composeuiviewcontroller.common.ModuleMetadata
77import com.github.guilhe.kmp.composeuiviewcontroller.common.TEMP_FILES_FOLDER
88import com.github.guilhe.kmp.composeuiviewcontroller.gradle.KmpComposeUIViewControllerPlugin
9+ import com.github.guilhe.kmp.composeuiviewcontroller.gradle.KmpComposeUIViewControllerPlugin.Companion.ERROR_MISSING_FRAMEWORK_CONFIG
910import com.github.guilhe.kmp.composeuiviewcontroller.gradle.KmpComposeUIViewControllerPlugin.Companion.ERROR_MISSING_KMP
1011import com.github.guilhe.kmp.composeuiviewcontroller.gradle.KmpComposeUIViewControllerPlugin.Companion.ERROR_MISSING_PACKAGE
1112import com.github.guilhe.kmp.composeuiviewcontroller.gradle.KmpComposeUIViewControllerPlugin.Companion.FILE_NAME_SCRIPT_TEMP
1213import com.github.guilhe.kmp.composeuiviewcontroller.gradle.KmpComposeUIViewControllerPlugin.Companion.INFO_MODULE_NAME_BY_FRAMEWORK
13- import com.github.guilhe.kmp.composeuiviewcontroller.gradle.KmpComposeUIViewControllerPlugin.Companion.INFO_MODULE_NAME_BY_PROJECT
1414import com.github.guilhe.kmp.composeuiviewcontroller.gradle.KmpComposeUIViewControllerPlugin.Companion.INFO_MODULE_NAME_BY_SWIFT_EXPORT
1515import com.github.guilhe.kmp.composeuiviewcontroller.gradle.KmpComposeUIViewControllerPlugin.Companion.LIB_ANNOTATIONS_NAME
1616import com.github.guilhe.kmp.composeuiviewcontroller.gradle.KmpComposeUIViewControllerPlugin.Companion.LIB_GROUP
@@ -307,7 +307,7 @@ class PluginTest {
307307 }
308308
309309 @Test
310- fun `Method retrieveFrameworkBaseNamesFromIosTargets handles SwiftExport with fallback to project name as moduleName` () {
310+ fun `Method retrieveFrameworkBaseNamesFromIosTargets throws exception when no moduleName exists ` () {
311311 Templates .createCommonMainSource(projectDir, packageName = " com.test" )
312312
313313 val buildFile = Templates .writeBuildGradle(
@@ -322,7 +322,6 @@ class PluginTest {
322322
323323 kotlin {
324324 iosSimulatorArm64()
325- swiftExport {}
326325 }
327326 """
328327 )
@@ -331,8 +330,8 @@ class PluginTest {
331330 val settingsFile = Templates .writeSettingsGradle(projectDir, rootProjectName = " testProject" )
332331 assertTrue(settingsFile.exists())
333332
334- val result = Templates .runGradle(projectDir)
335- assertTrue(result.output.contains(" $INFO_MODULE_NAME_BY_PROJECT [TestProject] " ))
333+ val result = Templates .runGradle(projectDir, expectFailure = true )
334+ assertTrue(result.output.contains(ERROR_MISSING_FRAMEWORK_CONFIG ))
336335 }
337336
338337 @Test
@@ -394,7 +393,7 @@ class PluginTest {
394393 }
395394
396395 @Test
397- fun `Method retrieveFrameworkBaseNamesFromIosTargets handles SwiftExport with exported module fallback to project name ` () {
396+ fun `Method retrieveFrameworkBaseNamesFromIosTargets handles SwiftExport with exported module with explicit moduleName ` () {
398397 val commonFile = Templates .createCommonMainSource(projectDir, packageName = " com.test" )
399398 assertTrue(commonFile.exists())
400399
@@ -434,7 +433,8 @@ class PluginTest {
434433 swiftExport {
435434 moduleName = "DefaultModule"
436435 export(projects.abc) {
437- flattenPackage = "com.123"
436+ moduleName = "AbcModule"
437+ flattenPackage = "com.abc"
438438 }
439439 }
440440 }
@@ -452,7 +452,7 @@ class PluginTest {
452452
453453 val result = Templates .runGradle(projectDir)
454454 assertTrue(result.output.contains(" $INFO_MODULE_NAME_BY_SWIFT_EXPORT [DefaultModule]" ))
455- assertTrue(result.output.contains(" $INFO_MODULE_NAME_BY_PROJECT [Abc ]" ))
455+ assertTrue(result.output.contains(" $INFO_MODULE_NAME_BY_SWIFT_EXPORT [AbcModule ]" ))
456456 }
457457
458458 @Test
@@ -550,7 +550,9 @@ class PluginTest {
550550
551551 kotlin {
552552 iosSimulatorArm64()
553- swiftExport {}
553+ swiftExport {
554+ moduleName = "TestModule"
555+ }
554556 }
555557 """
556558 )
0 commit comments