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