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-3164] Save previous swiftdeps files during a build #45752

Closed
belkadan opened this issue Nov 9, 2016 · 3 comments
Closed

[SR-3164] Save previous swiftdeps files during a build #45752

belkadan opened this issue Nov 9, 2016 · 3 comments

Comments

@belkadan
Copy link
Contributor

@belkadan belkadan commented Nov 9, 2016

Previous ID SR-3164
Radar None
Original Reporter @belkadan
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, Driver, StarterBug
Assignee @modocache
Priority Medium

md5: 39ac8470de717c1a23eb228c5bf25162

Issue Description:

The Swift compiler uses files with an extension of ".swiftdeps" to store information about cross-file dependencies within a single module, plus an extra "swiftdeps" file for the "build record" (information about the whole compilation). These files are read in at the start of compilation to compute a dependency graph, and updated (and re-read) as compilation proceeds. However, because these files are updated on every build, an issue with dependency analysis is hard to reproduce—the inputs have been lost.

A simple answer for this that will help in the common case is to move the previous swiftdeps file aside just before writing the new one. I'd suggest just renaming them from "foo.swiftdeps" to "foo.swiftdeps~". If this fails for any reason, just ignore the failure and continue on. (Maybe the directory isn't writable, only the one file. Maybe this is the first build. Maybe the user write-protected the previous "foo.swiftdeps~" for some reason.)

The LLVM APIs to mess with the filesystem are in "llvm/Support/FileSystem.h"; the one I'd expect to use is llvm::sys::fs::rename.

@modocache
Copy link
Mannequin

@modocache modocache mannequin commented Nov 14, 2016

I'd like to try my hand at this, if that's alright. 🙂

@modocache
Copy link
Mannequin

@modocache modocache mannequin commented Nov 16, 2016

@belkadan, hopefully this is what you had in mind: #5816

This doesn't do anything special with '.d' output files. Should those be preserved as '.d~' as well?

@modocache
Copy link
Mannequin

@modocache modocache mannequin commented Nov 18, 2016

Thanks for the starter task, Jordan! I think this one is done.

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

No branches or pull requests

1 participant