I am working for government and we cannot use GitHub. In order to use SPM I wrote a script that mirrors git repositories from GitHub into our internal bitbucket server. There, I can only use a single space "Vendors" so I have to change the name from i.e. "apple/swift-syntax" to "Vendor/apple.swift-syntax".
While this works for a single package, it won't work for dependencies. I found no way to add some kind of rewrite mechanism to SPM so the next best thing was for me to rewrite the git repositories (EXT -> rewrite -> INT-READONLY). While this works it is very cumbersome and I have to constantly update my binary project that does the rewriting. At least I found a reasonable approach by appending some swift code to the end of each Package*.swift file in each commit in each branch of a repository.
The question I have is:
Am I missing something here? Is there a way to use Xcode, or swift package on a development machine that has no access to the internet?
If not, what is the best way to suggest a feature request and to whom should I send it?
Swedish Police IT Department
Again, without having ever actually used the feature, I believe the workflow looks like:
You mirror https://github.com/pointfreeco/swift-composable-architecture to, say, https://internal-bitbucket-server/pointfreeco-swift-composable-architecture
Your developer runs the following command on their workstation (probably as part of a setup script for the app):
swift package config set-mirror \
--package-url https://github.com/pointfreeco/swift-composable-architecture \
Your developers add https://github.com/pointfreeco/swift-composable-architecture to their Package.swift like normal
When they build their app, Xcode/SPM instead reach out to https://internal-bitbucket-server/pointfreeco-swift-composable-architecture
Note that you'll also have to repeat steps 1 and 2 for every single dependency for https://github.com/pointfreeco/swift-composable-architecture, but the mirroring configuration is on the top level for the app they're building and should apply to all parts of the builds kicked off from that context.
This is difficult, as Xcode doesn't support mirroring. You'll need to break all of your app's dependencies into a separate Package.swift and then use that file as a package in your app. You'd do all the mirroring in that file.
If you place a mirror config in xcshareddata/swiftpm/configuration of the project/workspace in use, it'll be picked up and applied by libSwiftPM. This should work in pretty much any Xcode version for any dependency declared by a package, so any transitive dependencies.
I then opened the Xcode project and used File > Add Package Dependencies... to add https://github.com/apple/swift-argument-parser.git but Xcode just asks me to log into GitHub (which via a proxy will fail). So it looks like the mirror is not used.
In contrast, if I go into Package.swift in the spm package project and add the dependency to https://github.com/apple/swift-argument-parser.git then it will successfully use our internal mirror from the command line:
> swift package update
Fetching ssh://firstname.lastname@example.org:1234/vendor/apple.swift-argument-parser.git from cache
but not if I use Xcode to edit Package.swift:
Conclusion: To me this still looks like Xcode does its very own thing and I cannot use mirroring to solve my proxy problem.