Reputation: 1844
I've forked a server-side swift package for Firebase realtime db connectivity: ferno and I'm trying to use it as a dependency in my Package.swift
like so:
.package(url: "[email protected]:3sidedcube/ferno.git", .branch("jwt3")),
however when running vapor xcode
I get an error like so:
Error: Could not generate Xcode project: Completed resolution in 8.33s
error: terminated(128): git -C /Users/simonmitchell/Coding/Device-Monitor/.build/checkouts/ferno.git--4002215034454709000 checkout -f 155fa23f2f2d985dbee20072e560b095f61d7b63 output:
I've checked the docs for swift packages and this should all be kosher, so why isn't it working? Is this a limitation of swift package manager? Or of Vapor?
Upvotes: 3
Views: 932
Reputation: 9842
There are times when the package build needs to be cleared or reset to get things back on track. The build can be reset with one of the following:
vapor
vapor clean
vapor update
# Updating [Done]
# Changes to dependencies usually require Xcode to be regenerated.
# Would you like to regenerate your xcode project now?
y/n> y
# Generating Xcode Project [Done]
# Select the `Run` scheme to run.
# Open Xcode project?
y/n> y
# Opening Xcode project...
swift package manager
swift package reset # Reset the complete cache/build directory
swift package update
# Fetching https://github.com/vapor/vapor.git
# Fetching https://github.com/vapor/fluent-sqlite.git
# Fetching [email protected]:3sidedcube/ferno.git
# ...
swift package generate-xcodeproj
# generated: ./Hello.xcodeproj
open Hello.xcodeproj/
manual build removal
rm -Rf .build
rm -Rf Hello.xcodeproj
Also, in my experience, Swift Package Manager .package(url: "[email protected]…)
protocol expects an SSH key pair setup for use with a remote service for both public and private repos. However, the .package(url: "https://github.com…)
protocol does not need this setup because https
provides a secure transport layer.
ssh key pair
If not already done, create and setup a public/private ssh key pair for GitHub. ⇗
~/.ssh/config
### GITHUB-MY-SSH-HOST
### ADD REPOSITORY: [email protected]:_USER_NAME_/_REPOSITORY_NAME_.git
Host github.com-MY-SSH-HOST
HostName github.com
User git
IdentityFile ~/.ssh/github_privatelocal_rsa
UseKeychain yes
AddKeysToAgent yes
PreferredAuthentications publickey
Note: More recent macOS systems require UseKeychain
& AddKeysToAgent
to work with Keychain.app
Package.swift
Expressly declare the defined MY-SSH-HOST
in the package git
command.
.package(url: "[email protected]:3sidedcube-MY-SSH-HOST/ferno.git", .branch("jwt3"))
],
targets: [
.target(name: "App", dependencies: ["FluentSQLite", "Vapor", "Ferno"]),
// …
Upvotes: 2
Reputation: 1844
I have discovered this was simply me not knowing enough about the swift package manager. After deleting the .build
directory and re-trying it all seems to be working properly.
Upvotes: 0