libc-rs/ci/dox.sh
Christian Legnitto a41c074645 Fix doc generation on travis.
Documentation generation appears to be failing on master (https://travis-ci.org/rust-lang/libc/jobs/183483333):

```
Collecting ghp-import
  Downloading ghp-import-0.4.1.tar.gz
Collecting travis
  Could not find a version that satisfies the requirement travis (from versions: )
No matching distribution found for travis
```

Basically `--user` doesn't appear to take an option, so `pip install ghp_import --user $USER` makes pip think the user is a package that needs to be installed (in this case `travis`). As there is no `travis` package, it dies.
2016-12-14 23:35:58 -08:00

34 lines
1.0 KiB
Bash

#!/bin/sh
# Builds documentation for all target triples that we have a registered URL for
# in liblibc. This scrapes the list of triples to document from `src/lib.rs`
# which has a bunch of `html_root_url` directives we pick up.
set -e
TARGETS=`grep html_root_url src/lib.rs | sed 's/.*".*\/\(.*\)"/\1/'`
rm -rf target/doc
mkdir -p target/doc
cp ci/landing-page-head.html target/doc/index.html
for target in $TARGETS; do
echo documenting $target
rustdoc -o target/doc/$target --target $target src/lib.rs --cfg dox \
--crate-name libc
echo "<li><a href="/libc/$target/libc/index.html">$target</a></li>" \
>> target/doc/index.html
done
cat ci/landing-page-footer.html >> target/doc/index.html
# If we're on travis, not a PR, and on the right branch, publish!
if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_BRANCH" = "master" ]; then
pip install ghp_import --install-option="--prefix=$HOME/.local"
$HOME/.local/bin/ghp-import -n target/doc
git push -qf https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git gh-pages
fi