| 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 // Select the libraries to include in the produced documentation: | 175 // Select the libraries to include in the produced documentation: |
| 176 apidoc.includeApi = true; | 176 apidoc.includeApi = true; |
| 177 apidoc.includedLibraries = includedLibraries; | 177 apidoc.includedLibraries = includedLibraries; |
| 178 | 178 |
| 179 // TODO(amouravski): make apidoc use roughly the same flow as bin/dartdoc. | 179 // TODO(amouravski): make apidoc use roughly the same flow as bin/dartdoc. |
| 180 Future.wait([copiedStatic, copiedApiDocStatic, htmlDiff]) | 180 Future.wait([copiedStatic, copiedApiDocStatic, htmlDiff]) |
| 181 .then((_) => apidoc.documentLibraries(apidocLibraries, libPath, | 181 .then((_) => apidoc.documentLibraries(apidocLibraries, libPath, |
| 182 packageRoot)) | 182 packageRoot)) |
| 183 .then((_) => compileScript(mode, outputDir, libPath, apidoc.tmpPath)) | 183 .then((_) => compileScript(mode, outputDir, libPath, apidoc.tmpPath)) |
| 184 .then((_) => print(apidoc.status)) | 184 .then((_) => print(apidoc.status)) |
| 185 .catchError((e) { | 185 .catchError((e, trace) { |
| 186 print('Error: generation failed: ${e}'); | 186 print('Error: generation failed: ${e}'); |
| 187 var trace = getAttachedStackTrace(e); | |
| 188 if (trace != null) print("StackTrace: $trace"); | 187 if (trace != null) print("StackTrace: $trace"); |
| 189 apidoc.cleanup(); | 188 apidoc.cleanup(); |
| 190 exit(1); | 189 exit(1); |
| 191 }) | 190 }) |
| 192 .whenComplete(() => apidoc.cleanup()); | 191 .whenComplete(() => apidoc.cleanup()); |
| 193 }); | 192 }); |
| 194 } | 193 } |
| 195 | 194 |
| 196 class Apidoc extends Dartdoc { | 195 class Apidoc extends Dartdoc { |
| 197 /** Big ball of JSON containing the scraped MDN documentation. */ | 196 /** Big ball of JSON containing the scraped MDN documentation. */ |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 var memberName = '$typeName.${member.simpleName}'; | 471 var memberName = '$typeName.${member.simpleName}'; |
| 473 if (member is MethodMirror && member.isConstructor) { | 472 if (member is MethodMirror && member.isConstructor) { |
| 474 final separator = member.constructorName == '' ? '' : '.'; | 473 final separator = member.constructorName == '' ? '' : '.'; |
| 475 memberName = 'new $typeName$separator${member.constructorName}'; | 474 memberName = 'new $typeName$separator${member.constructorName}'; |
| 476 } | 475 } |
| 477 | 476 |
| 478 return a(memberUrl(member), memberName); | 477 return a(memberUrl(member), memberName); |
| 479 } | 478 } |
| 480 } | 479 } |
| 481 | 480 |
| OLD | NEW |