Add support for documenting the C API (#1928)

This commit adds a bit of a skeleton of what it might look like to
document the C API. Today the C API has virtually zero documentation
because the upstream documentation does not exist and we haven't put a
ton of effort into documenting our own extensions. Given that this is
one of the main vectors we expect users to use Wasmtime, we should make
sure it's thoroughly documented!

I've never really done much documentation generation of C myself before,
but I did a bit of searching and Doxygen seems reasonable proficient for
doing this. This commit sets up what it might look like for Doxygen to
be used for the C API. One nice feature of DOxygen is that we can
document the items in `wasm.h` without actually modifying `wasm.h`. For
those purposes a `doc-wasm.h` file was added here which is where we can
put Wasmtime-specific documentation about `wasm.h`.

There's quite a few functions in the C API so I didn't want to get them
all done before getting consensus on this. I've started some skeletons
of documentation for global types in `wasm.h` and also confirmed that
documentation works for our own `wasmtime.h` and such header files. If
this looks good to everyone and it runs reasonable well on CI then I can
spend more time filling out the rest of the documentation.
This commit is contained in:
Alex Crichton
2020-07-01 14:05:18 -05:00
committed by GitHub
parent f24c7e1249
commit d72b330de2
5 changed files with 2849 additions and 1 deletions

View File

@@ -65,6 +65,21 @@ jobs:
name: doc-api
path: target/doc
doc_capi:
name: Doc - build the C API documentation
runs-on: ubuntu-latest
container: ubuntu:20.04
steps:
- run: apt-get update && apt-get install -y doxygen git
- uses: actions/checkout@v2
with:
submodules: true
- run: cd crates/c-api && doxygen doxygen.conf
- uses: actions/upload-artifact@v1
with:
name: doc-c-api
path: crates/c-api/html
# Quick checks of various feature combinations and whether things
# compile. The goal here isn't to run tests, mostly just serve as a
# double-check that Rust code compiles and is likely to work everywhere else.
@@ -437,6 +452,10 @@ jobs:
uses: actions/download-artifact@v1
with:
name: doc-api
- name: Download C API docs
uses: actions/download-artifact@v1
with:
name: doc-c-api
- name: Download x86_64 macOS binaries
uses: actions/download-artifact@v1
with:
@@ -462,6 +481,7 @@ jobs:
run: |
mv doc-book gh-pages
mv doc-api gh-pages/api
mv doc-c-api gh-pages/c-api
# If this is a push to the main branch push to the `gh-pages` using a
# deploy key. Note that a deploy key is necessary for now because otherwise