-
Notifications
You must be signed in to change notification settings - Fork 415
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
[coq] pick flags from profile #3547
Conversation
Thanks for the PR @gares, a couple of comments:
Once we agree on the first point I will make a pass on the rest of the file. |
Note that it is easy for example to introduce an alias for all An advantage of using different extensions is that I think incremental behavior is a bit better, for example if you decide to compile some part of you workspace with quick, this will force a full rebuild. The conditional dependency on a |
@@ -93,15 +93,23 @@ module Context = struct | |||
; scope : Scope.t | |||
; boot_type : Bootstrap.t | |||
; build_dir : Path.Build.t | |||
; backend : Dune_env.Stanza.Coq.backend | |||
} | |||
|
|||
let coqc ?stdout_to t args = | |||
let dir = Path.build (snd t.coqc) in | |||
Command.run ~dir ?stdout_to (fst t.coqc) args | |||
|
|||
let coq_flags t = |
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.
Small note, I will move this to Coq_flags
soon as indeed handling of flags is becoming quite interesting.
that would work as well, but asking one to write
of course you gain: even if the dag of dependencies is the same,
no, because in dune they don't see the build artifacts
great! |
@@ -79,6 +79,9 @@ val local_binaries : t -> dir:Path.Build.t -> File_binding.Expanded.t list | |||
(** odoc config in the corresponding [(env)] stanza. *) | |||
val odoc : t -> dir:Path.Build.t -> Env_node.Odoc.t | |||
|
|||
(** coq config in the corresponding [(env)] stanza. *) | |||
val coq : t -> dir:Path.Build.t -> Env_node.Coq.t |
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.
Need to have a closer look but the part related to env
/ SC seems OK to me.
Also, DCO is needed, it is also recommended to run |
Is the DCO just about adding a sign-of line to commits as CI reports? |
I'd say let's add a general
Indeed that's quite a bit, but I mean you can do this already using
Still people may want to look at _build to see what's going on, also this strategy of reusing names has a risk which is that people could install wrongly named libraries. Actually, this method won't produce installable packages that are both using Yup, the DCO is about signing-off your commits [which implies you agree with the contributing agreement] More things needed: update documentation. |
This is one thing I would avoid as it has always been a mess in Coq. |
Yup, but indeed these worlds are quite disconnected IIUC, for example vos are supposed to be interfaces, so I'm not sure the same file name would work as they are too disconnected. Moreover, it seems this would prevent some valid use cases as I mention w.r.t. incremental setup. I think it is OK to have interesting rules as long as we design them properly. Indeed that may mean we need to rethink the way |
I see no difference with using dev or release on ocaml file. You look in there and you see a .cmx. Was it compiler with -opaque? You don't see it from the file name. I also never feel the need to look into _build when I develop OCaml code (unless I'm debugging the build system, which is not something we expect our users to do often). Why would it be different for Coq?
Having "both" serve no purpose, you only want the most complete one. In the approach I propose, it is always called vo. Print Assumption & Co can be updated to tell you that you are loading incomplete files. Anyway, being able to to pass flags to coqc via profile is a good feature anyway, so maybe we should focus on that here. |
I've re targeted the PR to just support coq.flags. It works for me as well and requires no discussion about the design of alternative Coq backends. |
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.
Looks pretty good, some tweaks are possible. @rgrinberg how does this look to you?
While I finish the review, this is missing:
- changelog entry
- documentation update.
ping |
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.
Looks good and should be good to go for 2.7.
Thanks @rgrinberg ; @gares this looks good then, I will merge once the two comments are addressed. |
Signed-off-by: Enrico Tassi <[email protected]>
Signed-off-by: Enrico Tassi <[email protected]>
Signed-off-by: Enrico Tassi <[email protected]>
Signed-off-by: Enrico Tassi <[email protected]>
Signed-off-by: Enrico Tassi <[email protected]>
should be OK now |
@@ -1345,6 +1345,9 @@ Fields supported in ``<settings>`` are: | |||
- ``(odoc <fields>)``. This allows to pass options to Odoc, see | |||
:ref:`odoc-options` for more details. | |||
|
|||
- ``(coq (flags <flags>))``. This allows to pass options to Coq, see | |||
:ref:`coq-theory` for more details. | |||
|
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.
Nit: we could indeed also mention in the (coq.theory ...)
documentation that flags can be set in env
…lugin, dune-private-libs and dune-glob (2.7.0) CHANGES: - Write intermediate files in a `.mdx` folder for each `mdx` stanza to prevent the corresponding actions to be executed as part of the `@all` alias (ocaml/dune#3659, @NathanReb) - Read Coq flags from `env` (ocaml/dune#3547 , fixes ocaml/dune#3486, @gares) - Allow bisect_ppx to be enabled/disabled via dune-workspace. (ocaml/dune#3404, @stephanieyou) - Formatting of dune files is now done in the executing dune process instead of in a separate process. (ocaml/dune#3536, @nojb) - Add a `--debug-artifact-substution` flag to help debug problem with version not being captured by `dune-build-info` (ocaml/dune#3589, @jeremiedimino) - Allow the use of the `context_name` variable in the `enabled_if` fields of executable(s) and install stanzas. (ocaml/dune#3568, fixes ocaml/dune#3566, @voodoos) - Fix compatibility with OCaml 4.12.0 when compiling empty archives; no .a file is generated. (ocaml/dune#3576, @dra27) - `$ dune utop` no longer tries to load optional libraries that are unavailable (ocaml/dune#3612, fixes ocaml/dune#3188, @anuragsoni) - Fix dune-build-info on 4.10.0+flambda (ocaml/dune#3599, @emillon, @jeremiedimino). - Allow multiple libraries with `inline_tests` to be defined in the same directory (ocaml/dune#3621, @rgrinberg) - Run exit hooks in jsoo separate compilation mode (ocaml/dune#3626, fixes ocaml/dune#3622, @rgrinberg) - Add (alias ...), (mode ...) fields to (copy_fields ...) stanza (ocaml/dune#3631, @nojb) - (copy_files ...) now supports copying files from outside the workspace using absolute file names (ocaml/dune#3639, @nojb) - Dune does not use `ocamlc` as an intermediary to call C compiler anymore. Configuration flags `ocamlc_cflags` and `ocamlc_cppflags` are always prepended to the compiler arguments. (ocaml/dune#3565, fixes ocaml/dune#3346, @voodoos) - Revert the build optimization in ocaml/dune#2268. This optimization slows down building individual executables when they're part of an `executables` stanza group (ocaml/dune#3644, @rgrinberg) - Use `{dev}` rather than `{pinned}` in the generated `.opam` file. (ocaml/dune#3647, @kit-ty-kate) - Insert correct extension name when editing `dune-project` files. Previously, dune would just insert the stanza name. (ocaml/dune#3649, fixes ocaml/dune#3624, @rgrinberg) - Fix crash when evaluating an `mdx` stanza that depends on unavailable packages. (ocaml/dune#3650, @craigfe) - Fix typo in `cache-check-probablity` field in dune config files. This field now requires 2.7 as it wasn't usable before this version. (ocaml/dune#3652, @edwintorok) - Add `"odoc" {with-doc}` to the dependencies in the generated `.opam` files. (ocaml/dune#3667, @kit-ty-kate) - Do not allow user actions to capture dune's stdin (ocaml/dune#3677, fixes ocaml/dune#3672, @rgrinberg) - `(subdir ...)` stanzas can now appear in dune files used via `(include ...)`. (ocaml/dune#3676, @nojb)
…lugin, dune-private-libs and dune-glob (2.7.0) CHANGES: - Write intermediate files in a `.mdx` folder for each `mdx` stanza to prevent the corresponding actions to be executed as part of the `@all` alias (ocaml/dune#3659, @NathanReb) - Read Coq flags from `env` (ocaml/dune#3547 , fixes ocaml/dune#3486, @gares) - Add instrumentation framework to toggle instrumentation by `bisect_ppx`, `landmarks`, etc, via dune-workspace and/or the command-line. (ocaml/dune#3404, ocaml/dune#3526 @stephanieyou, @nojb) - Formatting of dune files is now done in the executing dune process instead of in a separate process. (ocaml/dune#3536, @nojb) - Add a `--debug-artifact-substution` flag to help debug problem with version not being captured by `dune-build-info` (ocaml/dune#3589, @jeremiedimino) - Allow the use of the `context_name` variable in the `enabled_if` fields of executable(s) and install stanzas. (ocaml/dune#3568, fixes ocaml/dune#3566, @voodoos) - Fix compatibility with OCaml 4.12.0 when compiling empty archives; no .a file is generated. (ocaml/dune#3576, @dra27) - `$ dune utop` no longer tries to load optional libraries that are unavailable (ocaml/dune#3612, fixes ocaml/dune#3188, @anuragsoni) - Fix dune-build-info on 4.10.0+flambda (ocaml/dune#3599, @emillon, @jeremiedimino). - Allow multiple libraries with `inline_tests` to be defined in the same directory (ocaml/dune#3621, @rgrinberg) - Run exit hooks in jsoo separate compilation mode (ocaml/dune#3626, fixes ocaml/dune#3622, @rgrinberg) - Add (alias ...), (mode ...) fields to (copy_fields ...) stanza (ocaml/dune#3631, @nojb) - (copy_files ...) now supports copying files from outside the workspace using absolute file names (ocaml/dune#3639, @nojb) - Dune does not use `ocamlc` as an intermediary to call C compiler anymore. Configuration flags `ocamlc_cflags` and `ocamlc_cppflags` are always prepended to the compiler arguments. (ocaml/dune#3565, fixes ocaml/dune#3346, @voodoos) - Revert the build optimization in ocaml/dune#2268. This optimization slows down building individual executables when they're part of an `executables` stanza group (ocaml/dune#3644, @rgrinberg) - Use `{dev}` rather than `{pinned}` in the generated `.opam` file. (ocaml/dune#3647, @kit-ty-kate) - Insert correct extension name when editing `dune-project` files. Previously, dune would just insert the stanza name. (ocaml/dune#3649, fixes ocaml/dune#3624, @rgrinberg) - Fix crash when evaluating an `mdx` stanza that depends on unavailable packages. (ocaml/dune#3650, @craigfe) - Fix typo in `cache-check-probablity` field in dune config files. This field now requires 2.7 as it wasn't usable before this version. (ocaml/dune#3652, @edwintorok) - Add `"odoc" {with-doc}` to the dependencies in the generated `.opam` files. (ocaml/dune#3667, @kit-ty-kate) - Do not allow user actions to capture dune's stdin (ocaml/dune#3677, fixes ocaml/dune#3672, @rgrinberg) - `(subdir ...)` stanzas can now appear in dune files used via `(include ...)`. (ocaml/dune#3676, @nojb)
disclaimer I don't know the code of dune at all, this is symbol pushing
This PR adds
(coq (flags <osl>))
to profileOUTDATED:
~This PR makes it possible to use different Coq compilation backends via profiles. Today Coq can produce object files in 3 ways:
@check-proofs
below)Currently Coq names the files
.vo
,.vos
and.vio
respectively but internally the format is the same (it is a segment based format, some segments are optional). Viamake
Coq supports various workflows, and indeed the different file names are motivated by the fact that this way different make rules are easily written/selected. The idea discussed at a Coq call was to support most of these workflows/backends by--profile
(or(profile ..)
)This is a WIP, and I don't have yet a Coq branch supporting the
-vos-dune
and-vio-dune
flags I used there (but I'm pretty sure I can do this). I open the draft PR mainly to gather feedback and avoid duplication of work for #3486 .make test-coq
seems to suggest I'm calling Coq with the expected flags in the blackbox test I've added.Things to be checked by someone understanding dune internals:
@check-proofs
. This target succeed immediately with the first backend, always fails with the second. With the third backend it runs a rule that depends on all .vo files and runs a specific coqc invocation (all proofs can be checked in parallel)~Fix #3486
CC @Zimmi48 @ejgallego