| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * To generate docs for a library, run this script with the path to an | 6 * To generate docs for a library, run this script with the path to an |
| 7 * entrypoint .dart file, like: | 7 * entrypoint .dart file, like: |
| 8 * | 8 * |
| 9 * $ dart dartdoc.dart foo.dart | 9 * $ dart dartdoc.dart foo.dart |
| 10 * | 10 * |
| 11 * This will create a "docs" directory with the docs for your libraries. To | 11 * This will create a "docs" directory with the docs for your libraries. To |
| 12 * create these beautiful docs, dartdoc parses your library and every library | 12 * create these beautiful docs, dartdoc parses your library and every library |
| 13 * it imports (recursively). From each library, it parses all classes and | 13 * it imports (recursively). From each library, it parses all classes and |
| 14 * members, finds the associated doc comments and builds crosslinked docs from | 14 * members, finds the associated doc comments and builds crosslinked docs from |
| 15 * them. | 15 * them. |
| 16 */ | 16 */ |
| 17 #library('dartdoc'); | 17 #library('dartdoc'); |
| 18 | 18 |
| 19 #import('dart:io'); | 19 #import('dart:io'); |
| 20 | 20 |
| 21 // TODO(rnystrom): Use "package:" URL (#4968). | 21 // TODO(rnystrom): Use "package:" URL (#4968). |
| 22 #import('../lib/dartdoc.dart'); | 22 #import('../lib/dartdoc.dart'); |
| 23 | 23 |
| 24 // TODO(johnniwinther): Note that [IN_SDK] gets initialized to true when this | |
| 25 // file is modified by the SDK deployment script. If you change, be sure to test | |
| 26 // that dartdoc still works when run from the built SDK directory. | |
| 27 const bool _IN_SDK = false; | |
| 28 | |
| 29 // TODO(johnniwinther): Trailing slashes matter due to the use of [libPath] as | |
| 30 // a base URI with [Uri.resolve]. | |
| 31 /// Relative path to the library in which dart2js resides. | |
| 32 Path get libPath => _IN_SDK | |
| 33 ? scriptDir.append('../../../lib/dart2js/') | |
| 34 : scriptDir.append('../../../'); | |
| 35 | |
| 36 /** | 24 /** |
| 37 * Run this from the `pkg/dartdoc` directory. | 25 * Run this from the `pkg/dartdoc` directory. |
| 38 */ | 26 */ |
| 39 main() { | 27 main() { |
| 40 final args = new Options().arguments; | 28 final args = new Options().arguments; |
| 41 | 29 |
| 42 final dartdoc = new Dartdoc(); | 30 final dartdoc = new Dartdoc(); |
| 31 |
| 32 final libPath = scriptDir.append('../../../'); |
| 43 dartdoc.dartdocPath = libPath.append('pkg/dartdoc'); | 33 dartdoc.dartdocPath = libPath.append('pkg/dartdoc'); |
| 44 | 34 |
| 45 if (args.isEmpty()) { | 35 if (args.isEmpty()) { |
| 46 print('No arguments provided.'); | 36 print('No arguments provided.'); |
| 47 printUsage(); | 37 printUsage(); |
| 48 return; | 38 return; |
| 49 } | 39 } |
| 50 | 40 |
| 51 final entrypoints = <Path>[]; | 41 final entrypoints = <Path>[]; |
| 52 | 42 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 names. | 170 names. |
| 181 | 171 |
| 182 --exclude-lib=<libs> Use this option to explicitly specify which | 172 --exclude-lib=<libs> Use this option to explicitly specify which |
| 183 libraries to exclude from the documentation. If | 173 libraries to exclude from the documentation. If |
| 184 omitted, no libraries are excluded. <libs> is | 174 omitted, no libraries are excluded. <libs> is |
| 185 comma-separated list of library names. | 175 comma-separated list of library names. |
| 186 | 176 |
| 187 --verbose Print verbose information during generation. | 177 --verbose Print verbose information during generation. |
| 188 '''); | 178 '''); |
| 189 } | 179 } |
| OLD | NEW |