-
Notifications
You must be signed in to change notification settings - Fork 96
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
Allow more hierarchy to be compatible with -L
and -P
.
#1233
Conversation
40727d1
to
f5f0687
Compare
src/odoc/bin/main.ml
Outdated
else Ok ()) | ||
>>= fun () -> | ||
(if not (Antichain.check (lib_roots |> List.map ~f:snd)) then | ||
Error (`Msg "Paths given to all -L options must be disjoint") |
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.
Not really relevant to this PR, but wouldn't it be cleaner if Antichain.check
would return (unit, some_error) result
instead of a boolean? The error message can be customized with map_error or as a parameter to the check function.
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.
Yes, that was not very readable, hopefully I've improved it in the last commit.
e3b10bf
to
b32814b
Compare
test/integration/link_opts.t/run.t
Outdated
|
||
Specified current package is wrong: | ||
$ odoc link -P pkg:h/pkg -L otherlib:h/otherpkg h/pkg/libname/test.odoc |
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.
nit: do you want -L otherlib:h/otherpkg/otherlib
here instead?
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.
Yes. I've cleaned up the test a bit (some options were not really necessary for the test and made it less readable). Hopefully it is better now!
5431307
to
6f36972
Compare
src/odoc/bin/main.ml
Outdated
| [] -> None | ||
| _ -> | ||
find_map | ||
~f:(fun (pkg, path) -> |
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.
These names are slightly misleading as pkg
might actually be a lib. I know that was also the case before, but we might as well fix that now.
I have made more tests with the new (doc-lib)less hierarchy, and there is a small issue. I have solved this by excluding |
That |
`-P` is now allowed to contain `-L` options, and modules do not need to be below a `-L`. This gives less contraints to the hierarchy decided by the driver. In particular, this allows the hierarchy without `doc/` and `lib/` folders: pages are put directly in `pkgname/` and modules in `pkgname/libname/`. The original hierarchy is still possible.
By canonical I mean the one without doc and lib intermediate folders.
When a -L is a subfolder of -P (eg -P pkgname/ -L pkgname/libname), we don't want the content of the -L root to be included in the -P root.
746a58f
to
7eedbc8
Compare
src/odoc/bin/main.ml
Outdated
@@ -601,81 +601,49 @@ end = struct | |||
match f x with Some _ as result -> result | None -> find_map ~f l) |
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.
By the way find_map
is in Odoc_utils.List
Is there a previous discussion about this? I'm interested in having more context before forming an opinion, because naively it looks to me that it's something that should be handled in the driver (meaning that redundancies in the arguments would be intentional and should be preserved in the sidebar). But I don't have all the context :) |
I think some context can be understood by reading the discussion starting from this comment. We can also do a quick call if you'd like. |
The alternate suggestions for how to create the perfect sidebar can happen in a later PR - this one is pretty foundational for some other work so let's get this in to unblock the other PRs. |
Several changes: - Entries are now defined in the `odoc_index` library, - Entries can have new kinds (pages, source, ...) - Indexes have the form of "skeletons of entries", that can be folded. - Indexes can be created by odoc with the `odoc compile-index` command, and then consumed by sherlodoc. These changes come from: - ocaml/odoc#1228 - ocaml/odoc#1232 - ocaml/odoc#1233 - ocaml/odoc#1244 - ocaml/odoc#1250 - ocaml/odoc#1251
In the initial implementation of
-L
and-P
we added too many constraints: the trees below the roots (both-L
and-P
) had to all be disjoint.This prevented some hierarchy, such as the one where pages are put in
pkgname/
and libraries inpkgname/libname/
: indeed,-L pkgname/libname
would not be disjoint from-P pkgname/
.This PR relax the constraint,
-L
roots have to be disjoints, and-P
roots have to be disjoint, but there is no constraint between a-P
and a-L
root.It also relaxes the constraint the when linking modules, the module has to be below a
-L
.Tests are updated to use the simpler hierarchy.
I'll update the driver in another PR!