blob: 88d882dcacdd3cbf28304e7b37d156150c3621b8 [file] [log] [blame]
Alex Crichton24abc4f2015-09-16 23:54:56 -07001#!/bin/sh
2
Alex Crichtond9962f42015-09-17 17:45:10 -07003# 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 Crichton24abc4f2015-09-16 23:54:56 -07007set -e
8
Alex Crichtond9962f42015-09-17 17:45:10 -07009TARGETS=`grep html_root_url src/lib.rs | sed 's/.*".*\/\(.*\)"/\1/'`
10
Alex Crichton24abc4f2015-09-16 23:54:56 -070011rm -rf target/doc
12mkdir -p target/doc
13
Alex Crichtondab1ead2015-09-17 09:52:21 -070014cp ci/landing-page-head.html target/doc/index.html
15
Alex Crichton730a17f2015-09-17 10:05:36 -070016for target in $TARGETS; do
17 echo documenting $target
18
19 rustdoc -o target/doc/$target --target $target src/lib.rs --cfg dox \
Alex Crichtondab1ead2015-09-17 09:52:21 -070020 --crate-name libc
21
Alex Crichtonba0aea02015-11-07 15:51:58 -080022 echo "<li><a href="/libc/$target/libc/index.html">$target</a></li>" \
Alex Crichtondab1ead2015-09-17 09:52:21 -070023 >> target/doc/index.html
Alex Crichton730a17f2015-09-17 10:05:36 -070024done
Alex Crichton24abc4f2015-09-16 23:54:56 -070025
Alex Crichtondab1ead2015-09-17 09:52:21 -070026cat ci/landing-page-footer.html >> target/doc/index.html
Alex Crichton24abc4f2015-09-16 23:54:56 -070027
Alex Crichtond9962f42015-09-17 17:45:10 -070028# If we're on travis, not a PR, and on the right branch, publish!
29if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_BRANCH" = "master" ]; then
Alex Crichton24abc4f2015-09-16 23:54:56 -070030 pip install ghp-import --user $USER
31 $HOME/.local/bin/ghp-import -n target/doc
Alex Crichton41afa802015-09-16 23:56:01 -070032 git push -qf https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git gh-pages
Alex Crichton24abc4f2015-09-16 23:54:56 -070033fi