Package Manager Dependency Mirroring within the consuming App

I've been exploring the package manager dependency mirroring option as described here:

...but might need some help with clarifying expectations around this feature. When I've applied this to one of my own packages via swift package config set-mirror, I've confirmed that the mirroring works as expected, I see my dependencies being fetched from the mirrored locations that are specified in the .swiftpm/config file for that package.

However, I was also hoping this mirroring feature could also apply to the app that's consuming my package. When I add my package to an app as a dependency, none of the mirroring seems to be applied anymore, the additional dependencies that my package brings into the consuming app are still being fetched from the original public GitHub location.

Is it expected that the dependency mirroring would only apply to a project with it's own Package.swift file, and shouldn't be expected to apply to the consuming app that's added the package via Xcode?

Yah, it's expected that the mirror file is only used by the root package or a top level project or workspace in Xcode, but any mirror configurations are not considered if that package is used as a dependency.

This could have been spelled out better in the proposal, but basically the purpose is that dependencies can't "mess with" any dependencies elsewhere in the graph.

Thanks for clarifying, and I can appreciate how it would open the door to different dependencies bringing in conflicting mirrors for the same package, which would make it difficult for the top-level project to decide where to fetch from.

One thing I am hoping you can expand on a bit more... when you say " or a top level project or workspace in Xcode" ... if my consuming app doesn't actually have it's own Package.swift file, and only has a Package.resolved file in the xcworkspace (i.e. just a regular app consuming other packages) ... is there still a way to apply mirroring to that "top level project", even if it's not itself a package?

Terms of Service

Privacy Policy

Cookie Policy