-
-
Notifications
You must be signed in to change notification settings - Fork 888
🐛 Update manifest entry when dependency source changes #5141
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
| #[test] | ||
| fn resolved_with_updated() { | ||
| #[cfg(test)] | ||
| mod manifest_update_tests { |
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.
this diff is very confusing: I just moved the existing test into a module and added the resolved_with_source_type_change test below it.
lpil
left a comment
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.
Oh thank you!! I was hoping to find time to do this this week. You're too fast for me!
One tiny note inline
compiler-core/src/manifest.rs
Outdated
| for new in &new.packages { | ||
| match old.remove(&new.name) { | ||
| // If the kind of source changed, the packages bear essentially no connection | ||
| Some(old) if discriminant(&old.source) != discriminant(&new.source) => { |
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.
This function is magical and can also result in unexpected behaviour if misused. Please use a normal function with a match expression instead 🙏
pub fn kind(&self) -> ManifestPackageSourceKind {
match &self {
Self::Hex { .. } => ManifestPackageSource::Hex
// ...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.
Trying to be too clever is a habit I'm working to get rid of 😅
Done!
e13cd54 to
f330256
Compare
|
Converting this to a draft until I've addressed a related but different issue: #5132 (comment) |
4cb7490 to
ca7dfd6
Compare
ca7dfd6 to
96de24e
Compare
lpil
left a comment
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.
Amazing! Thank you!!!
Fixes #5132
Fixes #5084
When changing the type of source (like from hex to local), the manifest entry was not updated.
This causes gleam to hit hex for version resolution on each operation, quickly running into API limits.
Additionally, the manifest was not updated if there were only changes in requirements but not packages. This could happen if when changing version constraints or adding/removing a direct dependency to a package that is also a transitive dependency.
For this I split the
Resolvedstruct up, as some usages only cared about the package changes.