We'd like to gather some feedback from the community on the changes to the dependency resolution behavior that would affect tools version 6.0 onward.
We are considering lifting a long-standing requirement that package-level dependencies are not allowed to form cycles in the package graph.
This new behavior would mean that packages can be inter-dependent as long as they don't form cycles between their targets (modules). For example, package A
can depend on package B
and B
on A
as long as their products/targets are not inter-dependent, meaning that a product/target from A
cannot depend on a product from B
if that product directly or indirectly depends on the same product from A
.
We expect this to be a fairly niche use case. Consider eg. testing frameworks - these should be able to depend on other libraries while still allowing those libraries to use the same testing framework. Concretely, it's completely reasonable that swift-foundation
should be able to use swift-testing
to test and swift-testing
use swift-foundation
for underlying functionality.
If you are interested to take a look at the changes involved - [Package/ModuleGraph] Allow cyclic package dependencies if they don't introduce a cycle in a build graph by xedin · Pull Request #7530 · apple/swift-package-manager · GitHub and [PackageGraph] Allow package-level cyclic dependency only for >= 6.0 … by xedin · Pull Request #7579 · apple/swift-package-manager · GitHub
2 posts - 2 participants