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 * This generates the reference documentation for the core libraries that come | 6 * This generates the reference documentation for the core libraries that come |
7 * with dart. It is built on top of dartdoc, which is a general-purpose library | 7 * with dart. It is built on top of dartdoc, which is a general-purpose library |
8 * for generating docs from any Dart code. This library extends that to include | 8 * for generating docs from any Dart code. This library extends that to include |
9 * additional information and styling specific to our standard library. | 9 * additional information and styling specific to our standard library. |
10 * | 10 * |
11 * Usage: | 11 * Usage: |
12 * | 12 * |
13 * $ dart apidoc.dart [--out=<output directory>] | 13 * $ dart apidoc.dart [--out=<output directory>] |
14 */ | 14 */ |
15 library apidoc; | 15 library apidoc; |
16 | 16 |
17 import 'dart:async'; | 17 import 'dart:async'; |
18 import 'dart:io'; | 18 import 'dart:io'; |
19 import 'dart:json' as json; | 19 import 'dart:json' as json; |
20 | 20 |
21 import 'html_diff.dart'; | 21 import 'html_diff.dart'; |
22 | 22 |
23 // TODO(rnystrom): Use "package:" URL (#4968). | 23 // TODO(rnystrom): Use "package:" URL (#4968). |
24 import '../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors.dart'; | 24 import '../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors.dart'; |
25 import '../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors_util.dar
t'; | 25 import '../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors_util.dar
t'; |
26 import '../../sdk/lib/_internal/compiler/implementation/filenames.dart'; | 26 import '../../sdk/lib/_internal/compiler/implementation/filenames.dart'; |
27 import '../../sdk/lib/_internal/dartdoc/lib/dartdoc.dart'; | 27 import '../../sdk/lib/_internal/dartdoc/lib/dartdoc.dart'; |
28 import '../../sdk/lib/_internal/libraries.dart'; | 28 import '../../sdk/lib/_internal/libraries.dart'; |
29 import 'package:pathos/path.dart' as pathos; | 29 import 'package:path/path.dart' as pathos; |
30 | 30 |
31 HtmlDiff _diff; | 31 HtmlDiff _diff; |
32 | 32 |
33 void main() { | 33 void main() { |
34 final args = new Options().arguments; | 34 final args = new Options().arguments; |
35 | 35 |
36 int mode = MODE_STATIC; | 36 int mode = MODE_STATIC; |
37 Path outputDir = new Path('docs'); | 37 Path outputDir = new Path('docs'); |
38 bool generateAppCache = false; | 38 bool generateAppCache = false; |
39 | 39 |
40 List<String> excludedLibraries = <String>[]; | 40 List<String> excludedLibraries = <String>[]; |
41 | 41 |
42 // For libraries that have names matching the package name, | 42 // For libraries that have names matching the package name, |
43 // such as library unittest in package unittest, we just give | 43 // such as library unittest in package unittest, we just give |
44 // the package name with a --include-lib argument, such as: | 44 // the package name with a --include-lib argument, such as: |
45 // --include-lib=unittest. These arguments are collected in | 45 // --include-lib=unittest. These arguments are collected in |
46 // includedLibraries. | 46 // includedLibraries. |
47 List<String> includedLibraries = <String>[]; | 47 List<String> includedLibraries = <String>[]; |
48 | 48 |
49 // For libraries that lie within packages but have a different name, | 49 // For libraries that lie within packages but have a different name, |
50 // such as the matcher library in package unittest, we can use | 50 // such as the matcher library in package unittest, we can use |
51 // --extra-lib with a full relative path under pkg, such as | 51 // --extra-lib with a full relative path under pkg, such as |
52 // --extra-lib=unittest/lib/matcher.dart. These arguments are | 52 // --extra-lib=unittest/lib/matcher.dart. These arguments are |
53 // collected in extraLibraries. | 53 // collected in extraLibraries. |
54 List<String> extraLibraries = <String>[]; | 54 List<String> extraLibraries = <String>[]; |
55 | 55 |
56 String packageRoot; | 56 String packageRoot; |
57 String version; | 57 String version; |
58 | 58 |
59 // Parse the command-line arguments. | 59 // Parse the command-line arguments. |
60 for (int i = 0; i < args.length; i++) { | 60 for (int i = 0; i < args.length; i++) { |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 var memberName = '$typeName.${member.simpleName}'; | 472 var memberName = '$typeName.${member.simpleName}'; |
473 if (member is MethodMirror && member.isConstructor) { | 473 if (member is MethodMirror && member.isConstructor) { |
474 final separator = member.constructorName == '' ? '' : '.'; | 474 final separator = member.constructorName == '' ? '' : '.'; |
475 memberName = 'new $typeName$separator${member.constructorName}'; | 475 memberName = 'new $typeName$separator${member.constructorName}'; |
476 } | 476 } |
477 | 477 |
478 return a(memberUrl(member), memberName); | 478 return a(memberUrl(member), memberName); |
479 } | 479 } |
480 } | 480 } |
481 | 481 |
OLD | NEW |