Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-12688] Incorrect builds in the presence of non-trivial dependency trees #4554

Open
swift-ci opened this issue Apr 27, 2020 · 2 comments
Open
Labels

Comments

@swift-ci
Copy link
Contributor

Previous ID SR-12688
Radar rdar://problem/62895060
Original Reporter saeta (JIRA User)
Type Bug

Attachment: Download

Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug
Assignee None
Priority Medium

md5: fdd57c62922cb379b72d41c2a4322140

Issue 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.)

// swift-tools-version:5.1

import PackageDescription

let package = Package(
  name: "Buggy",
  products: [
    .library(name: "A", targets: ["A"]),
    .library(name: "B", targets: ["B"]),
    .library(name: "C", targets: ["C"]),
  ],
  targets: [
    .target(name: "A"),
    .target(name: "B"),
    .target(name: "C", dependencies: ["A", "B"]),
  ]
)

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.

@swift-ci
Copy link
Contributor Author

Comment by Brennan Saeta (JIRA)

I believe the correct way to resolve this issue is via compiler sandboxing: https://forums.swift.org/t/my-swiftpm-wishlist-aka-proposal-proposals/35292/36?u=saeta

@beccadax
Copy link
Contributor

beccadax commented May 5, 2020

@swift-ci create

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants