XcodeGen
XcodeGen copied to clipboard
Not embedding project reference targets in multiple targets
I have a project reference to be embedded in my main project, using its targets, but it only gets embedded in one target.
projectReferences:
MyProject:
path: Projects/MyProject/MyProject.xcodeproj
Targets:
MyTarget:
dependencies:
- target: MyProject/MyProject
link: true
embed: true
MyTargetOne:
dependencies:
- target: MyProject/MyProject
link: true
embed: true
Only one of the targets embeds the dependency.
This is happening with my project too 😕
For me too. The depended targets are embedded only on the alphabetical sorted first target. I have 4 targets, which are defined by a template. The template define the dependencies. The dependencies are only embedded in the first target.
Could I ask this is intended spec.. or bug? Are there any updates?
This is not intended behaviour, and should be treated a bug. I haven't had a chance to look into this. PR's welcome, even if all the PR does is add a test case that demonstrates this.
I just made a project which can reproduce this bug 100%.
When I add a file in TargetExample target, Core framework disappeared.
(cf. When I made the application target to top order of targets in project, the bug doesn't occur.
-> ex. If I change the name TargetExample to 000_TargetExample, Core framework doesn't disappear.)
https://github.com/mqzkim/xcodegen-test
Here are project.yml files below.
Core/project.yml
name: Core
options:
bundleIdPrefix: com.xcodgentest
targets:
Core:
sources: Core
type: framework
platform: iOS
deploymentTarget: "11.0"
Target/project.yml
name: Target
options:
bundleIdPrefix: com.xcodgentest
projectReferences:
Core:
path: ../Core/Core.xcodeproj
targets:
Target:
sources: Target
type: framework
platform: iOS
deploymentTarget: "11.0"
dependencies:
- target: Core/Core
TargetExample:
sources: TargetExample
type: application
platform: iOS
deploymentTarget: "12.0"
dependencies:
- target: Target
- target: Core/Core
This is a screenshot from Target.xcodeproj/project.pbxproj file.
Products has two Core.framework files with different hash.
When I removed one of Core.framework file reference and related codes(38C96BECA2E477A652351E8D), the bug not occurred.
This is not intended behaviour, and should be treated a bug. I haven't had a chance to look into this. PR's welcome, even if all the PR does is add a test case that demonstrates this.
@yonaskolb I just added PR with test case. #1108 Thanks.
Hi, guys! Could you finish this bug fix? The issue is very annoying 😩
This might be related to https://github.com/yonaskolb/XcodeGen/issues/1017 ?
Hi, I have an xcodeproject and I am migrating it using xcodegen. I too have the same issue that is only one of the targets embeds the dependency. However, if I open the original project and generate the new one. I don't have the problem. Could you please let me know the possible reason and the way to overcome this issue without openening original xcodeproject.
Thanks.
I found a solution:
original code:
MyTarget:
dependencies:
- target: MyProject/MyProject
link: true
embed: true
MyTargetOne:
dependencies:
- target: MyProject/MyProject
link: true
embed: true
CHANGE TO:
MyTarget:
dependencies:
- framework: MyProject/MyProject
implicit: true
link: true
embed: true
MyTargetOne:
dependencies:
- framework: MyProject/MyProject
implicit: true
link: true
embed: true
change target to framework, and add implicit: true work well for me.
I can take an other look at this. I would really love to fix this issue. Anyone has more information before I start a deep dive on this? https://github.com/yonaskolb/XcodeGen/pull/1108#issuecomment-1470897451
@zencodex, thank you for sharing. Why do you think your workaround works?
Also, in case somebody knows -> https://github.com/yonaskolb/XcodeGen/issues/1017#issuecomment-1666942673 @yonaskolb