When building complicated SwiftPM-based projects, it's easy to forget to mark dependencies. This results in nondeterministic builds, especially if using incremental building. Attached to this issue is a tar file containing a simple SwiftPM-based project (I've reproduced the salient parts inline below, but to reproduce, just download and extract the attached tar file.)
In the code, A vends a type MyType. Sources/B/MyUser.swift imports A and uses MyType inside MyOtherType. (Note: no dependency is made in Package.swift above. Finally, C depends on both and properly declares the dependencies.
When I build this project clean the first time, I correctly get a compile error. But if I re-build (making zero changes!) once or twice more, I inevitably get a successful build. This reproduces both on Linux and mac, including with toolchains newer than 5.3.
Attachment: Download
Additional Detail from JIRA
| | | |------------------|-----------------| |Votes | 0 | |Component/s | Package Manager | |Labels | Bug | |Assignee | None | |Priority | Medium | md5: fdd57c62922cb379b72d41c2a4322140Issue Description:
When building complicated SwiftPM-based projects, it's easy to forget to mark dependencies. This results in nondeterministic builds, especially if using incremental building. Attached to this issue is a tar file containing a simple SwiftPM-based project (I've reproduced the salient parts inline below, but to reproduce, just download and extract the attached tar file.)
In the code, A vends a type
MyType
.Sources/B/MyUser.swift
importsA
and usesMyType
insideMyOtherType
. (Note: no dependency is made inPackage.swift
above. Finally,C
depends on both and properly declares the dependencies.When I build this project clean the first time, I correctly get a compile error. But if I re-build (making zero changes!) once or twice more, I inevitably get a successful build. This reproduces both on Linux and mac, including with toolchains newer than 5.3.