| 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 * |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 scriptDir.append('../../sdk/lib/_internal/dartdoc/'); | 143 scriptDir.append('../../sdk/lib/_internal/dartdoc/'); |
| 144 // Select the libraries to include in the produced documentation: | 144 // Select the libraries to include in the produced documentation: |
| 145 apidoc.includeApi = true; | 145 apidoc.includeApi = true; |
| 146 apidoc.includedLibraries = includedLibraries; | 146 apidoc.includedLibraries = includedLibraries; |
| 147 | 147 |
| 148 // TODO(amouravski): make apidoc use roughly the same flow as bin/dartdoc. | 148 // TODO(amouravski): make apidoc use roughly the same flow as bin/dartdoc. |
| 149 Future.wait([copiedStatic, copiedApiDocStatic, htmlDiff]) | 149 Future.wait([copiedStatic, copiedApiDocStatic, htmlDiff]) |
| 150 .then((_) => apidoc.documentLibraries(apidocLibraries, libPath, pkgPath)) | 150 .then((_) => apidoc.documentLibraries(apidocLibraries, libPath, pkgPath)) |
| 151 .then((_) => compileScript(mode, outputDir, libPath)) | 151 .then((_) => compileScript(mode, outputDir, libPath)) |
| 152 .then((_) => print(apidoc.status)) | 152 .then((_) => print(apidoc.status)) |
| 153 .catchError((e) => print('Error: generation failed: ${e.error}')) | 153 .catchError((e) { |
| 154 print('Error: generation failed: ${e}'); |
| 155 apidoc.cleanup(); |
| 156 exit(1); |
| 157 }) |
| 154 .whenComplete(() => apidoc.cleanup()); | 158 .whenComplete(() => apidoc.cleanup()); |
| 155 }); | 159 }); |
| 156 } | 160 } |
| 157 | 161 |
| 158 class Apidoc extends Dartdoc { | 162 class Apidoc extends Dartdoc { |
| 159 /** Big ball of JSON containing the scraped MDN documentation. */ | 163 /** Big ball of JSON containing the scraped MDN documentation. */ |
| 160 final Map mdn; | 164 final Map mdn; |
| 161 | 165 |
| 162 | 166 |
| 163 // A set of type names (TypeMirror.simpleName values) to ignore while | 167 // A set of type names (TypeMirror.simpleName values) to ignore while |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 final typeName = member.owner.simpleName; | 439 final typeName = member.owner.simpleName; |
| 436 var memberName = '$typeName.${member.simpleName}'; | 440 var memberName = '$typeName.${member.simpleName}'; |
| 437 if (member is MethodMirror && (member.isConstructor || member.isFactory)) { | 441 if (member is MethodMirror && (member.isConstructor || member.isFactory)) { |
| 438 final separator = member.constructorName == '' ? '' : '.'; | 442 final separator = member.constructorName == '' ? '' : '.'; |
| 439 memberName = 'new $typeName$separator${member.constructorName}'; | 443 memberName = 'new $typeName$separator${member.constructorName}'; |
| 440 } | 444 } |
| 441 | 445 |
| 442 return a(memberUrl(member), memberName); | 446 return a(memberUrl(member), memberName); |
| 443 } | 447 } |
| 444 } | 448 } |
| OLD | NEW |