XcodeGen: SwiftPM dependencies don't link their required dependencies
Adding transitivelyLinkDependencies: true
to my options or target has no effect on the resulting xcode project.
I am depending on SwiftPM packages using the package
dependency type. For instance, I depend on grpc-swift
, which depends on swift-nio
, which itself builds CNIOAtomics
. I can build grpc-swift with xcodegen (project.yml here), and in Xcode I see that it does build CNIOAtomics. Then from Carthage, I try to depend on that grpc-swift (the point of my using xcodegen being Carthage), and there, CNIOAtomics
is missing. So cartage update
works, but building the end project fails with “Missing required module ‘CNIOAtomics’”.
Now, if I add swift-nio
to the packages
of my end project, then it works, suggesting an error with transitive dependencies. I thought that maybe that was because I should set transitivelyLinkDependencies: true
, but this has no effect on the resulting project.pbxproj
.
Am I missing something? Is it wrong to use transitivelyLinkDependencies
with SwiftPM packages?
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 19 (4 by maintainers)
@yonaskolb xcodegen allows adding an SPM dependency, but it does not follow its transitive dependencies, right? Or does it?
My issue here is really that: I add grpc-swift to my Project.yml, and I’m very happy with that. But the resulting xcodeproj lacks the dependencies of grpc-swift.
Does that make any sense at all? I may totally be missing something here…
@JonasVautherin Are you able to list the packages in
dependencies
, without having to add the repository to thepackages
section? If so, that seems like a reasonable workaround for now, similar to what we had to do beforefindCarthageFrameworks
.@JonasVautherin I have a feeling it would be somewhere around https://github.com/yonaskolb/XcodeGen/blob/master/Sources/XcodeGenKit/PBXProjGenerator.swift#L1020-L1023
Though, thinking more about this, a similar thing happens when defining a dependency on a Carthage dependency that itself has another dependency. That isn’t resolved with
transitivelyLinkDependencies
, which only links transitive declare dependencies in parent targets. I think this is currently handled by thefindCarthageFrameworks
for Carthage https://github.com/yonaskolb/XcodeGen/blob/master/Sources/XcodeGenKit/PBXProjGenerator.swift#L605-L608 (though I don’t use it, so maybe it’s not for that).Either way, I think something outside of
transitivelyLinkDependencies
is needed.@yonaskolb Do you have any thoughts on this?
Ahh,
transitivelyLinkDependencies
wasn’t updated to support SwiftPM packages when they were added. I’ll see if I can get around to this in the next couple days.