Search code examples
ocamloasis

How to force Oasis to build the documentation in a given directory?


I am using the Oasis build system for an OCaml projects and I would like to build the documentation and to get it in ${projectroot}/doc/api/.

For now, my _oasis file is something like that:

OASISFormat: 0.4
Name: MyProject
Version: 0.1alpha
Plugins: META (0.4)
BuildTools: ocamlbuild
AlphaFeatures: ocamlbuild_more_args

PostDistcleanCommand: $rm _tags myocamlbuild.ml setup.ml setup.data

Document api
Title: MyProject API
Type: ocamlbuild (0.4)
BuildTools: ocamldoc
XOCamlbuildPath: src
XOCamlbuildExtraArgs: -docflags -d,doc/api,-colorize-code,-charset,utf-8

Then, I run the following commands:

$> oasis setup
$> ocaml setup.ml -configure
...
$> ocaml setup.ml -doc
...

Then, I get a link api.docdir/ --> _build/src/api.docdir/ at the top directory of the project linking to the documentation that I expect. But, it seems that the -d doc/api with the extra-arguments has not been taken into account.

So, what did I miss ? Because, I am a bit running out of ideas here...


Solution

  • A proper way would be to use install command that will copy your documentation (as well as other data) to a proper place, that is customizable with configure command, or with InstallDir field.

    Also, if you still want to migrate your documentation inside your project, without doing the installation, then you can use PostCommand field, and use a small script (or just a one-liner) to move your documentation in a better place.