2018-11-19 15:49:56 +01:00
|
|
|
#!/usr/bin/env sh
|
2015-09-17 08:54:56 +02:00
|
|
|
|
2015-09-18 02:45:10 +02:00
|
|
|
# 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.
|
|
|
|
|
2018-11-19 15:49:56 +01:00
|
|
|
set -ex
|
2015-09-17 08:54:56 +02:00
|
|
|
|
2018-11-19 15:49:56 +01:00
|
|
|
TARGETS=$(grep html_root_url src/lib.rs | sed 's/.*".*\/\(.*\)"/\1/'| sed 's/)//')
|
2015-09-18 02:45:10 +02:00
|
|
|
|
2015-09-17 08:54:56 +02:00
|
|
|
rm -rf target/doc
|
|
|
|
mkdir -p target/doc
|
|
|
|
|
2015-09-17 18:52:21 +02:00
|
|
|
cp ci/landing-page-head.html target/doc/index.html
|
|
|
|
|
2015-09-17 19:05:36 +02:00
|
|
|
for target in $TARGETS; do
|
2018-11-19 15:49:56 +01:00
|
|
|
echo "documenting ${target}"
|
2015-09-17 19:05:36 +02:00
|
|
|
|
2018-11-19 15:49:56 +01:00
|
|
|
rustdoc -o "target/doc/${target}" --target "${target}" src/lib.rs --cfg cross_platform_docs \
|
2015-09-17 18:52:21 +02:00
|
|
|
--crate-name libc
|
|
|
|
|
2018-11-19 15:49:56 +01:00
|
|
|
echo "<li><a href=\"/libc/${target}/libc/index.html\">${target}</a></li>" \
|
2015-09-17 18:52:21 +02:00
|
|
|
>> target/doc/index.html
|
2015-09-17 19:05:36 +02:00
|
|
|
done
|
2015-09-17 08:54:56 +02:00
|
|
|
|
2015-09-17 18:52:21 +02:00
|
|
|
cat ci/landing-page-footer.html >> target/doc/index.html
|
2015-09-17 08:54:56 +02:00
|
|
|
|
2015-09-18 02:45:10 +02:00
|
|
|
# If we're on travis, not a PR, and on the right branch, publish!
|
|
|
|
if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_BRANCH" = "master" ]; then
|
2016-12-15 08:32:40 +01:00
|
|
|
pip install ghp_import --install-option="--prefix=$HOME/.local"
|
2018-11-19 15:49:56 +01:00
|
|
|
"${HOME}/.local/bin/ghp-import" -n target/doc
|
|
|
|
git push -qf "https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git" gh-pages
|
2015-09-17 08:54:56 +02:00
|
|
|
fi
|