|
1 | 1 | #!/bin/bash |
2 | 2 | . $(dirname $0)/env.sh |
3 | 3 |
|
4 | | -# Use the -d flag to set the directory for the dartdoc viewer build files |
5 | | -while getopts ":d:" opt ; do |
6 | 4 |
|
7 | | - case $opt in |
8 | | - d) |
9 | | - DOCVIEWER_DIR=$OPTARG |
10 | | - DOCDIR_OPTION="--out "$DOCVIEWER_DIR"/web/docs" |
11 | | - echo "Generated docs will be output to: $DOCVIEWER_DIR/web/docs" >&2 |
12 | | - ;; |
13 | | - \?) |
14 | | - echo "Invalid option: -$OPTARG" >&2 |
15 | | - exit 1 |
16 | | - ;; |
17 | | - :) |
18 | | - echo "Use -d to specify the directory where the dartdoc viewer pubspec.yaml is located." >&2 |
19 | | - exit 1 |
20 | | - ;; |
21 | | - esac |
22 | | -done |
23 | | - |
24 | | -# Temporary change to delete the Build Status image markdown from the README (image md not supported by dartdoc-viewer) |
25 | | - cp README.md README-orig.md |
26 | | - cat README-orig.md | sed "1s/^AngularDart.*/AngularDart/" > README.md |
27 | | - |
28 | | -# Temporary during transition period from use of dartdoc to docgen. |
29 | | -if [ -x "$DART_DOCGEN" ]; then |
30 | | - DOC_CMD="$DART_DOCGEN" |
31 | | - MODE_OPTION="--start-page=angular \ |
32 | | - --exclude-lib=js,metadata,meta,mirrors,intl,number_symbols,number_symbol_data,intl_helpers,date_format_internal,date_symbols,angular.util \ |
33 | | - --no-include-sdk" |
34 | | - |
35 | | -elif [ -x "$DARTDOC" ]; then |
36 | | - DOC_CMD="$DARTDOC" |
37 | | - MODE_OPTION="--mode=static" |
38 | | -fi |
39 | | - |
40 | | -echo "Generating documentation using $DOC_CMD $MODE_OPTION $DOCDIR_OPTION" |
41 | | -"$DOC_CMD" $MODE_OPTION $DOCDIR_OPTION \ |
42 | | - --package-root=packages/ \ |
43 | | - lib/angular.dart lib/utils.dart lib/change_detection/watch_group.dart lib/core/module.dart lib/core_dom/module.dart lib/filter/module.dart lib/directive/module.dart lib/mock/module.dart lib/perf/module.dart lib/playback/playback_data.dart lib/playback/playback_http.dart lib/routing/module.dart lib/tools/common.dart lib/tools/expression_extractor.dart lib/tools/io.dart lib/tools/io_impl.dart lib/tools/source_crawler_impl.dart lib/tools/source_metadata_extractor.dart lib/tools/template_cache_annotation.dart lib/tools/template_cache_generator.dart |
44 | | - |
45 | | -if [ -x "$DART_DOCGEN" ]; then |
46 | | -# Set the Version for dartdoc-viewer |
47 | | - head CHANGELOG.md | awk 'NR==2' | sed 's/^# //' > VERSION |
48 | | - mv VERSION $DOCVIEWER_DIR/web/docs |
49 | | - (cd $DOCVIEWER_DIR; pub build) |
50 | | - |
51 | | -# Revert the temp copy of the README.md file |
52 | | - mv README-orig.md README.md |
53 | | -fi |
| 5 | +# Dart doc can not be run from the same directory as dartdoc-viewer |
| 6 | +# see: https://code.google.com/p/dart/issues/detail?id=17231 |
| 7 | +cd lib |
| 8 | + |
| 9 | +echo "Generating documentation" |
| 10 | +"$DART_DOCGEN" $DOC_OPTION $DOCDIR_OPTION \ |
| 11 | + --out ../docs \ |
| 12 | + --start-page=angular \ |
| 13 | + --exclude-lib=js,metadata,meta,mirrors,intl,number_symbols,number_symbol_data,intl_helpers,date_format_internal,date_symbols,angular.util \ |
| 14 | + --no-include-sdk \ |
| 15 | + --package-root=../packages/ \ |
| 16 | + ../lib/angular.dart \ |
| 17 | + ../lib/utils.dart \ |
| 18 | + ../lib/change_detection/watch_group.dart \ |
| 19 | + ../lib/core/module.dart \ |
| 20 | + ../lib/core_dom/module.dart \ |
| 21 | + ../lib/filter/module.dart \ |
| 22 | + ../lib/directive/module.dart \ |
| 23 | + ../lib/mock/module.dart \ |
| 24 | + ../lib/perf/module.dart \ |
| 25 | + ../lib/playback/playback_data.dart \ |
| 26 | + ../lib/playback/playback_http.dart \ |
| 27 | + ../lib/routing/module.dart \ |
| 28 | + ../lib/tools/common.dart \ |
| 29 | + ../lib/tools/expression_extractor.dart \ |
| 30 | + ../lib/tools/io.dart \ |
| 31 | + ../lib/tools/io_impl.dart \ |
| 32 | + ../lib/tools/source_crawler_impl.dart \ |
| 33 | + ../lib/tools/source_metadata_extractor.dart \ |
| 34 | + ../lib/tools/template_cache_annotation.dart \ |
| 35 | + ../lib/tools/template_cache_generator.dart |
| 36 | + |
| 37 | +cd .. |
| 38 | + |
| 39 | +DOCVIEWER_DIR="dartdoc-viewer"; |
| 40 | +if [ ! -d "$DOCVIEWER_DIR" ]; then |
| 41 | + git clone https://github.com/angular/dartdoc-viewer.git -b angular-skin $DOCVIEWER_DIR |
| 42 | +fi; |
| 43 | + |
| 44 | +head CHANGELOG.md | awk 'NR==2' | sed 's/^# //' > docs/VERSION |
| 45 | +rm -rf $DOCVIEWER_DIR/client/web/docs/ |
| 46 | +mv docs/ $DOCVIEWER_DIR/client/web/docs/ |
| 47 | +(cd $DOCVIEWER_DIR/client; pub build) |
0 commit comments