summaryrefslogtreecommitdiff
path: root/libc/ci/dox.sh
diff options
context:
space:
mode:
authorDaniel Mueller <deso@posteo.net>2019-05-24 18:07:22 -0700
committerDaniel Mueller <deso@posteo.net>2019-05-24 18:07:22 -0700
commit82cf43dd887801b8b22b8aae8c02854d921915d5 (patch)
treeb1bf3710bd07fe83e396a5db8563f3e6c5e85689 /libc/ci/dox.sh
parent06722702ea35434189d7de2b13a00209b2ebbd6d (diff)
downloadnitrocli-82cf43dd887801b8b22b8aae8c02854d921915d5.tar.gz
nitrocli-82cf43dd887801b8b22b8aae8c02854d921915d5.tar.bz2
Update libc crate to 0.2.55
This change updates the libc crate to version 0.2.55. Import subrepo libc/:libc at caf17a0641d29dc624621177f5756804dd180c13
Diffstat (limited to 'libc/ci/dox.sh')
-rw-r--r--libc/ci/dox.sh63
1 files changed, 50 insertions, 13 deletions
diff --git a/libc/ci/dox.sh b/libc/ci/dox.sh
index 521743e..ce55081 100644
--- a/libc/ci/dox.sh
+++ b/libc/ci/dox.sh
@@ -6,28 +6,65 @@
set -ex
-TARGETS=$(grep html_root_url src/lib.rs | sed 's/.*".*\/\(.*\)"/\1/'| sed 's/)//')
+TARGET_DOC_DIR=target/doc
+README=README.md
+PLATFORM_SUPPORT=platform-support.md
-rm -rf target/doc
-mkdir -p target/doc
+rm -rf $TARGET_DOC_DIR
+mkdir -p $TARGET_DOC_DIR
-cp ci/landing-page-head.html target/doc/index.html
+# List all targets that do currently build successfully:
+# shellcheck disable=SC1003
+grep '[\d|\w|-]* \\' ci/build.sh > targets
+sed -i.bak 's/ \\//g' targets
+grep '^[_a-zA-Z0-9-]*$' targets > tmp && mv tmp targets
-for target in $TARGETS; do
- echo "documenting ${target}"
+# Create a markdown list of supported platforms in $PLATFORM_SUPPORT
+rm $PLATFORM_SUPPORT || true
- rustdoc -o "target/doc/${target}" --target "${target}" src/lib.rs --cfg cross_platform_docs \
- --crate-name libc
+printf '### Platform-specific documentation\n' >> $PLATFORM_SUPPORT
- echo "<li><a href=\"/libc/${target}/libc/index.html\">${target}</a></li>" \
- >> target/doc/index.html
-done
+while read -r target; do
+ echo "documenting ${target}"
-cat ci/landing-page-footer.html >> target/doc/index.html
+ case "${target}" in
+ *apple*)
+ # FIXME:
+ # We can't build docs of apple targets from Linux yet.
+ continue
+ ;;
+ *)
+ ;;
+ esac
+
+ rustup target add "${target}" || true
+
+ # If cargo doc fails, then try xargo:
+ if ! cargo doc --target "${target}" \
+ --no-default-features --features extra_traits ; then
+ xargo doc --target "${target}" \
+ --no-default-features --features extra_traits
+ fi
+
+ cp -r "target/${target}/doc" "${TARGET_DOC_DIR}/${target}"
+
+ echo "* [${target}](${target}/libc/index.html)" >> $PLATFORM_SUPPORT
+done < targets
+
+# Replace <div class="platform_support"></div> with the contents of $PLATFORM_SUPPORT
+cp $README $TARGET_DOC_DIR
+line=$(grep -n '<div class="platform_docs"></div>' $README | cut -d ":" -f 1)
+
+set +x
+{ head -n "$((line-1))" $README; cat $PLATFORM_SUPPORT; tail -n "+$((line+1))" $README; } > $TARGET_DOC_DIR/$README
+set -x
+
+# Copy the licenses
+cp LICENSE-* $TARGET_DOC_DIR/
# 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
+ "${HOME}/.local/bin/ghp-import" $TARGET_DOC_DIR
git push -qf "https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git" gh-pages
fi