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

feature(coq): omit -q flag during dune coq top #6848

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
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ Unreleased
- Remove "Entering Directory" messages for `$ dune install`. (#6513,
@rgrinberg)

- Stop passing `-q` flag in `dune coq top`, which allows for `.coqrc` to be
loaded. (#6848, fixes #6847, @Alizter)

- Fix missing dependencies when detecting the kind of C compiler we're using
(#6610, fixes #6415, @emillon)

Expand Down
18 changes: 17 additions & 1 deletion src/dune_rules/coq/coq_rules.ml
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,23 @@ let generic_coq_args ~sctx ~dir ~wrapper_name ~boot_type ~mode ~coq_prog
~stanza_flags ~ml_flags ~theories_deps ~theory_dirs coq_module =
let+ coq_stanza_flags =
let+ expander = Super_context.expander sctx ~dir in
let coq_flags = coq_flags ~expander ~dir ~stanza_flags ~sctx in
let coq_flags =
let coq_flags = coq_flags ~expander ~dir ~stanza_flags ~sctx in
(* By default we have the -q flag. We don't want to pass this to coqtop to
allow users to load their .coqrc files for interactive development.
Therefore we manually scrub the -q setting when passing arguments to
coqtop. *)
match coq_prog with
| `Coqtop ->
let rec remove_q = function
| "-q" :: l -> remove_q l
| x :: l -> x :: remove_q l
| [] -> []
in
let open Action_builder.O in
coq_flags >>| remove_q
| _ -> coq_flags
in
Command.Args.dyn coq_flags (* stanza flags *)
in
let coq_native_flags =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ Checking that we compute the directory and file for dune coq top correctly
$ dune build theories/c.vo
$ dune build theories/b/b.vo
$ dune coq top --toplevel=echo theories/c.v
-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
-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
$ dune coq top --toplevel=echo theories/b/b.v
-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
-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
8 changes: 4 additions & 4 deletions test/blackbox-tests/test-cases/coq/coqtop/coqtop-recomp.t
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@ https://github.com/ocaml/dune/pull/5457#issuecomment-1084161587).
coqdep dir/bar.v.d
coqdep dir/foo.v.d
coqc dir/foo.{glob,vo}
-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
-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
Alizter marked this conversation as resolved.
Show resolved Hide resolved
$ dune coq top --display short --toplevel echo dir/bar.v
-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
-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
$ dune clean
$ (cd dir && dune coq top --root .. --display short --toplevel echo dir/bar.v)
Entering directory '..'
coqdep dir/bar.v.d
coqdep dir/foo.v.d
coqc dir/foo.{glob,vo}
Leaving directory '..'
-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
-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
$ (cd dir && dune coq top --root .. --display short --toplevel echo dir/bar.v)
Entering directory '..'
Leaving directory '..'
-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
-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

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

$ dune coq top --toplevel=echo -- theories/foo.v
-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
-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
$ cd theories

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