| 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 | 15 |
| 16 #library('apidoc'); | 16 #library('apidoc'); |
| 17 | 17 |
| 18 #import('dart:io'); | 18 #import('dart:io'); |
| 19 #import('dart:json'); | 19 #import('dart:json'); |
| 20 #import('html_diff.dart'); | 20 #import('html_diff.dart'); |
| 21 #import('../../pkg/dartdoc/mirrors/mirrors.dart'); | 21 #import('../../pkg/dartdoc/mirrors/mirrors.dart'); |
| 22 #import('../../pkg/dartdoc/mirrors/mirrors_util.dart'); | 22 #import('../../pkg/dartdoc/mirrors/mirrors_util.dart'); |
| 23 #import('../../pkg/dartdoc/dartdoc.dart', prefix: 'doc'); | 23 #import('../../pkg/dartdoc/dartdoc.dart', prefix: 'doc'); |
| 24 #import('../../lib/compiler/implementation/library_map.dart'); | 24 #import('../../lib/_internal/libraries.dart'); |
| 25 | 25 |
| 26 HtmlDiff _diff; | 26 HtmlDiff _diff; |
| 27 | 27 |
| 28 void main() { | 28 void main() { |
| 29 final args = new Options().arguments; | 29 final args = new Options().arguments; |
| 30 | 30 |
| 31 int mode = doc.MODE_STATIC; | 31 int mode = doc.MODE_STATIC; |
| 32 Path outputDir = const Path('docs'); | 32 Path outputDir = const Path('docs'); |
| 33 bool generateAppCache = false; | 33 bool generateAppCache = false; |
| 34 | 34 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 <Path>[doc.scriptDir.append('../../lib/html/doc/html.dartdoc')], | 97 <Path>[doc.scriptDir.append('../../lib/html/doc/html.dartdoc')], |
| 98 doc.libPath); | 98 doc.libPath); |
| 99 print('Processing handwritten HTML documentation...'); | 99 print('Processing handwritten HTML documentation...'); |
| 100 | 100 |
| 101 // Process libraries. | 101 // Process libraries. |
| 102 | 102 |
| 103 // TODO(johnniwinther): Libraries for the compilation seem to be more like | 103 // TODO(johnniwinther): Libraries for the compilation seem to be more like |
| 104 // URIs. Perhaps Path should have a toURI() method. | 104 // URIs. Perhaps Path should have a toURI() method. |
| 105 // Add all of the core libraries. | 105 // Add all of the core libraries. |
| 106 final apidocLibraries = <Path>[]; | 106 final apidocLibraries = <Path>[]; |
| 107 DART2JS_LIBRARY_MAP.forEach((String name, LibraryInfo info) { | 107 LIBRARIES.forEach((String name, LibraryInfo info) { |
| 108 if (!info.isInternal) { | 108 if (!info.internal && !info.undocumented) { |
| 109 apidocLibraries.add(new Path('dart:$name')); | 109 apidocLibraries.add(new Path('dart:$name')); |
| 110 } | 110 } |
| 111 }); | 111 }); |
| 112 | 112 |
| 113 final includedLibraries = <String>[]; | 113 final includedLibraries = <String>[]; |
| 114 var lister = new Directory.fromPath( | 114 var lister = new Directory.fromPath( |
| 115 doc.scriptDir.append('../../pkg/')).list(); | 115 doc.scriptDir.append('../../pkg/')).list(); |
| 116 lister.onDir = (dirPath) { | 116 lister.onDir = (dirPath) { |
| 117 var path = new Path(dirPath); | 117 var path = new Path(dirPath); |
| 118 var libname = path.filename; | 118 var libname = path.filename; |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 final typeName = member.surroundingDeclaration.simpleName; | 526 final typeName = member.surroundingDeclaration.simpleName; |
| 527 var memberName = '$typeName.${member.simpleName}'; | 527 var memberName = '$typeName.${member.simpleName}'; |
| 528 if (member is MethodMirror && (member.isConstructor || member.isFactory)) { | 528 if (member is MethodMirror && (member.isConstructor || member.isFactory)) { |
| 529 final separator = member.constructorName == '' ? '' : '.'; | 529 final separator = member.constructorName == '' ? '' : '.'; |
| 530 memberName = 'new $typeName$separator${member.constructorName}'; | 530 memberName = 'new $typeName$separator${member.constructorName}'; |
| 531 } | 531 } |
| 532 | 532 |
| 533 return a(memberUrl(member), memberName); | 533 return a(memberUrl(member), memberName); |
| 534 } | 534 } |
| 535 } | 535 } |
| OLD | NEW |