diff options
Diffstat (limited to 'third_party/libc/ci/dox.sh')
-rw-r--r-- | third_party/libc/ci/dox.sh | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/third_party/libc/ci/dox.sh b/third_party/libc/ci/dox.sh new file mode 100644 index 0000000..88d882d --- /dev/null +++ b/third_party/libc/ci/dox.sh | |||
@@ -0,0 +1,33 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # Builds documentation for all target triples that we have a registered URL for | ||
4 | # in liblibc. This scrapes the list of triples to document from `src/lib.rs` | ||
5 | # which has a bunch of `html_root_url` directives we pick up. | ||
6 | |||
7 | set -e | ||
8 | |||
9 | TARGETS=`grep html_root_url src/lib.rs | sed 's/.*".*\/\(.*\)"/\1/'` | ||
10 | |||
11 | rm -rf target/doc | ||
12 | mkdir -p target/doc | ||
13 | |||
14 | cp ci/landing-page-head.html target/doc/index.html | ||
15 | |||
16 | for target in $TARGETS; do | ||
17 | echo documenting $target | ||
18 | |||
19 | rustdoc -o target/doc/$target --target $target src/lib.rs --cfg dox \ | ||
20 | --crate-name libc | ||
21 | |||
22 | echo "<li><a href="/libc/$target/libc/index.html">$target</a></li>" \ | ||
23 | >> target/doc/index.html | ||
24 | done | ||
25 | |||
26 | cat ci/landing-page-footer.html >> target/doc/index.html | ||
27 | |||
28 | # If we're on travis, not a PR, and on the right branch, publish! | ||
29 | if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_BRANCH" = "master" ]; then | ||
30 | pip install ghp-import --user $USER | ||
31 | $HOME/.local/bin/ghp-import -n target/doc | ||
32 | git push -qf https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git gh-pages | ||
33 | fi | ||