-
Notifications
You must be signed in to change notification settings - Fork 455
Deduplicate solver errors when generating portable lockdirs #12642
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
bin/pkg/lock.ml
Outdated
| Platforms_by_message.to_list platforms_by_message | ||
| |> List.map ~f:(fun (solver_error, platforms) -> | ||
| Pp.concat | ||
| ~sep:Pp.newline |
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.
Don't use Pp.newline as it messes up various things that consume user messages. Instead do a break and wrap in a vertical box. You can also use Pp.concat_map with a hovbox so that each line sits sensibly.
bin/pkg/lock.ml
Outdated
| @@ Pp.textf | ||
| "Unable to solve dependencies while generating lock directory: %s" | ||
| (Path.to_string_maybe_quoted path) | ||
| ; Pp.hovbox (Pp.concat ~sep:Pp.newline (pp_solve_errors_by_platforms errors)) |
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.
Same comment about Pp.newline even though it was around before.
bin/pkg/lock.ml
Outdated
| @ List.concat_map errors ~f:(fun (path, errors) -> | ||
| let messages = Platforms_by_message.all_messages errors in | ||
| [ Pp.textf "Lock directory %s:" (Path.to_string_maybe_quoted path) | ||
| ; Pp.hovbox (Pp.concat ~sep:Pp.newline messages) |
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.
And here
test/blackbox-tests/test-cases/pkg/portable-lockdirs/portable-lockdirs-no-solution.t
Show resolved
Hide resolved
test/blackbox-tests/test-cases/pkg/portable-lockdirs/portable-lockdirs-partial-solve.t
Show resolved
Hide resolved
07870ae to
09e28a2
Compare
When generating portable lockdirs the solver runs multiple times. Dune collects any errors from the solver and prints them to the terminal in the event that no solution was found on any platforms, and logs them printing a warning if no solution was found on some but not all platforms. This can create a situation where the same error is printed multiple times, since many solver errors are platform agnostic. This change groups solver errors by the contents of their message when generating portable lockdirs. Each solver error is printed a single time, along with the list of platforms on which it occurred. Signed-off-by: Stephen Sherratt <stephen@sherra.tt>
09e28a2 to
25af255
Compare
When generating portable lockdirs the solver runs multiple times. Dune collects any errors from the solver and prints them to the terminal in the event that no solution was found on any platforms, and logs them printing a warning if no solution was found on some but not all platforms. This can create a situation where the same error is printed multiple times, since many solver errors are platform agnostic.
This change groups solver errors by the contents of their message when generating portable lockdirs. Each solver error is printed a single time, along with the list of platforms on which it occurred.