Skip to content
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

Try to fix the #526 documentation issue #607

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

erikmd
Copy link
Member

@erikmd erikmd commented Feb 7, 2025

  • Kind: bugfix for documentation

Try to Fix #526 (#526 (comment))

Description

Cc @AltGr

I tried solving the "unknown lib" issue in https://ocaml.org/p/learn-ocaml/1.0.0/doc/Test_lib/index.html
by adding (public_name learn-ocaml.test_lib) and (public_name learn-ocaml.report) in the src/grader/dune file.

however, this addition recursively required setting several dune stanzas as public libraries (see last commit),
and ultimately, we end up with the following error:

$ make doc
File "src/grader/dune", line 9, characters 31-42:
9 |  (libraries json-data-encoding ocplib_i18n)
                                   ^^^^^^^^^^^
Error: Library "ocplib_i18n" is private, it cannot be a dependency of a
public library. You need to give "ocplib_i18n" a public name.
File "src/grader/dune", line 198, characters 12-23:
198 |             ocplib_i18n
                  ^^^^^^^^^^^
Error: Library "ocplib_i18n" is private, it cannot be a dependency of a
public library. You need to give "ocplib_i18n" a public name.
make: *** [Makefile:29: doc] Error 1            

To sum, there were three issues to solve:

  • Issue 1: the library learn-ocaml.test_lib does not seem to be defined currently,
    despite what is promised at this line:
    ;; (libraries learn-ocaml.test_lib)

    as a result, the published documentation says "undefined lib"
  • Issue 2: the two pages of the published documentation 1 and 2 do not include any ocamldoc comment, I dunno why.
  • Issue 3: the doc. home page does not mention Mutation_test → this is now fixed thanks to bd79ffe updating the index.mld file.

I suspect that the list of all the modules we'd like to document is here:

(ty.cmi as test_lib/ty.cmi)
(fun_ty.cmi as test_lib/fun_ty.cmi)
;; (exercise_init.cmi as test_lib/exercise_init.cmi)
(introspection_intf.cmi as test_lib/introspection_intf.cmi)
(learnocaml_internal.cmi as test_lib/learnocaml_internal.cmi)
(pre_test.cmi as test_lib/pre_test.cmi)
(learnocaml_report.cmi as test_lib/learnocaml_report.cmi)
(learnocaml_callback.cmi as test_lib/learnocaml_callback.cmi)
(test_lib.cmi as test_lib/test_lib.cmi))

and that it might suffice to tweak these stanzas:

(rule
(targets learnocaml_report.odoc)
(deps .learnocaml_report.objs/byte/learnocaml_report.cmti)
(action (run odoc compile --package learn-ocaml %{deps} -o %{targets}))
)

(rule
(targets test_lib.odoc)
(deps .testing_dyn.objs/byte/test_lib.cmti)
(action (run odoc compile --package learn-ocaml %{deps} -o %{targets}))
)

but currently I'm stuck, @AltGr can you take a look?

Checklist

Note to maintainers

  • Read this wiki page.
  • Make sure the PR has a milestone.
  • Assign yourself before merging.
  • Either do a regular merge:
    • for PRs containing several commits following conventional-commits,
    • or for PRs containing 1 commit shared with a later PR (to preserve the SHA1)
  • Or do a squash-merge:
    • for PRs containing only 1 commit (not shared with a later PR),
    • or for PRs containing several commits that need not be kept in the history;
    • Update the commit message header with a conventional-commit type,
    • Add a footer Close #… if a related issue exists.

@erikmd erikmd changed the title Fix odoc Try to fix the #526 documentation issue Feb 7, 2025
…nt'ed

(Error: `Library "_" is private, it cannot be a dependency of a public library.
You need to give "_" a public name.)

Now, the only remaining error raised by `make` is:
```
Error: Multiple rules generated for
_build/install/default/lib/learn-ocaml/test_lib/test_lib.cmi:
- src/grader/test_lib/dune:29
- src/grader/dune:41
-> required by _build/default/learn-ocaml.install
-> required by alias install
         ppx src/grader-plugins/mutation_test.pp.mli
         ppx src/grader-plugins/mutation_test.pp.ml
make: *** [Makefile:13: build] Error
```
@erikmd
Copy link
Member Author

erikmd commented Feb 8, 2025

I was able to push another small commit (similar to the last-but-one).

Now, the only remaining error raised by make is:

    Error: Multiple rules generated for
    _build/install/default/lib/learn-ocaml/test_lib/test_lib.cmi:
    - src/grader/test_lib/dune:29
    - src/grader/dune:41
    -> required by _build/default/learn-ocaml.install
    -> required by alias install
             ppx src/grader-plugins/mutation_test.pp.mli
             ppx src/grader-plugins/mutation_test.pp.ml
    make: *** [Makefile:13: build] Error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Question: Why https://ocaml.org/p/learn-ocaml/latest says Documentation status is unknown?
1 participant