Alex Crichton | 24abc4f | 2015-09-16 23:54:56 -0700 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
Alex Crichton | d9962f4 | 2015-09-17 17:45:10 -0700 | [diff] [blame] | 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 | |
Alex Crichton | 24abc4f | 2015-09-16 23:54:56 -0700 | [diff] [blame] | 7 | set -e |
| 8 | |
Alex Crichton | d9962f4 | 2015-09-17 17:45:10 -0700 | [diff] [blame] | 9 | TARGETS=`grep html_root_url src/lib.rs | sed 's/.*".*\/\(.*\)"/\1/'` |
| 10 | |
Alex Crichton | 24abc4f | 2015-09-16 23:54:56 -0700 | [diff] [blame] | 11 | rm -rf target/doc |
| 12 | mkdir -p target/doc |
| 13 | |
Alex Crichton | dab1ead | 2015-09-17 09:52:21 -0700 | [diff] [blame] | 14 | cp ci/landing-page-head.html target/doc/index.html |
| 15 | |
Alex Crichton | 730a17f | 2015-09-17 10:05:36 -0700 | [diff] [blame] | 16 | for target in $TARGETS; do |
| 17 | echo documenting $target |
| 18 | |
| 19 | rustdoc -o target/doc/$target --target $target src/lib.rs --cfg dox \ |
Alex Crichton | dab1ead | 2015-09-17 09:52:21 -0700 | [diff] [blame] | 20 | --crate-name libc |
| 21 | |
Alex Crichton | ba0aea0 | 2015-11-07 15:51:58 -0800 | [diff] [blame] | 22 | echo "<li><a href="/libc/$target/libc/index.html">$target</a></li>" \ |
Alex Crichton | dab1ead | 2015-09-17 09:52:21 -0700 | [diff] [blame] | 23 | >> target/doc/index.html |
Alex Crichton | 730a17f | 2015-09-17 10:05:36 -0700 | [diff] [blame] | 24 | done |
Alex Crichton | 24abc4f | 2015-09-16 23:54:56 -0700 | [diff] [blame] | 25 | |
Alex Crichton | dab1ead | 2015-09-17 09:52:21 -0700 | [diff] [blame] | 26 | cat ci/landing-page-footer.html >> target/doc/index.html |
Alex Crichton | 24abc4f | 2015-09-16 23:54:56 -0700 | [diff] [blame] | 27 | |
Alex Crichton | d9962f4 | 2015-09-17 17:45:10 -0700 | [diff] [blame] | 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 |
Alex Crichton | 24abc4f | 2015-09-16 23:54:56 -0700 | [diff] [blame] | 30 | pip install ghp-import --user $USER |
| 31 | $HOME/.local/bin/ghp-import -n target/doc |
Alex Crichton | 41afa80 | 2015-09-16 23:56:01 -0700 | [diff] [blame] | 32 | git push -qf https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git gh-pages |
Alex Crichton | 24abc4f | 2015-09-16 23:54:56 -0700 | [diff] [blame] | 33 | fi |