OLD | NEW |
| (Empty) |
1 #!/bin/bash | |
2 | |
3 # To generate docs for a library, run this script with the path to an entrypoint | |
4 # .dart file, like: | |
5 # | |
6 # $ dartdoc foo.dart | |
7 # | |
8 # You can also pass in a couple of "special" entrypoints for generating | |
9 # docs for dart's built in libraries. The special entrypoints are: | |
10 # | |
11 # - "corelib": dart:core, dart:coreimpl | |
12 # - "dom": dart:core, dart:coreimpl, dart:dom | |
13 # - "html": dart:core, dart:coreimpl, dart:dom, dart:html | |
14 | |
15 # Get the .dart lib file the user wants to generate docs for. | |
16 # Add the path to it so that we can find it, but only if it's a .dart file and | |
17 # not one of the special fake entrypoints like "corelib". | |
18 entrypoint=$1 | |
19 if [[ $1 == *.dart ]] | |
20 then | |
21 entrypoint=$PWD/$1 | |
22 fi | |
23 | |
24 # Run from dartdoc directory to get correct relative paths. | |
25 pushd `dirname "$0"` >>/dev/null | |
26 | |
27 compileToJs() { | |
28 if [ "$1.dart" -nt "static/$1.js" ] | |
29 then | |
30 ../../frog/minfrog --libdir=../../frog/lib \ | |
31 --out=static/$1.js --compile-only $1.dart | |
32 echo "Compiled $1.dart." | |
33 fi | |
34 } | |
35 | |
36 # Generate the client-side .js files if needed. | |
37 compileToJs "client-static" | |
38 compileToJs "client-live-nav" | |
39 | |
40 # Clean the output directory. | |
41 if [ -d "docs" ]; then | |
42 rm -r docs | |
43 fi | |
44 mkdir docs | |
45 | |
46 # Copy the static files over. | |
47 cp -R static/* docs | |
48 | |
49 # Ditch the first arg so we can pass any extra arguments to dartdoc. | |
50 shift | |
51 | |
52 # Generate the user's docs. | |
53 if [ -a "../../out/Release_ia32/dart" ]; then | |
54 ../../out/Release_ia32/dart dartdoc.dart "$entrypoint" $@ | |
55 elif [ -a "../../xcodebuild/Release_ia32/dart" ]; then | |
56 ../../xcodebuild/Release_ia32/dart dartdoc.dart "$entrypoint" $@ | |
57 else | |
58 echo "Could not find the Dart VM. Did you run 'tools/build.py -m release'?" | |
59 fi | |
60 | |
61 popd >>/dev/null | |
OLD | NEW |