Search code examples
iosxcodeproxyswift-package-manager

XCode Swift package manager error behind proxy


We use Swift package manager embedded in XCode for the dependencies in our project. Everything works fine when using it on the local machine. However when I try to build the project on our ci slaves I get the following error (when run from both XCode and the console) :

xcodebuild -resolvePackageDependencies

Resolve Package Graph

Fetching https://github.com/hmlongco/Resolver.git

xcodebuild: error: Could not resolve package dependencies:
  An unknown error occurred 

The difference between running it locally and on the ci slave is that the ci machines are configured behind a proxy. We already whitelisted all the URLs that were accessed when running this command, however the problem still persists. I couldn't find any detailed log about this error.

From examining the network packages sent when I run the command we can still see that some app is trying to access the direct URL instead of going through the proxy and here timeout is received. We only use public packages on github and there isn't any authentication needed.

From other side if the project is set up the old way using Package.swift and we run: swift package resolve the dependencies are successfully resolved without errors.

I have already gone through the following but there wasn't any helpful solution:

Configuration for enterprise networks
XCode proxy settings
SPM in real life projects
Same issue on developer forum
SSH error resolving dependencies - no ssh dependencies

Also there isn't any documentation about how resolving the packages through XCode is different than using 'swift package'. Currently I'm not sure whether it's possible to configure something so XCode uses the proxy settings for SPM or the Xcode SPM through proxy is just not supported. Any ideas? Any help is appreciated!


Solution

  • Turns out there was an easy fix if we just configure the proxy for using it with git:

    Getting Git to work with a proxy server - fails with "Request timed out"