yonaskolb / yonaskolb/XcodeGen
Project w/ 2 app targets loses linked libraries to 2nd app after Xcode modification
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 8.8k
- Forks
- 908
- Avg merge
- 17d 14h
- Merged PRs (30d)
- 2
Description
I have a moderately complex XcodeGen set up involving multiple internal libraries/frameworks and produces multiple application targets. It works great, until you try to modify the project in Xcode (e.g. by adding a new file). Xcode then ends up stripping the libraries from all but the first application target(!)
Simplified Reproduction
I've created a simplified example project to illustrate the issue:
XcodeGenBugExample.zip
- Download the .zip, use
maketo run xcodegen on the 3 included projects
➜ XcodeGenBugExample
make
⚙️ Generating plists...
⚙️ Generating project...
⚙️ Writing project...
Created project at /Users/mthole/XcodeGenTest/LibraryA/LibraryA.xcodeproj
⚙️ Generating plists...
⚙️ Generating project...
⚙️ Writing project...
Created project at /Users/mthole/XcodeGenTest/LibraryB/LibraryB.xcodeproj
⚙️ Generating plists...
⚙️ Generating project...
⚙️ Writing project...
Created project at /Users/mthole/XcodeGenTest/App/App.xcodeproj
- Open the App.xcodeproj, and examine the
App1andApp2targets. They both link to thelibLibraryA.aandlibLibraryB.alibraries. All is well.


-
Go and add a new .swift file to the App target. (Or do a number of other Xcode operations that trigger whatever re-evaluation is happening...). I added
File.swiftto theApp1andApp2targets. -
Examine the
App1andApp2targets. Notice thatApp2is now missing bothlibLibraryA.aandlibLibraryB.a. Sadface!


We expect App1 and App2 to still be linked to both libraries. Mysteriously, only App1 is!?
Next Steps
I've been using Xcode 12.4. If anyone has any ideas, I'm happy to help investigate further here.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Use the attached XcodeGenBugExample.zip and run make to generate the three projects, then inspect App.xcodeproj with its App1 and App2 targets. Reproduce the issue by adding a Swift file to both targets in Xcode; done means both targets still link libLibraryA.a and libLibraryB.a after the modification.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100