feat(describe): include module origin in describe workspace#15478
feat(describe): include module origin in describe workspace#15478NatKarmios wants to merge 6 commits into
describe workspace#15478Conversation
Signed-off-by: Nat Karmios <nat@karmios.com>
Signed-off-by: Nat Karmios <nat@karmios.com>
Signed-off-by: Nat Karmios <nat@karmios.com>
Signed-off-by: Nat Karmios <nat@karmios.com>
Signed-off-by: Nat Karmios <nat@karmios.com>
|
The code looks fine, but can we get a confirmation that we have a potential user for this? I know you picked this up from an open issue, but users often change their mind, or realize that they need something slightly different than what they've asked for originally. Would be good to know for certain that this field will be made user of. |
| | Source (* a plain source file written by the user *) | ||
| | Dune of | ||
| { dune_file : Path.t (* the dune file containing the generating rule *) | ||
| ; deps : Path.t list (* the rule's file dependencies *) |
There was a problem hiding this comment.
This field can potentially be huge. I'd rather that we'd:
- confirm that we need it for something
- guard emitting behind a flag
There was a problem hiding this comment.
I wonder whether it would be preferable to guard the entire origin field behind a flag, or just the file dependencies for a dune origin.
There was a problem hiding this comment.
Well, I'd try to emit the dependencies completely if possible. They can be really huge and users shouldn't be just fetching all of them like this. It should be done on demand per rule if possible. I would even confirm that this dependencies field is needed at all. If all you want this field is to support sources being copied, you could try to special case that.
Separately, the origin field can be guarded behind a flag, but it's not mandatory to do this. Take your pick here.
Thanks for the response—to introduce myself, I'm Nat, a new intern at Ahrefs (pleasure to meet you 🙂). I'm looking into observability, measurability and performance of Dune, and thought this would be a good place to start. |
as the person who opened #12998 (comment) i'm still interested in this both from a practical pov as well as a theoretical/moral one (mly mll are as much part of an ocaml project as ml and mli). |
Add an
originfield to each module reported bydune describe workspaceoutput, indicating whether its source was written by hand (source), generated by arulestanza (dune, with the generating dune file and the rule's dependencies), produced byocamllex,ocamlyacc, ormenhir, or synthesised by dune itself for wrapping (wrapper). Generated modules point at the responsible file.To illustrate:
Fixes #12998
Notes:
Ml_sources, exposed via a newparser_gen_originsfunctionReflection.evaluate_rule(globs and aliases are resolved to concrete files, matchingdune rules).depsunder aduneorigin are always shown, regardless of whether--with-depswas used; I believe this is desirable as a rule's dependencies are a separate concern from inter-module dependenciesReflection.Rule.expanded_deps; it claims that glob listings are skipped, but it appears thatexpanded_depsincludes the files that the relevant globs resolve to