Skip to content

Conversation

@leostera
Copy link
Collaborator

@leostera leostera commented Feb 18, 2019

Opening for visibility 🗣

Purpose

To properly adopt odoc as the official documentation tool in BuckleScript, I figured it made sense to have its libraries built with it. This PR attempts to rebuild the documentation for the Belt and Js libraries.

This builds, indirectly, towards #3198 Automatic Documentation Generation.

Approach

odoc is included as a development time dependency of BuckleScript, and it's managed via esy. The reason to do this is to avoid versioning conflicts, as odoc must be compiled with the same compiler version used to compile the artifacts it will work on.

That is, if odoc is compiled with 4.06, it will not work with artifacts from a 4.02 compiler.

From there, odoc is invoked through esy in a special ninja flow: jscomp/docs.ninja. This flow will take care of building all the .cmti files required, and turning them into .odoc files. Ultimately, it will turn those into .html files ready for publishing.

Conflicts

Belt and Js are built with bsc, which uses a patched typed tree that breaks odoc's expectations of a standard 4.02.3 .cmti file. This means that we need to build odoc with the exact compiler version used by bsc. That is, 4.02.3+BS, the compiler fork that lives here: https://github.com/BuckleScript/ocaml

To make use of that fork, we can extend it to be included as an esy dependency (rescript-lang/ocaml#24). I could use some help in getting this in a working state. Refer to that PR for more info.


Still working through it, let me know what you think!

cc/ @bobzhang @jordwalke @ryyppy @nikgraf

@leostera leostera changed the title Docs/build with odoc Build Belt/Js docs with ODoc Feb 18, 2019
@leostera
Copy link
Collaborator Author

First result :) screenshot 2019-02-18 at 15 09 04
screenshot 2019-02-18 at 15 08 56

@leostera
Copy link
Collaborator Author

Some more screenshots of the progress:

screenshot 2019-02-18 at 16 07 55
screenshot 2019-02-18 at 16 28 09
screenshot 2019-02-18 at 16 28 29
screenshot 2019-02-18 at 15 52 14

@leostera
Copy link
Collaborator Author

leostera commented Feb 18, 2019

Todo:

  • Generate top-level module list
  • Update odoc to latest master
  • Tighten up jscomp/docs.ninja dep graph
  • Figure out some concurrency problems with esy x odoc
  • Figure out why odoc master fails on bisect_ppx preprocessing
  • Point ocaml esy resolution to https://github.com/BuckleScript/ocaml
@bobzhang
Copy link
Member

@leostera
Copy link
Collaborator Author

I can't seem to find a lot of time to work on this lately, so I'll open it up for Review in the meantime. Please consider the Todo list above!

@leostera leostera marked this pull request as ready for review March 26, 2019 05:59
@cristianoc
Copy link
Collaborator

Closing as stale. There are other relevant discussions elsewhere.

@cristianoc cristianoc closed this Jun 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants