-
Notifications
You must be signed in to change notification settings - Fork 102
Separate implementation and interface in different (odoc) compilation units #1067
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
Conversation
|
Note: the driver needs to be rewritten to use the new pipeline... |
|
This is ready for review. One notable change that can be discussed: the Instead, we just |
Hidden modules were not rendered, since calling html-generate on them was used to generate the associated source code. However, this breaks dune rules in some cases (see issue ocaml#1013), as dune always expect an output to the command. This fix is related to the separation of implementation and interface pipelines (see ocaml#1067). Signed-off-by: Paul-Elliot <[email protected]>
322635e to
a368576
Compare
5cafdf3 to
830c4ed
Compare
Julow
left a comment
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.
I did a full review and I think this is ready to merge!
Introduce a new command: `odoc compile-src`, which creates a new kind of odoc file: implementation files. Implementation files are used to render source code, as well as to collect occurrences. Signed-off-by: Paul-Elliot <[email protected]>
Signed-off-by: Paul-Elliot <[email protected]>
Signed-off-by: Paul-Elliot <[email protected]>
Signed-off-by: Paul-Elliot <[email protected]>
Signed-off-by: Paul-Elliot <[email protected]>
- Rename `--source-parent-file` into `parent` - Check that source argument is empty in case of rendering source tree - Removed now useless `syntax` argument from `extra_documents` - Check `"src-"`prefix when loading units for counting occurrences to avoid loading for nothing - fixed some typos and made some small refactoring Signed-off-by: Paul-Elliot <[email protected]>
fd402d3 to
b7d5c1d
Compare
This field now hold one location instead of two. The name is now more explicit.
Signed-off-by: Paul-Elliot <[email protected]>
|
I rebased and marked the commands as experimental, as they are likely to change in the future (likely before we release)! |
This PR separate the compilation pipeline for interface and implementation. This is a backward incompatible change, but only for rendering source code. It introduces a new command,
compile-src, which compiles to a new kind of odoc file: implementation files, namedsrc-<name>.odoc(l).A good way to see the changes is to look at the diff in the source rendering tests, but here is a list of the changes:
compilecommand do not take the--source-nameand--source-parent-filecommands.compile-srccommand take--source-pathand--source-parent-filecommand instead. It can only take a<name>.cmtfile as input, and creates a value of typeOdoc_model.Lang.Implementation.twhich is stored insrc-<name>.odoc. Basically, such type is a record containing an identifier, the source information extracted from the typedtree, the implementation shape and theuid_to_idmap.src-....odocfiles in the path.--sourceand--source-rootare restricted to implementationodoclfiles.A notable change is that
--source-parent-fileand--source-pathis required for implementation files, which forces to have them even when we only want to count occurrences, not render them.Another change is that
--sourceand--source-rootare not anymore specific to the html rendering process. The reason is that with the current organization of the code, only the renderer can depend on backend-specific flags, not the transformation model -> document. Of course it is possible to change that, but that require further modifications which I'm not sure we want.The reason for this change is the following:
.odoclgenerate files in very different output directories, which can be a problem for some build systems.