swiftlang / swift-package-manager

The Package Manager for the Swift Programming Language
Apache License 2.0
9.74k stars 1.34k forks source link

[SR-11025] Cyclic Dependencies Crash SwiftPM #4690

Open CodaFi opened 5 years ago

CodaFi commented 5 years ago
Previous ID SR-11025
Radar rdar://problem/52209227
Original Reporter @CodaFi
Type Bug
Environment Apple Swift version 5.1 (swiftlang-1100.0.43.3 clang-1100.0.26.3) Target: x86_64-apple-darwin19.0.0
Additional Detail from JIRA | | | |------------------|-----------------| |Votes | 0 | |Component/s | Package Manager | |Labels | Bug | |Assignee | None | |Priority | Medium | md5: 55f1cdcb5869f5ce9a6f9e45c7c260da

Issue Description:

When the dependency resolver interacts with cyclic dependencies, it crashes SwiftPM. I've created two repositories

https://github.com/CodaFi/Swift-Package-Cycle-One
https://github.com/CodaFi/Swift-Package-Cycle-Two

Each is trivial: A single package file that contains an executable tool with an empty main.swift. The fun of it is that they declare each other as package dependencies, and declare their parallel executable as a target dependency.

aciidgh commented 5 years ago

🙁

At least, pubgrub is detecting it:

swift build --enable-pubgrub-resolver                                                                                                                                           
Updating https://github.com/CodaFi/Swift-Package-Cycle-Two.git
Completed resolution in 0.70s
Cloning https://github.com/CodaFi/Swift-Package-Cycle-Two.git
Resolving https://github.com/CodaFi/Swift-Package-Cycle-Two.git at 0.0.1
error: cyclic dependency declaration found: Swift-Package-Cycle-One -> Swift-Package-Cycle-Two -> Swift-Package-Cycle-One