Skip to content

Commit 56589da

Browse files
committed
feature(coq): omit -q flag during dune coq top
<!-- ps-id: 5a03ba95-9ec7-41fd-8f3f-db31c6742042 --> Signed-off-by: Ali Caglayan <alizter@gmail.com>
1 parent fc0769e commit 56589da

File tree

5 files changed

+26
-8
lines changed

5 files changed

+26
-8
lines changed

CHANGES.md

+3
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ Unreleased
6565
- Remove "Entering Directory" messages for `$ dune install`. (#6513,
6666
@rgrinberg)
6767

68+
- Stop passing `-q` flag in `dune coq top`, which allows for `.coqrc` to be
69+
loaded. (#6848, fixes #6847, @Alizter)
70+
6871
- Fix missing dependencies when detecting the kind of C compiler we're using
6972
(#6610, fixes #6415, @emillon)
7073

src/dune_rules/coq/coq_rules.ml

+16-1
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,22 @@ let generic_coq_args ~sctx ~dir ~wrapper_name ~boot_type ~mode ~coq_prog
347347
~stanza_flags ~ml_flags ~theories_deps ~theory_dirs coq_module =
348348
let+ coq_stanza_flags =
349349
let+ expander = Super_context.expander sctx ~dir in
350-
let coq_flags = coq_flags ~expander ~dir ~stanza_flags ~sctx in
350+
let coq_flags =
351+
let coq_flags = coq_flags ~expander ~dir ~stanza_flags ~sctx in
352+
(* By default we have the -q flag. We don't want to pass this to coqtop to
353+
allow users to load their .coqrc files for interactive development.
354+
Therefore we manually scrub the -q setting when passing arguments to
355+
coqtop. *)
356+
match coq_prog with
357+
| `Coqtop ->
358+
let rec remove_q = function
359+
| "-q" :: l -> remove_q l
360+
| _ :: l -> remove_q l
361+
in
362+
let open Action_builder.O in
363+
coq_flags >>| remove_q
364+
| _ -> coq_flags
365+
in
351366
Command.Args.dyn coq_flags (* stanza flags *)
352367
in
353368
let coq_native_flags =

test/blackbox-tests/test-cases/coq/coqtop/coqtop-nested.t/run.t

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ Checking that we compute the directory and file for dune coq top correctly
33
$ dune build theories/c.vo
44
$ dune build theories/b/b.vo
55
$ dune coq top --toplevel=echo theories/c.v
6-
-topfile $TESTCASE_ROOT/_build/default/theories/c.v -q -w -deprecated-native-compiler-option -w -native-compiler-disabled -native-compiler ondemand -R $TESTCASE_ROOT/_build/default/theories foo
6+
-topfile $TESTCASE_ROOT/_build/default/theories/c.v -w -deprecated-native-compiler-option -w -native-compiler-disabled -native-compiler ondemand -R $TESTCASE_ROOT/_build/default/theories foo
77
$ dune coq top --toplevel=echo theories/b/b.v
8-
-topfile $TESTCASE_ROOT/_build/default/theories/b/b.v -q -w -deprecated-native-compiler-option -w -native-compiler-disabled -native-compiler ondemand -R $TESTCASE_ROOT/_build/default/theories foo
8+
-topfile $TESTCASE_ROOT/_build/default/theories/b/b.v -w -deprecated-native-compiler-option -w -native-compiler-disabled -native-compiler ondemand -R $TESTCASE_ROOT/_build/default/theories foo

test/blackbox-tests/test-cases/coq/coqtop/coqtop-recomp.t

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,19 @@ https://github.com/ocaml/dune/pull/5457#issuecomment-1084161587).
2222
coqdep dir/bar.v.d
2323
coqdep dir/foo.v.d
2424
coqc dir/foo.{glob,vo}
25-
-topfile $TESTCASE_ROOT/_build/default/dir/bar.v -q -w -deprecated-native-compiler-option -w -native-compiler-disabled -native-compiler ondemand -R $TESTCASE_ROOT/_build/default/dir basic
25+
-topfile $TESTCASE_ROOT/_build/default/dir/bar.v -w -deprecated-native-compiler-option -w -native-compiler-disabled -native-compiler ondemand -R $TESTCASE_ROOT/_build/default/dir basic
2626
$ dune coq top --display short --toplevel echo dir/bar.v
27-
-topfile $TESTCASE_ROOT/_build/default/dir/bar.v -q -w -deprecated-native-compiler-option -w -native-compiler-disabled -native-compiler ondemand -R $TESTCASE_ROOT/_build/default/dir basic
27+
-topfile $TESTCASE_ROOT/_build/default/dir/bar.v -w -deprecated-native-compiler-option -w -native-compiler-disabled -native-compiler ondemand -R $TESTCASE_ROOT/_build/default/dir basic
2828
$ dune clean
2929
$ (cd dir && dune coq top --root .. --display short --toplevel echo dir/bar.v)
3030
Entering directory '..'
3131
coqdep dir/bar.v.d
3232
coqdep dir/foo.v.d
3333
coqc dir/foo.{glob,vo}
3434
Leaving directory '..'
35-
-topfile $TESTCASE_ROOT/_build/default/dir/bar.v -q -w -deprecated-native-compiler-option -w -native-compiler-disabled -native-compiler ondemand -R $TESTCASE_ROOT/_build/default/dir basic
35+
-topfile $TESTCASE_ROOT/_build/default/dir/bar.v -w -deprecated-native-compiler-option -w -native-compiler-disabled -native-compiler ondemand -R $TESTCASE_ROOT/_build/default/dir basic
3636
$ (cd dir && dune coq top --root .. --display short --toplevel echo dir/bar.v)
3737
Entering directory '..'
3838
Leaving directory '..'
39-
-topfile $TESTCASE_ROOT/_build/default/dir/bar.v -q -w -deprecated-native-compiler-option -w -native-compiler-disabled -native-compiler ondemand -R $TESTCASE_ROOT/_build/default/dir basic
39+
-topfile $TESTCASE_ROOT/_build/default/dir/bar.v -w -deprecated-native-compiler-option -w -native-compiler-disabled -native-compiler ondemand -R $TESTCASE_ROOT/_build/default/dir basic
4040

test/blackbox-tests/test-cases/coq/coqtop/coqtop-root.t/run.t

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
All dune commands work when you run them in sub-directories, so this should be no exception.
22

33
$ dune coq top --toplevel=echo -- theories/foo.v
4-
-topfile $TESTCASE_ROOT/_build/default/theories/foo.v -q -w -deprecated-native-compiler-option -w -native-compiler-disabled -native-compiler ondemand -R $TESTCASE_ROOT/_build/default/theories foo
4+
-topfile $TESTCASE_ROOT/_build/default/theories/foo.v -w -deprecated-native-compiler-option -w -native-compiler-disabled -native-compiler ondemand -R $TESTCASE_ROOT/_build/default/theories foo
55
$ cd theories
66

77
This test is currently broken due to the workspace resolution being faulty #5899.

0 commit comments

Comments
 (0)