[swift-build-dev] Advice on using SwiftPM for developing large projects

Joe DeCapo snoogansbc at gmail.com
Fri Dec 1 12:35:56 CST 2017

> On Dec 1, 2017, at 7:16 AM, Geordie J via swift-build-dev <swift-build-dev at swift.org> wrote:
> I do appreciate the suggestion though: I will play around with symlinking the various dependencies into the root project’s Sources directory and see if I can get SPM to build them all at that root level without destroying each individual repo’s Package.swift and structure. Although this, again, is a hack, it sounds like the most promising solution for now.

I played around with this and was able to get it to work for some personal projects I've been working on. I have a Vapor app that depends on 2 libraries I made. I'm using the clowder tool I wrote to manage cloning the repositories into the correct location, but you should be able to easily get it to work via symlinks.

Here's the global Package.swift: https://github.com/polka-dot-cat/BugHub-Global/blob/master/Package.swift <https://github.com/polka-dot-cat/BugHub-Global/blob/master/Package.swift>
Here's the clowder.yaml config file: https://github.com/polka-dot-cat/BugHub-clowder/blob/master/versions/global/clowder.yaml <https://github.com/polka-dot-cat/BugHub-clowder/blob/master/versions/global/clowder.yaml>

Here are the commands to clone everything and build:

mkdir BugHub
cd BugHub
clowder init git at github.com:polka-dot-cat/BugHub-clowder.git
clowder link -v global  # This links the custom clowder.yaml version containing this specific setup
clowder herd
cd BugHub-Global
swift build

It successfully built for me and I was still able to maintain the Package.swift files in the individual repositories for when I want to build them there. The Vapor app depends on some resources, so I'd still have to tweak things to get everything working correctly, but I mainly just wanted to see if I could get it to build. It's definitely a bit of a hack, but hopefully this helps.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-build-dev/attachments/20171201/06a0923e/attachment.html>

More information about the swift-build-dev mailing list