New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supporting SwiftPM Generated Xcode Projects #1226

Open
kylef opened this Issue Mar 30, 2016 · 10 comments

Comments

Projects
None yet
6 participants
@kylef
Copy link

kylef commented Mar 30, 2016

⚠️ I wanted to open a discussion, I know it's obviously too soon to actually start supporting this but I wanted to gather feedback and create a discussion around it. ⚠️

In newer versions of SwiftPM you can generate Xcode projects (via swift package generate-xcodeproj) which means that Carthage could potentially detect Package.swift (SwiftPM) and the lack of an Xcode project and then generate the project to use. This would make it far easier for package authors to support Carthage.

Another option could be adding a dependency of Carthage onto SwiftPM as a library, and calling the internals directly to build the the package as a framework for use by Carthage.

@mdiep mdiep added the enhancement label Mar 30, 2016

@mdiep

This comment has been minimized.

Copy link
Member

mdiep commented Mar 30, 2016

That sounds like a fine idea. 👍

@zachhowe

This comment has been minimized.

Copy link

zachhowe commented Oct 10, 2016

I was just thinking this would be very helpful in cases where the repository owner doesn't include a Xcode project file. I may take a look at implementing this.

@kylef

This comment has been minimized.

Copy link

kylef commented Dec 1, 2016

Btw, I've documented how to do this manually at https://fuller.li/posts/using-swift-package-manager-with-carthage/ as a proof of concept.

@ianbytchek

This comment has been minimized.

Copy link

ianbytchek commented Mar 31, 2017

Any plans on implementing this? I'm using some https://github.com/Zewo frameworks, they all appear to use SPM and seem to have good reasons for that. Carthage supporting SPM would be a super useful feature! ❤️

@mdiep

This comment has been minimized.

Copy link
Member

mdiep commented Apr 1, 2017

After talking to the SwiftPM team, I don't think it's a good idea for us to rely on the generated Xcode projects.

@ianbytchek

This comment has been minimized.

Copy link

ianbytchek commented Apr 1, 2017

Can you share the details? Doesn't SwiftPM use the same logic, it obviously doesn't generate the project, but simply compiles all sources, right?

@mdiep

This comment has been minimized.

Copy link
Member

mdiep commented Apr 1, 2017

SwiftPM can compile the sources—but not into a .framework that Carthage can use.

To do that, we'd need to use swift package generate-xcodeproj, which generates an Xcode project based on the package. It's been recommended that we not rely on that.

@couchdeveloper

This comment has been minimized.

Copy link

couchdeveloper commented Apr 2, 2017

Any reasons why the generated Xcode project cannot be recommended? I understand, the development of SwiftPM is in its infancy.

Still, I managed to use Carthage as usual in a project, for a dependency which is originally a Swift package, and this Swift package itself depends on other Swift packages.

The top dependency has a Swift generated Xcode project which has added a pre-build script which calls swift package fetch in order to get the other dependencies. That is, SwiftPM serves solely as a package manager for the underlying dependencies, while Carthage still builds the binaries as frameworks.

The generated Xcode projects works quite well out of the box. The only modification is the addition of the pre-build script. You can take a look at it, here in this fork. The original project is the awesome Genome package - which also provides a different approach to make this library available for Carthage. The reason why I made a fork was a totally different issue, though.

So, with this positive experience, I think you might give auto-generated Xcode projects a try. ;)
Later, we should be able to just use Swift modules. :)

@ianbytchek

This comment has been minimized.

Copy link

ianbytchek commented Apr 2, 2017

I agree that unstable solution is better than no solution, right now we're relying on semi-manual approach. For what it's worth, SwiftPM itself is far from stable, not just generated Xcode projects, which will improve no doubt. Perhaps this could take off as experimental feature and evolve with SwiftPM?

@devxoul devxoul referenced a pull request that will close this issue May 20, 2017

Open

Add support for Swift Package Manager only projects #1945

@devxoul

This comment has been minimized.

Copy link
Contributor

devxoul commented May 20, 2017

Hey guys, I've created a PR(#1945) for this. I hope you guys could review my PR. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment