-
Notifications
You must be signed in to change notification settings - Fork 95
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
Separate implementation and interface in different (odoc) compilation units #1067
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
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:
compile
command do not take the--source-name
and--source-parent-file
commands.compile-src
command take--source-path
and--source-parent-file
command instead. It can only take a<name>.cmt
file as input, and creates a value of typeOdoc_model.Lang.Implementation.t
which 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_id
map.src-....odoc
files in the path.--source
and--source-root
are restricted to implementationodocl
files.A notable change is that
--source-parent-file
and--source-path
is required for implementation files, which forces to have them even when we only want to count occurrences, not render them.Another change is that
--source
and--source-root
are 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:
.odocl
generate files in very different output directories, which can be a problem for some build systems.