touchlab / xcode-kotlin

Kotlin Native Xcode Plugin
https://touchlab.co/xcodekotlin
Apache License 2.0
1.15k stars 47 forks source link

Support for multiproject Kotlin builds #102

Closed egk2374 closed 9 months ago

egk2374 commented 9 months ago

Summary

I have a KMM project that has multiple subprojects. I want to add both subprojects to the "Kotlin Debug" group with the plugin. Build and debugging works perfectly when I add commonMain and iosMain from the first subproject, however when I add commonMain from the second subproject build always fails with the message "Multiple commands produce Library/Developer/Xcode/DerivedData/..../MyApp.app/commonMain

Details

I have attempted this by adding all source sets directly in the Kotlin Debug group as well as making nested groups for each subproject and importing source sets inside those groups. The same result occurs with either approach.

Reproduction

Create a KMM project with two subprojects, try to add commonMain source set from both projects into the xcode project.

Expected result

I should be able to build the app with debug support for all Kotlin subprojects.

Current state

I can build the app with debug support for no more than one Kotlin project.

Possible Fix

Screenshots

Issue Labels

TadeasKriz commented 9 months ago

Hi, thanks for the report. Could you check if you're adding the commonMain to the bundle? You shouldn't do that and that'll fix it, because it will no longer copy the directory.

TadeasKriz commented 9 months ago

You can find the target membership by clicking on the commonMain in the project hierarchy and then look at the right panel:

image

Make sure no target is checked.

egk2374 commented 9 months ago

That worked thank you