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

Ian Hickson's avatar
Ian Hickson committed
4 5 6
# If you want to run this script locally, make sure you run it from
# the root of the flutter repository.

7 8
# This is called from travis_upload.sh on Travis.

9 10 11
# Make sure dart is installed
bin/flutter --version

12
# Install dartdoc.
13
bin/cache/dart-sdk/bin/pub global activate dartdoc 0.14.1
Seth Ladd's avatar
Seth Ladd committed
14 15

# This script generates a unified doc set, and creates
Ian Hickson's avatar
Ian Hickson committed
16
# a custom index.html, placing everything into dev/docs/doc.
17 18
(cd dev/tools; ../../bin/cache/dart-sdk/bin/pub get)
FLUTTER_ROOT=$PWD bin/cache/dart-sdk/bin/dart dev/tools/dartdoc.dart
19
FLUTTER_ROOT=$PWD bin/cache/dart-sdk/bin/dart dev/tools/java_and_objc_doc.dart
20

Seth Ladd's avatar
Seth Ladd committed
21 22
# Ensure google webmaster tools can verify our site.
cp dev/docs/google2ed1af765c529f57.html dev/docs/doc
23

24 25 26 27 28 29 30
# Upload new API docs when on Travis
if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
  if [ "$TRAVIS_BRANCH" == "master" -o "$TRAVIS_BRANCH" == "alpha" ]; then
    cd dev/docs

    if [ "$TRAVIS_BRANCH" == "master" ]; then
      echo -e "User-agent: *\nDisallow: /" > doc/robots.txt
31 32 33 34 35
      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
36 37 38
    fi

    if [ "$TRAVIS_BRANCH" == "alpha" ]; then
39 40 41 42 43
      while : ; do
        firebase deploy --project docs-flutter-io && break
        echo Error: Unable to deploy documentation to firebase. Retrying in five seconds...
        sleep 5
      done
44
    fi
45
  fi
46
fi