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

coqdep -modules #5100

Open
SkySkimmer opened this issue Nov 5, 2021 · 6 comments
Open

coqdep -modules #5100

SkySkimmer opened this issue Nov 5, 2021 · 6 comments
Labels

Comments

@SkySkimmer
Copy link

SkySkimmer commented Nov 5, 2021

In order to avoid having coqdep calls depend on all file contents, it would be useful to have a way to use coqdep like ocaml -modules.

This has 2 steps:

  • make coqdep output the right stuff
  • make dune use it

We need an output format for coqdep which can handle

  • Declare ML Module "foo" "bar" (dependency on some cmxs)
  • Require foo bar.baz and From x Require foo bar.baz (dependency on .vo)
  • Load foo.bar and Load "foo" (dependency on .v)

coqdep also handles Add LoadPath but I don't think we want to support that.

@ejgallego
Copy link
Collaborator

See also coq/coq#12108

@rgrinberg rgrinberg added the coq label Nov 5, 2021
@ejgallego
Copy link
Collaborator

@SkySkimmer we can also use implement this #5457 (comment) , should be a one liner, let me try.

ejgallego added a commit to ejgallego/dune that referenced this issue Apr 5, 2022
This should help reduce the coqdep calls drastically.

Improves ocaml#5100 .
ejgallego added a commit to ejgallego/dune that referenced this issue Apr 5, 2022
This should help reduce the coqdep calls drastically.

Improves ocaml#5100 .
ejgallego added a commit to ejgallego/dune that referenced this issue Apr 5, 2022
This should help reduce the coqdep calls drastically.

Improves ocaml#5100 .

Signed-off-by: Emilio Jesus Gallego Arias <e+git@x80.org>
ejgallego added a commit to ejgallego/dune that referenced this issue Apr 5, 2022
This should help reduce the coqdep calls drastically.

Improves ocaml#5100 .

Signed-off-by: Emilio Jesus Gallego Arias <e+git@x80.org>
ejgallego added a commit to ejgallego/dune that referenced this issue Apr 5, 2022
This should help reduce the coqdep calls drastically.

Improves ocaml#5100 .

Signed-off-by: Emilio Jesus Gallego Arias <e+git@x80.org>
ejgallego added a commit to ejgallego/dune that referenced this issue Apr 6, 2022
This should help reduce the coqdep calls drastically.

Improves ocaml#5100 .

Signed-off-by: Emilio Jesus Gallego Arias <e+git@x80.org>
ejgallego added a commit to ejgallego/dune that referenced this issue Apr 6, 2022
This should help reduce the coqdep calls drastically.

Improves ocaml#5100 .

In particular, while a build from scratch has still one coqdep call
per file overhead, incremental builds don't anymore. This makes one
coqdep call per theory (or `-modules`) much less critical.

Signed-off-by: Emilio Jesus Gallego Arias <e+git@x80.org>
ejgallego added a commit that referenced this issue Apr 6, 2022
This should help reduce the coqdep calls drastically.

Improves #5100 .

In particular, while a build from scratch has still one coqdep call
per file overhead, incremental builds don't anymore. This makes one
coqdep call per theory (or `-modules`) much less critical.

Signed-off-by: Emilio Jesus Gallego Arias <e+git@x80.org>
rgrinberg added a commit to rgrinberg/opam-repository that referenced this issue Apr 15, 2022
…ne-site, dune-rpc, dune-rpc-lwt, dune-private-libs, dune-glob, dune-configurator, dune-build-info and dune-action-plugin (3.1.0)

CHANGES:

- Add `sourcehut` as an option for defining project sources in dune-project
  files. For example, `(source (sourcehut user/repo))`. (ocaml/dune#5564, @rgrinberg)

- Add `dune coq top` command for running a Coq toplevel (ocaml/dune#5457, @rlepigre)

- Fix dune exec dumping database in wrong directory (ocaml/dune#5544, @bobot)

- Always output absolute paths for locations in RPC reported diagnostics
  (ocaml/dune#5539, @rgrinberg)

- Add `(deps <deps>)` in ctype field (ocaml/dune#5346, @bobot)

- Add `(include <file>)` constructor to dependency specifications. This can be
  used to introduce dynamic dependencies (ocaml/dune#5442, @anmonteiro)

- Ensure that `dune describe` computes a transitively closed set of
  libraries (ocaml/dune#5395, @esope)

- Add direct dependencies to $ dune describe output (ocaml/dune#5412, @esope)

- Show auto-detected concurrency on Windows too (ocaml/dune#5502, @MisterDA)

- Fix operations that remove folders with absolute path. This happens when
  using esy (ocaml/dune#5507, @EduardoRFS)

- Dune will not fail if some directories are non-empty when uninstalling.
  (ocaml/dune#5543, fixes ocaml/dune#5542, @nojb)

- `coqdep` now depends only on the filesystem layout of the .v files,
  and not on their contents (ocaml/dune#5547, helps with ocaml/dune#5100, @ejgallego)

- The mdx stanza 0.2 can now be used with `(implicit_transitive_deps false)`
  (ocaml/dune#5558, fixes ocaml/dune#5499, @emillon)

- Fix missing parenthesis in printing of corresponding terminal command for
  `(with-outputs-to )` (ocaml/dune#5551, fixes ocaml/dune#5546, @Alizter)
@ejgallego
Copy link
Collaborator

@Alizter has been working on this.

@Alizter
Copy link
Collaborator

Alizter commented Jun 6, 2022

So to elaborate further, I have a little binary called coqmod which is coqdep with all the useless stuff ripped out. It simply lexes the dependency tokens in a file and reports them. We can add a function to dune to interpret these.

https://github.com/Alizter/coq/tree/coqmod

@Alizter Alizter moved this to Todo in Coq + Dune Jun 6, 2022
@Alizter Alizter moved this from Todo to Planned for Coq lang 1.0 in Coq + Dune Jun 6, 2022
@ejgallego
Copy link
Collaborator

This should also help solving #3286

@Alizter Alizter moved this from Planned for Coq lang 1.0 to Todo in Coq + Dune Oct 9, 2022
@Alizter Alizter self-assigned this Oct 14, 2022
@Alizter
Copy link
Collaborator

Alizter commented Feb 12, 2023

To sum up the status of this. I have implemented a prototype that lexes .v files for dependencies (let's call that coqmod). We can eventually upstream that. The question of what to do with with the tokens is however quite difficult.

In my prototype, I tried to follow the implementation of Coq's loadpath as closely as possible, and it appeared to work for most cases. The main issues I see here are that the loadpath specifications of Coq could probably be improved. For example to allow for ambiguous Require's with a clear preference order. This is however not something I want to touch atm.

The main advantage of this proposal would be the speed up by not having to call coqdep. In reality, once coqdep is called once per theory #7048, this not longer becomes the bottleneck during coq builds. The main bottleneck is the Coq compiler itself.

@Alizter Alizter removed their assignment Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Todo
Development

No branches or pull requests

4 participants