-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Serialization for Incremental Swift Dependency Information #34073
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
Conversation
Take advantage of the binary swiftdeps serialization utliities built during swiftlang#32131. Add a new optional information block to swiftdeps files. For now, don't actually serialize swiftdeps information. Frontends will use this information to determine whether to write incremental dependencies across modules into their swiftdeps files. We will then teach the driver to deserialize the data from this section and integrate it into its incremental decision making.
This has the net effect of only recording cross-module dependency information in the current module if the module under scrutiny can possibly provide dependency information of its own. For now, because none of this is turned on, this does not actually record additional dependencies from extant modules.
Invert the responsibility of the entrypoint so that FrontendTool is directing the actual serialization work. The entrypoint now solely exists to construct a dependency graph. While I'm here, prepare the way for serializing dependency graphs for modules by optimistically modeling a ModuleOrSourceFile input.
@swift-ci smoke test |
⛵ |
g.emitDotFile(outputPath, diags); | ||
|
||
return hadError; | ||
bool fine_grained_dependencies::withReferenceDependencies( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this function do with the reference dependencies?
It looks like in constructs the graph and passes that to the continuation, is that right?
In any event, (in some future PR), a very in the name would aid comprehension.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, after seeing the use, I understand the name better. But the current name still doesn't reveal that this function builds the graph.
SF, *Instance.getDependencyTracker(), outputPath, alsoEmitDotFile, | ||
[&](SourceFileDepGraph &&g) -> bool { | ||
const bool hadError = | ||
fine_grained_dependencies::writeFineGrainedDependencyGraphToPath( | ||
Instance.getDiags(), outputPath, g); | ||
|
||
// If path is stdout, cannot read it back, so check for "-" | ||
assert(outputPath == "-" || g.verifyReadsWhatIsWritten(outputPath)); | ||
|
||
if (alsoEmitDotFile) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is alsoEmitDotFile being passed needlessly to withReferenceDependencies
?
Very cool! |
This completes the missing piece from swiftlang#34073 and means the frontend may now serialize moduledecl-based dependencies.
This doesn't turn anything on yet, it just moves the necessary pieces into place.