Hi, I imagine this question has already been asked, but after searching I only find messages from ~4 years ago: how do you pin library versions across the whole dev project?
Let's say that we have 5 different components depending on com.github.seancorfield/next.jdbc {:mvn/version "1.2.796"} and you update one component to {:mvn/version "1.3.1070"} . I would like that something in CI (or locally too) fails because the library is not updated everywhere.
Is there any way to enforce that all components in the workspace use the same version? I see that when doing a check or a libs nothing raises an error or a warning.
We could add a warning if libraries are out of sync. We have the https://cljdoc.org/d/polylith/clj-poly/0.2.22/doc/libraries#_updating command that updates all libraries (that are not specified in :keep-lib-versions) to the latest version. Would that command in combination with a warning (that checks all libraries, except those listed in :keep-lib-versions ) solve your problems?
I've seen that, but indeed, I'm more interested in out of sync failure in CI. To enforce updates across all deps.edn However, we are not always interested in updating to the latest.
An example we face currently is the MySQL connector (`mysql/mysql-connector-java`) which made a breaking change for us on version 8.0.23 so we cannot update past 8.0.22 without further refactoring.
Imagine we are everywhere on 8.0.21 and one deps.edn is updated to 8.0.22. I would like to enforce across the whole workspace that everything uses 8.0.22, basically enforcing that whenever the update to 22 is done is done across all deps.edn.
But as this is the example the latest version is 8.0.33 (and 9.4.0 if we look at com.mysql/mysql-connector-j), which we are not interested in.
Okay, so if the poly tool finds the latest used version for all libraries and then make sure that version is used across all deps.edn files, e.g. by calling poly libs sync (not implemented yet) then it would solve your problem? I think we can reuse :keep-lib-versions for the new sync option (if implemented).
For our use case only reporting non-uniform libraries is enough. So there's no need to have to look up which one is newest.
My intuitive idea is to have something like poly libs check (or poly libs :check, or poly check :uniform-libs, not too familiar with the poly tool to give my opinion on that) which reports non-uniform versions.
For our use case we would like to convert this to an error on CI, but maybe somebody else just wants to report (hence no error status code, and just printing would be enough), or some people might want to ignore some known discrepancies.
I'm not familiar with the tool to argue about a specific behaviour, and maybe what you say goes more in line with everything (`poly libs check` which finds the newest one and reports the ones that don't have the newest also).
Just wanted to clarify that the minimal that I find useful is to report discrepancies (without associating a good or bad version), and converting that to an exit status locally or in CI.
Yes, I agree users probably have different needs here. I have a few ideas as well, so let's see if we can get more input from others in this thread!
Yes, we would find it useful to have a way to check for inconsistent lib versions across the workspace. Like the OP, I'm not interested in the keep lib versions or lib update stuff. I have other ways of dealing with version updates. But having poly libs be able to warn about bricks and projects that use the same lib with different versions would be very useful.
What do you think about the suggested solution in issue https://github.com/polyfy/polylith/issues/562? @vacuous_gold_5t @seancorfield
I assume "yellow if :type is set to true" should be "yellow if :type is set to :warning" ?
Yes
The feature as spec'd looks pretty good to me.
I created issue https://github.com/polyfy/polylith/issues/562. Please take a look and see if it meets your needs.
I also have many components depending on common dependencies. Not sure if others like it, but for me the following works. I have a dir in my project libs and there I put shims of common libs. E.g libs/next.jdbc with only a deps.edn pointing to one specific version. Then in the components deps.edn I just have next.jdbc {:local/root "../libs/next.jdbc"}. Now I only have to update next.jdbc in one place.
(Typing from my phone so it is a bit limited)