docs.sh 2.02 KB
Newer Older
1
#!/bin/bash
2
set -e
3

4 5
echo "Running docs.sh"

Ian Hickson's avatar
Ian Hickson committed
6 7
# If you want to run this script locally, make sure you run it from
# the root of the flutter repository.
8
export FLUTTER_ROOT="$PWD"
Ian Hickson's avatar
Ian Hickson committed
9

10 11
# This is called from travis_upload.sh on Travis.

12 13 14
# Make sure dart is installed
bin/flutter --version

15 16 17 18 19 20 21 22
# If the pub cache directory exists in the root, then use that.
FLUTTER_PUB_CACHE="$FLUTTER_ROOT/.pub-cache"
if [ -d "$FLUTTER_PUB_CACHE" ]; then
  # This has to be exported, because pub interprets setting it
  # to the empty string in the same way as setting it to ".".
  export PUB_CACHE="${PUB_CACHE:-"$FLUTTER_PUB_CACHE"}"
fi

23
# Install dartdoc.
24
bin/cache/dart-sdk/bin/pub global activate dartdoc 0.16.0
Seth Ladd's avatar
Seth Ladd committed
25 26

# This script generates a unified doc set, and creates
Ian Hickson's avatar
Ian Hickson committed
27
# a custom index.html, placing everything into dev/docs/doc.
28
(cd dev/tools; ../../bin/cache/dart-sdk/bin/pub get)
29 30
bin/cache/dart-sdk/bin/dart dev/tools/dartdoc.dart
bin/cache/dart-sdk/bin/dart dev/tools/java_and_objc_doc.dart
31

Seth Ladd's avatar
Seth Ladd committed
32 33
# Ensure google webmaster tools can verify our site.
cp dev/docs/google2ed1af765c529f57.html dev/docs/doc
34

35 36
# Upload new API docs when on Travis
if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
37 38
  echo "This is not a pull request; considering whether to upload docs... (branch=$TRAVIS_BRANCH)"
  if [ "$TRAVIS_BRANCH" == "master" -o "$TRAVIS_BRANCH" == "dev" ]; then
39 40 41
    cd dev/docs

    if [ "$TRAVIS_BRANCH" == "master" ]; then
42
      echo "Updating master docs: https://master-docs-flutter-io.firebaseapp.com/"
43
      echo -e "User-agent: *\nDisallow: /" > doc/robots.txt
44 45 46 47 48
      while : ; do
        firebase deploy --project master-docs-flutter-io && break
        echo Error: Unable to deploy documentation to firebase. Retrying in five seconds...
        sleep 5
      done
49 50
    fi

51 52
    if [ "$TRAVIS_BRANCH" == "beta" ]; then
      echo "Updating beta docs: https://docs.flutter.io/"
53 54 55 56 57
      while : ; do
        firebase deploy --project docs-flutter-io && break
        echo Error: Unable to deploy documentation to firebase. Retrying in five seconds...
        sleep 5
      done
58
    fi
59
  fi
60
fi