Skip to content

Conversation

@davidungar
Copy link
Contributor

@davidungar davidungar commented Jul 7, 2021

The status quo reads every swiftmodule file for every input file. This PR fixes that. It is trickier than it seems because, when incremental imports are disabled, every time an initial swiftdeps file is processed, invalidation must happen for every (changed) swiftmodule referenced. So, this fix involves a larger reorganization that it would seem at first blush.

I've tried to include enough comments, etc., so that this code should be understandable.

@davidungar
Copy link
Contributor Author

This PR is my preferred fix for the issue addressed in #742

@davidungar
Copy link
Contributor Author

@swift-ci please test

@davidungar davidungar marked this pull request as draft July 7, 2021 19:18
Copy link
Contributor

@cltnschlosser cltnschlosser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still not super familiar with it all, but most of it makes sense to me now.

@davidungar davidungar marked this pull request as ready for review July 9, 2021 01:06
@davidungar
Copy link
Contributor Author

@swift-ci please test

@davidungar davidungar force-pushed the fix-multi-swiftmodule-read branch from 86e4305 to a7030d7 Compare July 9, 2021 01:09
@davidungar
Copy link
Contributor Author

@swift-ci please test

@davidungar
Copy link
Contributor Author

@cltnschlosser @artemcm @CodaFi , I think this is now ready for a review. Would you care to take a look? It should fix the clean build regression issue in a principled fashion.

@davidungar
Copy link
Contributor Author

@swift-ci please test

Copy link
Contributor

@CodaFi CodaFi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. For 5.5, we could take just the currency cache it seems.

/// Try to read and integrate an external dependency.
/// Return nil if it's not incremental, or if an error occurs.
///
/// Return: nil if an error occurs, or the set of directly affected nodes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit:

/// - Returns:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Fixed.

/// Compute the reason for (non-incrementally) invalidating nodes
///
/// Parameter integrand: The exernal dependency causing the invalidation
/// Returns: nil if no invalidation is needed, otherwise the reason.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, fixed!

// in a as-yet-unread swiftdeps file.
//
// Instead, just compile everything. It's OK to be unsound then because every file will be compiled anyway.
return bulidEmptyGraphAndCompileEverything()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more typo.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, fixed!

@davidungar
Copy link
Contributor Author

@swift-ci please test

@davidungar
Copy link
Contributor Author

@CodaFi Thank you for your prompt review. Let's talk offline about Swift 5.5, I want to get your thoughts on that.

@davidungar davidungar merged commit 63d6636 into swiftlang:main Jul 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants