there is no swiftpackageindex.com topic, so i am posting this here.
one of the issues i’m currently running into with the swiftinit.org reference docs is how to model the evolution of package dependency graphs across different package versions/toolchain tags. in particular, i assume that there are two main axes by which different package+version tuples can depend on each other:
-
“spatial” dependency, e.g.
swift-foo @ v0.1.0
depends onswift-bar @ v0.1.3
-
“temporal” dependency, e.g.
swift-foo @ v0.2.0
depends onswift-foo @ v0.1.0
.
obviously we can compute a “spatial” DAG for the ecosystem through the process of dependency resolution, so we can just cross-link API docs by loading the packages’ documentation in the sort-order of the directed graph. and we can do something similar for the temporal axis.
however, it has dawned on me that the combined ecosystem dependency graph for both spatial and temporal dependencies can contain cycles, if the polarity of a dependency reverses between package versions.
Y ← X := “X depends on Y”
1. `png` 3.0.0 depends on `swift-image-tools`
2. `swift-image-tools` depends on `swift-png` 4.0.2
3. `swift-png` 4.0.2 is a newer version of `png`,
which was renamed to `swift-png`
png ←---------- swift-png
3.0.0 4.0.2
↘ ↗
swift-image-tools
0.2.0
since the SPM has no well-behaved notion of package identity, it will not detect the dependency cycle while compiling png
3.0.0, since it considers swift-png
a distinct package. it can end up depending on a future version of itself if, for example, swift-image-tools
overwrites the v0.2.0
git tag which is apparently commonplace enough among the ecosystem that we probably need to handle it.
this sounds like a problem that swiftpackageindex.com may have already encountered, so rather than re-inventing the wheel here, i was wondering how the swiftpackageindex.com site has dealt with this problem, and if any useful insights been learned already?