-
Notifications
You must be signed in to change notification settings - Fork 407
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
odoc: sherlodoc integration #9772
Conversation
I notice there is an issue with the tests. Sherlodoc can be present or absent, but when it is absent, a warning is printed when the doc is built. This a good thing for the user, but for the tests its quite terrible as the warning shows up in a lot of places, even when it does not on my switch that has sherlodoc. Should I add sherlodoc as a test deps to fix this ? |
I'm not sure about that. I would prefer if the availability of sherlodoc would just result in progressive enhancement. (if it's not installed, do the same as before; if it's installed, users get a new feature).
The way we deal with this in dune's test suite is by creating a fake Do you want remarks on the implementation itself or is it too early? |
I am just concerned that users would never know about sherlodoc if they are never told to install it.
That makes sense. It does not give a way to hide the binary though (which is only useful if we keep the warning).
Yes please ! |
test/blackbox-tests/test-cases/odoc/odoc-new-sherlodoc.t/bar.ml
Outdated
Show resolved
Hide resolved
test/blackbox-tests/test-cases/odoc/odoc-new-sherlodoc.t/foo.ml
Outdated
Show resolved
Hide resolved
test/blackbox-tests/test-cases/odoc/odoc-sherlodoc.t/foo_byte.ml
Outdated
Show resolved
Hide resolved
Dune is not a communication channel, it's a build system :)
You can either make a dedicated test, or make the existing one more modular by making several workspaces in it. You can also remove or chmod the binary as part of your test. Regarding detecting the binary and setting up rules conditionally on that, we'll have to discuss that with the other maintainers, since there's another feature that'll require that, but in the meantime you can use |
I see what you mean. It's not only a communication issue, my opinion is that sherlodoc should be packaged with odoc, I tried this to alleviate this issue. It's not dune's concern though, I'll remove it.
Even with multiple test, is there a way to prevent dune from finding something that is installed ? I don't want the "sherlodoc is absent" tests to only work if sherlodoc is not installed on the current switch.
Fine ! |
Ah yes it can be a bit tricky to isolate from the dev switch. We have a couple tests that do that, for example https://github.com/ocaml/dune/blob/3.13.0/test/blackbox-tests/test-cases/melange/missing-melc.t#L13-L18 (and then we set |
I think that the |
OK, I had a look and indeed I think we can simplify this a lot by not making
That should simplify considerably the work you have to do. Do you need help with that or do you want to have a go at it? |
I looked at it for a while, I think I would appreciate help |
9a70e91
to
57207de
Compare
3ab3f91
to
8ac724e
Compare
I have pushed a commit that make the search global in @doc-new. The reasons have been discussed with jon, and they are that the intent behind doc-new is to provide docs for the devs of the current project : it includes private libraries and dependencies by default. @doc has more limited scope more suitable for sharing the docs (smaller js files, ability to upload separate parts of the same workspace separately) |
One thing you can do with the new fake sherlodoc I added is |
b7c850c
to
81fbd1f
Compare
4ae5750
to
0020e1e
Compare
this is now good to go in my opinion, except for the todo which I'm not sure is about. |
This extends the rules for @doc and @doc-new so that if sherlodoc (available from opam) is installed, a search bar is added on the HTML output. Signed-off-by: Emile Trotignon <emile@tarides.com> Co-authored-by: Etienne Millon <me@emillon.org> Co-authored-by: Christine Rose <christinerose@users.noreply.github.com>
056b7b9
to
394936a
Compare
Thanks. In my view, this is ready to go. |
This extends the rules for @doc and @doc-new so that if sherlodoc (available from opam) is installed, a search bar is added on the HTML output. Signed-off-by: Emile Trotignon <emile@tarides.com> Co-authored-by: Emile Trotignon <emile@tarides.com> Co-authored-by: Etienne Millon <me@emillon.org> Co-authored-by: Christine Rose <christinerose@users.noreply.github.com>
CHANGES: ### Added - Introduce a `(dynamic_include ..)` stanza. This is like `(include foo)` but allows `foo` to be the target of a rule. Currently, there are some limitations on the stanzas that can be generated. For example, public executables, libraries are currently forbidden. (ocaml/dune#9913, @rgrinberg) - Introduce `$ dune promotion list` to print the list of available promotions. (ocaml/dune#9705, @moyodiallo) - If Sherlodoc is installed, add a search bar in generated HTML docs (ocaml/dune#9772, @EmileTrotignon) - Add `only_sources` field to `copy_files` stanza (ocaml/dune#9827, fixes ocaml/dune#9709, @jchavarri) - The `(foreign_library)` stanza now supports the `(enabled_if)` field. (ocaml/dune#9914, @nojb) ### Fixed - Fix `$ dune install -p` incorrectly recognizing packages that are supposed to be filtered (ocaml/dune#9879, fixes ocaml/dune#4814, @rgrinberg) - subst: correctly handle opam files in opam/ subdirectory (ocaml/dune#9895, fixes ocaml/dune#9862, @emillon) - Odoc private rules are not set up if a library is not available due to `enabled_if` (ocaml/dune#9897, @rgrinberg and @jchavarri) ### Changed - When dune language 3.14 is enabled, resolve the binary in `(run %{bin:..} ..)` from where the binary is built. (ocaml/dune#9708, @rgrinberg) - boot: remove single-command bootstrap. This was an alternative bootstrap strategy that was used in certain conditions. Removal makes the bootstrap a bit slower on Linux when only a single core is available, but bootstrap is now reproducible in all cases. (ocaml/dune#9735, fixes ocaml/dune#9507, @emillon)
CHANGES: ### Added - Introduce a `(dynamic_include ..)` stanza. This is like `(include foo)` but allows `foo` to be the target of a rule. Currently, there are some limitations on the stanzas that can be generated. For example, public executables, libraries are currently forbidden. (ocaml/dune#9913, @rgrinberg) - Introduce `$ dune promotion list` to print the list of available promotions. (ocaml/dune#9705, @moyodiallo) - If Sherlodoc is installed, add a search bar in generated HTML docs (ocaml/dune#9772, @EmileTrotignon) - Add `only_sources` field to `copy_files` stanza (ocaml/dune#9827, fixes ocaml/dune#9709, @jchavarri) - The `(foreign_library)` stanza now supports the `(enabled_if)` field. (ocaml/dune#9914, @nojb) ### Fixed - Fix `$ dune install -p` incorrectly recognizing packages that are supposed to be filtered (ocaml/dune#9879, fixes ocaml/dune#4814, @rgrinberg) - subst: correctly handle opam files in opam/ subdirectory (ocaml/dune#9895, fixes ocaml/dune#9862, @emillon) - Odoc private rules are not set up if a library is not available due to `enabled_if` (ocaml/dune#9897, @rgrinberg and @jchavarri) ### Changed - When dune language 3.14 is enabled, resolve the binary in `(run %{bin:..} ..)` from where the binary is built. (ocaml/dune#9708, @rgrinberg) - boot: remove single-command bootstrap. This was an alternative bootstrap strategy that was used in certain conditions. Removal makes the bootstrap a bit slower on Linux when only a single core is available, but bootstrap is now reproducible in all cases. (ocaml/dune#9735, fixes ocaml/dune#9507, @emillon)
CHANGES: ### Added - Introduce a `(dynamic_include ..)` stanza. This is like `(include foo)` but allows `foo` to be the target of a rule. Currently, there are some limitations on the stanzas that can be generated. For example, public executables, libraries are currently forbidden. (ocaml/dune#9913, @rgrinberg) - Introduce `$ dune promotion list` to print the list of available promotions. (ocaml/dune#9705, @moyodiallo) - If Sherlodoc is installed, add a search bar in generated HTML docs (ocaml/dune#9772, @EmileTrotignon) - Add `only_sources` field to `copy_files` stanza (ocaml/dune#9827, fixes ocaml/dune#9709, @jchavarri) - The `(foreign_library)` stanza now supports the `(enabled_if)` field. (ocaml/dune#9914, @nojb) ### Fixed - Fix `$ dune install -p` incorrectly recognizing packages that are supposed to be filtered (ocaml/dune#9879, fixes ocaml/dune#4814, @rgrinberg) - subst: correctly handle opam files in opam/ subdirectory (ocaml/dune#9895, fixes ocaml/dune#9862, @emillon) - Odoc private rules are not set up if a library is not available due to `enabled_if` (ocaml/dune#9897, @rgrinberg and @jchavarri) ### Changed - When dune language 3.14 is enabled, resolve the binary in `(run %{bin:..} ..)` from where the binary is built. (ocaml/dune#9708, @rgrinberg) - boot: remove single-command bootstrap. This was an alternative bootstrap strategy that was used in certain conditions. Removal makes the bootstrap a bit slower on Linux when only a single core is available, but bootstrap is now reproducible in all cases. (ocaml/dune#9735, fixes ocaml/dune#9507, @emillon)
This changes the rules that build the doc to enable search using sherlodoc : https://github.com/art-w/sherlodoc/tree/jsoo
The version of sherlodoc that allows to do so is not released, this is why this is a draft PR for now. I will keep this message up to date regarding to correct version of sherlodoc to use.
There are rules both for @doc and @doc-new.
I have tests but they are not exhaustive. I do not know how to test what happens when sherlodoc is not installed, even though I tested it by hand.
Edit: sherlodoc has been released on opam, I am taking this out of draft.