-
-
Notifications
You must be signed in to change notification settings - Fork 777
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
show latest major version available in gleam deps update
#3876
base: main
Are you sure you want to change the base?
Conversation
Hello! Are you still working on this one? Thanks |
I was hoping to work on it this weekend but some things have come up. I can only get back to it next weekend. |
320e39f
to
fa633dc
Compare
300e9eb
to
2f1055d
Compare
Could a flag be provided that forces a non-zero exit-code if major deps updates are available? Would that make sense? The idea would be to have a CI check that goes red if deps are not up to date. |
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.
Very nice! I've left some small notes inline.
compiler-core/src/dependency.rs
Outdated
] | ||
.into_iter() | ||
.collect(), | ||
//requirements: HashMap::new(), |
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.
Unused code here
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.
Haha, this is embarrassing.
PS. Fixed.
let result = runtime_cache.get(package); | ||
|
||
if let Some(result) = result { | ||
return Ok(result.clone()); |
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.
Rather than clone the entire package lets record the highest version here.
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! This function is originally used by the DependencyProvider
. But as the major version need the same info, but to avoid multiple http calls to hexpm, I've added caching here.
I think the way to avoid cloning would be to have PackageFetcher own package (and return a ref) but that would have to touch the dependency resolution part so I didn't want to include in this PR (increased scope).
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.
Here's an implementation with PackageFetcher owning packages and RefCounting: andho@851b9a6
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.
Ah I just realized I never wired up the same PackageFetcher
to be used in other parts of the dependency resolution so the cache is not even used. I'll see about getting that wired up soon.
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.
PackageFetcher
is now passed by reference in all instances and instantiated in list
and download
only.
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.
It would be best to do that as to not clone everything. Do you think it would be complex or involved?
compiler-core/src/dependency.rs
Outdated
let Some(latest) = &hexpackage | ||
.releases | ||
.iter() | ||
.map(|release| release.version.clone()) |
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.
Can take a reference here and avoid cloning
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.
Fixed
compiler-core/src/dependency.rs
Outdated
.sorted_by(|a, b| b.cmp(a)) | ||
.next() |
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.
Using .max
will be faster than sorting and taking the first
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.
Fixed.
compiler-cli/src/dependencies.rs
Outdated
|
||
// lazily assuming the longest version could be 8 characters. eg: 1.1234.2 | ||
// excluding qualifiers other than x.y.z | ||
eprintln!("{name}:{padding} {v1:<8} -> {v2:<8}"); |
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.
Let's render this to a string and then snapshot test the function. This function can then just print the string and not be responsible for formatting and printing
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.
Done.
0781fc3
to
c2e7c65
Compare
@inoas I think the flag would make more sense in a |
…or direct dependencies ✨
…err instead of stdout ♻️
c2e7c65
to
ce0b650
Compare
…cy resolution and major version resolution to reduce network calls to hexpm ♻️
100bf86
to
839318a
Compare
gleam deps update
gleam deps update
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.
Great, thank you.
I gave it a try and while the information is there and useful I don't think it fits in at all with any of the other information printed. How can we show this better?
Should it be shown for all resolution or only for gleam update
? If the latter it would be easier to make a good output format for it.
It makes sense to show for Although it was helpful when I recently did I'd say for an MVP show only in |
Sounds great! |
This PR aims to solve #3843.
The sample output from that issue:
% gleam deps update Resolving versions Downloading packages Downloaded 2 packages in 0.01s Hint: the following dependencies have new major versions available... - wibble@2 - wobble@3
Todos
Handle Async: fireoff the checks and show the results at the end.Didn't make sense to do this.Merge version check into a single callHexpm API doesn't have this. Went with cache instead.