Skip to content

Commit

Permalink
Add support for documenting the C API (#1928)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
alexcrichton authored Jul 1, 2020
1 parent f24c7e1 commit d72b330
Show file tree
Hide file tree
Showing 5 changed files with 2,849 additions and 1 deletion.
20 changes: 20 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions crates/c-api/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
html
Loading

0 comments on commit d72b330

Please sign in to comment.