liquidz / antq

Point out your outdated dependencies.
Other
403 stars 25 forks source link

Allow for downloads of dependencies whilst updating? #132

Closed dharrigan closed 2 years ago

dharrigan commented 2 years ago

Presently, if there are updates to any dependencies, antq will notice the update and modify the deps.edn to show a newer version is available. However, it's not until clj or clojure is launched will the actual resolving and downloading of the updated dependencies occurs (to .m2/....).

Would you consider an option to have antq not only update the deps.edn but also to download to .m2/... the newer dependency (thus saving a step that needs to happen later). It would be an opt-in option, maybe something called :download? which defaults to false. It can be set to to true if the user wishes to update and download the dependencies at the same time (similar to how :force is handled).

My use case of this is that we have a few dependencies that are behind a protected s3 bucket that requires the use of aws-vault exec foo -- clj -X:antq for antq to have access to the appropriate AWS session keys and so on to see if there library updates on the appropriate s3 bucket.

Often 'tho, later on - people forget to do aws-vault exec foo -- clj (and just do clj) and get lots of failures since clj can't download the artifacts (as no AWS session information is then available a they forgot to wrap the command).

It would be nice to have the option to combine the updating of the deps.edn with the downloading of the respective dependency with an opt-in option when using antq, so by doing aws-vault exec foo -- clj -X:antq the update and download happens in one go.

Thank you for your consideration.

-=david=-

liquidz commented 2 years ago

@dharrigan Thanks for your suggestion!

I see what you want to do. In conclusion, I'm willing to implement this feature.

My biggest concern was whether this feature would be a role for antq. The feature downloading deps to .m2 is seemingly not a role for antq, but for example, upgrading deps.edn is a feature for EASY and this is out of the nature of antq.

So, I thought downloading deps to .m2 is also a feture to make it easier to apply new versions, could be considered the same as the feature upgrading deps.edn.

dharrigan commented 2 years ago

Hi!

Thank you for your consideration, what I mean here, is that antq could simply delegate to the clojure tooling (deps) (which antq already uses) to perform the download, rather than implement the same logic itself :-)

liquidz commented 2 years ago

Yes, I'm planning to use tools.deps for downloading deps :)

liquidz commented 2 years ago

@dharrigan Sorry for late action. I've added --download option to feature/download-deps branch. Could you try?

dharrigan commented 2 years ago

Sure, will give it a whirl this morning and let you know :-)

dharrigan commented 2 years ago

Hi, works great. I've done a PR just to add a couple of things in.

One thing to note (perhaps has to be documented?) is that if antq is run as normal (and dependencies are updated) then if it's then run again with --download set, then no download is done (as there are no updates anymore :-) ). It's probably beyond the scope (and too much hassle) to walk through each dependency, checking if it exists on the file system and if not, to download it.

-=david=-

liquidz commented 2 years ago

@dharrigan Thanks for your confirmation!

It's probably beyond the scope (and too much hassle) to walk through each dependency, checking if it exists on the file system and if not, to download it.

I think so too. It is not a role for antq.

One thing to note (perhaps has to be documented?) is that if antq is run as normal (and dependencies are updated) then if it's then run again with --download set, then no download is done (as there are no updates anymore :-) ).

I'll add notes for this behavior :)

liquidz commented 2 years ago

@dharrigan Just released v1.4.0 #142