Skip to content
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

Display the full solver error with --verbose #229

Merged
merged 2 commits into from
Nov 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- Rename the `--repo` option to `--root` to make it more
straightforward that this is referring to the project root (#218, @samoht)
- Improve the wording of the lockfile selection log (#222, @NathanReb)
- Display the full solver error with `--verbose` (#229, @emillon)

### Deprecated

Expand Down
7 changes: 6 additions & 1 deletion cli/lock.ml
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,19 @@ let get_pin_depends ~global_state local_opam_files =
let open Rresult.R.Infix in
root_pin_depends local_opam_files >>= pull_pin_depends ~global_state

let display_verbose_diagnostics = function
| None -> false
| Some l -> l >= Logs.Info

let interpret_solver_error ~switch_state = function
| `Msg _ as err -> err
| `Diagnostics d ->
(match Opam_solve.not_buildable_with_dune d with
| [] -> ()
| offending_packages ->
check_dune_universe_repo ~switch_state offending_packages);
Opam_solve.diagnostics_message d
let verbose = display_verbose_diagnostics (Logs.level ()) in
Opam_solve.diagnostics_message ~verbose d

let calculate_opam ~build_only ~allow_jbuilder ~local_opam_files ~ocaml_version
~target_packages =
Expand Down
4 changes: 2 additions & 2 deletions lib/opam_solve.ml
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ let calculate_raw ~build_only ~allow_jbuilder ~ocaml_version ~local_packages

type diagnostics = Local_solver.diagnostics

let diagnostics_message diagnostics =
`Msg (Local_solver.diagnostics diagnostics)
let diagnostics_message ~verbose diagnostics =
`Msg (Local_solver.diagnostics ~verbose diagnostics)

module Pkg_map = Local_solver.Solver.Output.RoleMap

Expand Down
2 changes: 1 addition & 1 deletion lib/opam_solve.mli
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ val calculate :
If [build_only] then no test dependencies are taken into account. If [ocaml_version]
is provided, the solution will contain that concrete version of ocaml. *)

val diagnostics_message : diagnostics -> [> `Msg of string ]
val diagnostics_message : verbose:bool -> diagnostics -> [> `Msg of string ]

val not_buildable_with_dune : diagnostics -> OpamPackage.Name.t list