]>
Commit | Line | Data |
---|---|---|
92a42be0 SL |
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 | ||
83c7162d | 19 | rustdoc -o target/doc/$target --target $target src/lib.rs --cfg cross_platform_docs \ |
92a42be0 SL |
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 | |
32a655c1 | 30 | pip install ghp_import --install-option="--prefix=$HOME/.local" |
92a42be0 SL |
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 |