[swift-build-dev] Mini-proposal: relative remote URLs
Ankit Agarwal
ankit at ankit.im
Fri Jan 5 15:00:18 CST 2018
On Fri, Jan 5, 2018 at 12:23 PM, Daniel Dunbar via swift-build-dev <
swift-build-dev at swift.org> wrote:
> I have recently been building up some relatively large package trees (for
> example, porting Boost to build with SwiftPM).
>
> The way I do this is that locally I use remote URLs which are relative to
> the source package. This lets me iterate very quickly without needing to
> push to an origin. Of course, it doesn’t work when pushing them to an
> actual SCM server.
>
> However, what if we allowed relative-path URLs to be resolved relative to
> the *origin* from which SwiftPM found them? Concretely:
>
> If I have:
> github.com/ddunbar/foo
> and it’s Package.swift has:
> dependencies: [.package(url: “../bar”, …)]
> then the idea is to make SwiftPM resolve ../bar to be
> github.com/dunbar/bar, which happens to be exactly what I want.
>
>
On top of my head, this could break in these cases:
1. I fork foo but not bar and now I can't build foo.
2. I "download" foo and have no origin/SCM.
Maybe we should require a fallback base URL?
> This even works for absolute path URLs, the other URL components would
> come from the origin, so I could also reference:
> dependencies: [.package(url: “/apple/swift-package-manager”)]
> if I wanted to depend on SwiftPM.
>
I don't think I understand how would this work. We have no way of computing
the canonical path using the origin in this case.
>
> One really nice thing about this scheme is that it simplifies mirroring of
> trees of packages. For example, if I wanted to clone the above examples
> onto, say, an enterprise SCM server, then as long as I cloned all of them
> into the same relative organization, I wouldn’t need to rewrite any of the
> URL references in the packages themselves during the clone.
>
> Thoughts?
> - Daniel
>
> _______________________________________________
> swift-build-dev mailing list
> swift-build-dev at swift.org
> https://lists.swift.org/mailman/listinfo/swift-build-dev
>
>
--
Ankit
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-build-dev/attachments/20180105/ade66af0/attachment.html>
More information about the swift-build-dev
mailing list