-
Notifications
You must be signed in to change notification settings - Fork 1.4k
make package.resolved more deterministic in edge cases #3967
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
motivation: in some cases like two URLs with casing differences, package.resolved could be non-deterministic changes: * make the maanged dependencies location lookup case insensitive * refactor how package.resolved is saved to test for non material differences * adjust call sites that manipulate the pin store to be more efficient about when to save the resolved file * add warning when expected dependency that should be stored in the resolved file is not found * adjust call sites TODO: add tests
… it to compare locations where required * rename LegacyPackageIdentity as PackageIdentityParser and simplify how identity parsing is wired (removed unusued complexity)
1b7138c
to
e37c93b
Compare
@swift-ci smoke test |
@swift-ci please test package compatibility |
Sources/Workspace/Workspace.swift
Outdated
// load the pin store from disk so we can compare for any changes | ||
// this is needed as we want to avoid re-writing the resolved files | ||
// unless absolutely required | ||
guard let storedPinStore = observabilityScope.trap({ try self.pinsStore.load() }) else { |
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.
So if this fails, such as because of an I/O error, would it be better to try to write the new file anyway? I guess I'm questioning whether returning here is the right thing.
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.
are you suggesting we try rewrite if we cant read? I can go with that too
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.
Yes, exactly (I should have been more clear). Since the only reason we're reading it is to avoid unnecessary changes, it seems reasonable to write it out if the read fails. Of course, if it's a permission issue, the write may still fail, but that's a separate issue.
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.
updated e237516
7488194
to
fbbda78
Compare
@swift-ci please smoke test |
@swift-ci please test package compatibility |
} | ||
|
||
observabilityScope.trap{ | ||
// exist early is there is nothing to do |
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.
// exist early is there is nothing to do | |
// exit early if there is nothing to do |
motivation: in some cases like two URLs with casing differences, package.resolved could be non-deterministic changes: * base managed dependencies lookup on canonical location (case insensitive, ignore .git suffix) * refactor how package.resolved is saved to test for non material differences * adjust call sites that manipulate the pin store to be more efficient about when to save the resolved file * add warning when expected dependency that should be stored in the resolved file is not found * rename CanonicalPackageIdentity as CanonicalPackageLocation and use it to compare locations where required * rename LegacyPackageIdentity as PackageIdentityParser and simplify how identity parsing is wired (removed unusued complexity) * adjust call sites * add and adjust test
motivation: in some cases like two URLs with casing differences, package.resolved could be non-deterministic changes: * base managed dependencies lookup on canonical location (case insensitive, ignore .git suffix) * refactor how package.resolved is saved to test for non material differences * adjust call sites that manipulate the pin store to be more efficient about when to save the resolved file * add warning when expected dependency that should be stored in the resolved file is not found * rename CanonicalPackageIdentity as CanonicalPackageLocation and use it to compare locations where required * rename LegacyPackageIdentity as PackageIdentityParser and simplify how identity parsing is wired (removed unusued complexity) * adjust call sites * add and adjust test
motivation: in some cases like two URLs with casing differences, package.resolved could be non-deterministic
changes: