-
Notifications
You must be signed in to change notification settings - Fork 409
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
New odoc rules #8803
New odoc rules #8803
Conversation
Almost 1000 PRs/issues in between this and the previous incarnation! |
The test failures are interesting:
On the surface it seems the new results are an improvement - but I assume there's a good reason that these tests are there? |
otherlibs/stdune/src/path.ml
Outdated
@@ -862,6 +862,12 @@ let external_of_in_source_tree x = external_of_local x ~root:(Lazy.force abs_roo | |||
|
|||
let reach t ~from = | |||
match t, from with | |||
| External t, External from -> | |||
(match | |||
String.drop_prefix ~prefix:(External.to_string from ^ "/") (External.to_string t) |
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.
Why is this needed? Can't you pass external paths as absolute paths?
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.
It's for Odoc_new.local_path_of_findlib_path
- there's a comment explaining what it does. Is there a better way to do that?
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.
We have Path.drop_prefix
which might be more sensible. It also gives a Local.Path.t
which I believe is what you actually want. I'm still a bit confused about the Odoc_new.local_path_of_findlib_path
function however. It seems everywhere you use it, you split on /
and then take the head, so I think there is some other property you are trying to extract here.
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.
Ah that's probably better! This evolved over time, so I'm not at all surprised to find I'm finding a local rather than global minimum :-)
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.
and I think with that I can drop the reach
changes. Thanks!
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 don't - you're spot on, I really want the path prefix, and getting back a Path.Local.t
would be great. Sorry, I wasn't clear above. The above is what Path.drop_prefix
is giving me, not what I actually want - ie, I think Path.drop_prefix
is broken. For the above, what I'd like is to return the local path representing ocaml-compiler-libs/shadow
.
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.
OK, let me try to repro in a unit test.
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
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.
Or actually maybe intended. I guess what we really need is a Path.drop_path_prefix
function which doesn't exist.
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've created a test #8870 so that we can discuss this behaviour there.
src/dune_rules/odoc_new.ml
Outdated
;; | ||
end | ||
|
||
let contains_double_underscore s = |
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.
Which packages require this hack to work?
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.
Dream is one - the sub libraries are named with double underscores.
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.
Oh, and eio too: ocaml/odoc#1013
aadebed
to
cb6a066
Compare
src/dune_rules/odoc_new.ml
Outdated
let* findlib_paths = Context.findlib_paths ctx in | ||
let+ dwms = Valid.filter_dune_with_modules ctx ~all dwms in |
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.
You can combine this into a single let+ and+
.
src/dune_rules/odoc_new.ml
Outdated
in | ||
String.split ~on:'/' local_full | ||
in | ||
let init = [ Package (ty, List.hd local) ] in |
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.
This won't work in general. Path.explode will do what you want here. For that you will need to modify what local_path_of_findlib
returns. Windows for example does not have the same separators.
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.
But see my other comments as I am dubious to the utility of the "local_path_of_findlib_path" function.
OK, the dodgy Secondly, @rgrinberg pointed out that there might potentially be a directory name clash for some nasty cases, so added a layer of hierarchy to the output to ensure this can never happen. Thirdly, this prompted me to push through with some more logical simplifications -- essentially to structure the code more around libraries than packages, meaning mostly that I'm more treating things on a per-directory basis than a per-package-tree-of-directories basis. Sorry it took some time, it ended up being a bit of a big change. |
2f6634a
to
26320fb
Compare
FTR Sorry about closing the PR I misclicked. |
e01812f
to
bc1f86d
Compare
I think this is now ready for review again. |
1fc882f
to
56fdaf0
Compare
Signed-off-by: Jon Ludlam <[email protected]>
Signed-off-by: Rudi Grinberg <[email protected]>
Signed-off-by: Rudi Grinberg <[email protected]>
Signed-off-by: Rudi Grinberg <[email protected]>
Signed-off-by: Rudi Grinberg <[email protected]>
Signed-off-by: Rudi Grinberg <[email protected]>
Signed-off-by: Rudi Grinberg <[email protected]>
Signed-off-by: Rudi Grinberg <[email protected]>
It fell off during a refactor. Signed-off-by: Jon Ludlam <[email protected]>
Signed-off-by: Jon Ludlam <[email protected]>
Signed-off-by: Rudi Grinberg <[email protected]>
Signed-off-by: Rudi Grinberg <[email protected]>
Signed-off-by: Jon Ludlam <[email protected]>
- Switch to a new layout, with subdirs per findlib dir, one for stdlib and another for local packages. This is to avoid any potential clashes in names of directories. - Switch to a per-library (or per-directory) treatment rather than basing the behaviour on the whole package tree. E.g. treating something as fallback is now based only on the contents of the directory itself rather than any subdir in a package causing the whole package tree to be treated in the fallback way. Signed-off-by: Jon Ludlam <[email protected]>
Signed-off-by: Jon Ludlam <[email protected]>
Signed-off-by: Jon Ludlam <[email protected]>
Signed-off-by: Jon Ludlam <[email protected]>
Signed-off-by: Jon Ludlam <[email protected]>
Signed-off-by: Jon Ludlam <[email protected]>
Signed-off-by: Rudi Grinberg <[email protected]>
56fdaf0
to
8c16d88
Compare
Great Work. Sorry for all the delays. |
CHANGES: - Introduce new experimental odoc rules (ocaml/dune#8803, @jonjudlam) - Cherry-pick ocaml/dune#9177 and ocaml/dune#9201 (@emillon)
CHANGES: - Introduce `$ dune ocaml doc` to open and browse documentation. (ocaml/dune#7262, fixes ocaml/dune#6831, @EmileTrotignon) - `dune cache trim` now accepts binary byte units: `KiB`, `MiB`, etc. (ocaml/dune#8618, @Alizter) - No longer force colors for OCaml 4.03 and 4.04 (ocaml/dune#8778, @rgrinberg) - Introduce new experimental odoc rules (ocaml/dune#8803, @jonjudlam) - Introduce the `runtest_alias` field to the `cram` stanza. This allows removing default `runtest` alias from tests. (@rgrinberg, ocaml/dune#8887) - Do not ignore libraries named `bigarray` when they are defined in conjunction with OCaml 5.0 (ocaml/dune#8902, fixes ocaml/dune#8901, @rgrinberg) - Dependencies in the copying sandbox are now writeable (ocaml/dune#8920, @rgrinberg) - Absent packages shouldn't prevent all rules from being loaded (ocaml/dune#8948, fixes ocaml/dune#8630, @rgrinberg) - Correctly determine the stanza of menhir modules when `(include_subdirs qualified)` is enabled (@rgrinberg, ocaml/dune#8949, fixes ocaml/dune#7610) - Display cache location in Dune log (ocaml/dune#8974, @nojb) - Re-run actions whenever `(expand_aliases_in_sandbox)` changes (ocaml/dune#8990, @rgrinberg) - Rules that only use internal dune actions (`write-file`, `echo`, etc.) can now be sandboxed. (ocaml/dune#9041, fixes ocaml/dune#8854, @rgrinberg) - Do not re-run rules when their location changes (ocaml/dune#9052, @rgrinberg) - Correctly ignore `bigarray` on recent version of OCaml (ocaml/dune#9076, @rgrinberg) - Add `test_` prefix to default test name in `dune init project` (ocaml/dune#9257, fixes ocaml/dune#9131, @9sako6) - Add `coqdoc_flags` field to `coq` field of `env` stanza allowing the setting of workspace-wide defaults for `coqdoc_flags`. (ocaml/dune#9280, fixes ocaml/dune#9139, @Alizter) - [coq rules] Be more tolerant when coqc --print-version / --config don't work properly, and fallback to a reasonable default. This fixes problems when building Coq projects with `(stdlib no)` and likely other cases. (ocaml/dune#8966, fix ocaml/dune#8958, @Alizter, reported by Lasse Blaauwbroek) - Dune will now run at a lower framerate of 15 fps rather than 60 when `INSIDE_EMACS`. (ocaml/dune#8812, @Alizter) - dune-build-info: when `version=""` is found in a `META` file, we now return `None` as a version string (ocaml/dune#9177, @emillon) - Dune can now be built and installed on Haiku (ocaml/dune#8795, fix ocaml/dune#8551, @Alizter) - Mark installed directories in `dune-package` files. This fixes `(package)` dependencies against packages that contain such directories. (ocaml/dune#8953, fixes ocaml/dune#8915, @emillon)
This supercedes PR #7840.
This is a new set of rules that lives alongside the original odoc rules. At present it builds docs for your packages, their libraries, your private libraries and all of their dependencies. I've tested this on dune itself, ocaml.org, odoc and tezos-shell, though because this is a new target, we can and should view this as a bit experimental for a bit.
It's invoked with
dune build @doc-new
and the results are index by the main index page at_build/default/_doc_new/html/docs/index.html