Skip to content

Commit

Permalink
pkg: set with-dev-setup opam variable by default (#10540)
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Sherratt <stephen@sherra.tt>
  • Loading branch information
gridbugs committed May 17, 2024
1 parent 944b294 commit 653e203
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 20 deletions.
1 change: 1 addition & 0 deletions src/dune_lang/package_variable_name.ml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ let opam_version = of_string "opam-version"
let sys_ocaml_version = of_string "sys-ocaml-version"
let with_test = of_string "with-test"
let with_doc = of_string "with-doc"
let with_dev_setup = of_string "with-dev-setup"
let version = of_string "version"
let name = of_string "name"
let build = of_string "build"
Expand Down
1 change: 1 addition & 0 deletions src/dune_lang/package_variable_name.mli
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ val os_family : t
val opam_version : t
val with_test : t
val with_doc : t
val with_dev_setup : t
val sys_ocaml_version : t
val name : t
val version : t
Expand Down
1 change: 1 addition & 0 deletions src/dune_pkg/solver_env.ml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ let with_defaults =
[ ( Package_variable_name.opam_version
, OpamVersion.to_string OpamVersion.current |> Variable_value.string )
; Package_variable_name.with_doc, Variable_value.false_
; Package_variable_name.with_dev_setup, Variable_value.false_
]
|> List.fold_left ~init:empty ~f:(fun acc (name, value) -> set acc name value)
;;
Expand Down
1 change: 1 addition & 0 deletions src/dune_pkg/solver_env.mli
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ val extend : t -> t -> t

(** A [t] with default values for some variables:
- "with-doc" is set to "false"
- "with-dev-setup" is set to "false"
- "opam-version" is set to the version of opam vendored in dune *)
val with_defaults : t

Expand Down
24 changes: 4 additions & 20 deletions test/blackbox-tests/test-cases/pkg/common-filters-deps.t
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,9 @@ included.
$ mkpkg dev-setup <<EOF
> EOF
Note that dune solves packages with with-doc always set to false, so
Note that dune solves packages with with-doc and with-dev-setup always set to false, so
documentation-only deps are omitted from the solution.
$ solve "(test :with-test) (doc :with-doc) (dev-setup :with-dev-setup) (dev :with-dev) (build :build) (post :post)"
Internal error, please report upstream including the contents of _build/log.
Description:
("Unexpected exception raised while solving dependencies",
{ exception = "Invalid_argument(\"filter_deps\")" })
Raised at Stdune__Code_error.raise in file
"otherlibs/stdune/src/code_error.ml", line 10, characters 30-62
Called from Fiber__Scheduler.exec in file "vendor/fiber/src/scheduler.ml",
line 76, characters 8-11
Re-raised at Stdune__Exn.raise_with_backtrace in file
"otherlibs/stdune/src/exn.ml", line 38, characters 27-56
Called from Fiber__Scheduler.exec in file "vendor/fiber/src/scheduler.ml",
line 76, characters 8-11
I must not crash. Uncertainty is the mind-killer. Exceptions are the
little-death that brings total obliteration. I will fully express my cases.
Execution will pass over me and through me. And when it has gone past, I
will unwind the stack along its path. Where the cases are handled there will
be nothing. Only I will remain.
[1]
Solution for dune.lock:
- build.0.0.1
- test.0.0.1
4 changes: 4 additions & 0 deletions test/blackbox-tests/test-cases/pkg/just-print-solver-env.t
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ Add some build contexts with different environments
$ dune pkg print-solver-env --all
Solver environment for lock directory change-opam-version.lock:
- opam-version = 42
- with-dev-setup = false
- with-doc = false
Solver environment for lock directory dune.linux.lock:
- opam-version = 2.2.0~alpha-vendored
- os = linux
- with-dev-setup = false
- with-doc = false
Solver environment for lock directory dune.linux.no-doc.lock:
- arch = x86_64
Expand All @@ -53,7 +55,9 @@ Add some build contexts with different environments
- os-family = ubuntu
- os-version = 22.04
- sys-ocaml-version = 5.0
- with-dev-setup = false
- with-doc = false
Solver environment for lock directory dune.lock:
- opam-version = 2.2.0~alpha-vendored
- with-dev-setup = false
- with-doc = false

0 comments on commit 653e203

Please sign in to comment.