| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 } else { | 55 } else { |
| 56 print('Unknown option: $arg'); | 56 print('Unknown option: $arg'); |
| 57 return; | 57 return; |
| 58 } | 58 } |
| 59 break; | 59 break; |
| 60 } | 60 } |
| 61 } | 61 } |
| 62 | 62 |
| 63 doc.cleanOutputDirectory(outputDir); | 63 doc.cleanOutputDirectory(outputDir); |
| 64 | 64 |
| 65 // Compile the client-side code to JS. | |
| 66 // TODO(bob): Right path. | |
| 67 | |
| 68 final clientScript = (mode == doc.MODE_STATIC) ? | |
| 69 'static' : 'live-nav'; | |
| 70 final Future compiled = doc.compileScript( | |
| 71 doc.scriptDir.append('../../pkg/dartdoc/client-$clientScript.dart'), | |
| 72 outputDir.append('client-$clientScript.js')); | |
| 73 | |
| 74 // TODO(rnystrom): Use platform-specific path separator. | |
| 75 // The basic dartdoc-provided static content. | 65 // The basic dartdoc-provided static content. |
| 76 final Future copiedStatic = doc.copyDirectory( | 66 final Future copiedStatic = doc.copyDirectory( |
| 77 doc.scriptDir.append('../../pkg/dartdoc/static'), | 67 doc.scriptDir.append('../../pkg/dartdoc/static'), |
| 78 outputDir); | 68 outputDir); |
| 79 | 69 |
| 80 // The apidoc-specific static content. | 70 // The apidoc-specific static content. |
| 81 final Future copiedApiDocStatic = doc.copyDirectory( | 71 final Future copiedApiDocStatic = doc.copyDirectory( |
| 82 doc.scriptDir.append('static'), | 72 doc.scriptDir.append('static'), |
| 83 outputDir); | 73 outputDir); |
| 84 | 74 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 if (new File.fromPath(path).existsSync()) { | 112 if (new File.fromPath(path).existsSync()) { |
| 123 apidocLibraries.add(path); | 113 apidocLibraries.add(path); |
| 124 includedLibraries.add(libname); | 114 includedLibraries.add(libname); |
| 125 } else { | 115 } else { |
| 126 print('Warning: could not find package at $path'); | 116 print('Warning: could not find package at $path'); |
| 127 } | 117 } |
| 128 }; | 118 }; |
| 129 lister.onDone = (success) { | 119 lister.onDone = (success) { |
| 130 print('Generating docs...'); | 120 print('Generating docs...'); |
| 131 final apidoc = new Apidoc(mdn, htmldoc, outputDir, mode, generateAppCache); | 121 final apidoc = new Apidoc(mdn, htmldoc, outputDir, mode, generateAppCache); |
| 122 apidoc.dartdocPath = doc.scriptDir.append('../../pkg/dartdoc/'); |
| 132 // Select the libraries to include in the produced documentation: | 123 // Select the libraries to include in the produced documentation: |
| 133 apidoc.includeApi = true; | 124 apidoc.includeApi = true; |
| 134 apidoc.includedLibraries = includedLibraries; | 125 apidoc.includedLibraries = includedLibraries; |
| 135 | 126 |
| 136 Futures.wait([compiled, copiedStatic, copiedApiDocStatic]).then((_) { | 127 Futures.wait([copiedStatic, copiedApiDocStatic]).then((_) { |
| 137 apidoc.documentLibraries(apidocLibraries, doc.libPath); | 128 apidoc.documentLibraries(apidocLibraries, doc.libPath); |
| 129 |
| 130 final clientScript = (mode == doc.MODE_STATIC) ? 'static' : 'live-nav'; |
| 131 final Future compiled = doc.compileScript( |
| 132 apidoc.dartdocPath.append('client-$clientScript.dart'), |
| 133 outputDir.append('client-$clientScript.js')); |
| 134 |
| 135 Futures.wait([compiled, copiedStatic, copiedApiDocStatic]).then((_) { |
| 136 apidoc.cleanup(); |
| 137 }); |
| 138 }); | 138 }); |
| 139 }; | 139 }; |
| 140 } | 140 } |
| 141 | 141 |
| 142 /** | 142 /** |
| 143 * This class is purely here to scrape handwritten HTML documentation. | 143 * This class is purely here to scrape handwritten HTML documentation. |
| 144 * This scraped documentation will later be merged with the generated | 144 * This scraped documentation will later be merged with the generated |
| 145 * HTML library. | 145 * HTML library. |
| 146 */ | 146 */ |
| 147 class Htmldoc extends doc.Dartdoc { | 147 class Htmldoc extends doc.Dartdoc { |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 '''); | 334 '''); |
| 335 } | 335 } |
| 336 | 336 |
| 337 void docIndexLibrary(LibraryMirror library) { | 337 void docIndexLibrary(LibraryMirror library) { |
| 338 // TODO(rnystrom): Hackish. The IO libraries reference this but we don't | 338 // TODO(rnystrom): Hackish. The IO libraries reference this but we don't |
| 339 // want it in the docs. | 339 // want it in the docs. |
| 340 if (library.simpleName == 'dart:nativewrappers') return; | 340 if (library.simpleName == 'dart:nativewrappers') return; |
| 341 super.docIndexLibrary(library); | 341 super.docIndexLibrary(library); |
| 342 } | 342 } |
| 343 | 343 |
| 344 void docLibraryNavigationJson(LibraryMirror library, Map libraryMap) { | 344 void docLibraryNavigationJson(LibraryMirror library, List libraryList) { |
| 345 // TODO(rnystrom): Hackish. The IO libraries reference this but we don't | 345 // TODO(rnystrom): Hackish. The IO libraries reference this but we don't |
| 346 // want it in the docs. | 346 // want it in the docs. |
| 347 if (library.simpleName == 'dart:nativewrappers') return; | 347 if (library.simpleName == 'dart:nativewrappers') return; |
| 348 super.docLibraryNavigationJson(library, libraryMap); | 348 super.docLibraryNavigationJson(library, libraryList); |
| 349 } | 349 } |
| 350 | 350 |
| 351 void docLibrary(LibraryMirror library) { | 351 void docLibrary(LibraryMirror library) { |
| 352 // TODO(rnystrom): Hackish. The IO libraries reference this but we don't | 352 // TODO(rnystrom): Hackish. The IO libraries reference this but we don't |
| 353 // want it in the docs. | 353 // want it in the docs. |
| 354 if (library.simpleName == 'dart:nativewrappers') return; | 354 if (library.simpleName == 'dart:nativewrappers') return; |
| 355 super.docLibrary(library); | 355 super.docLibrary(library); |
| 356 } | 356 } |
| 357 | 357 |
| 358 /** Override definition from parent class to strip out annotation tags. */ | 358 /** Override definition from parent class to strip out annotation tags. */ |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 final typeName = member.surroundingDeclaration.simpleName; | 528 final typeName = member.surroundingDeclaration.simpleName; |
| 529 var memberName = '$typeName.${member.simpleName}'; | 529 var memberName = '$typeName.${member.simpleName}'; |
| 530 if (member is MethodMirror && (member.isConstructor || member.isFactory)) { | 530 if (member is MethodMirror && (member.isConstructor || member.isFactory)) { |
| 531 final separator = member.constructorName == '' ? '' : '.'; | 531 final separator = member.constructorName == '' ? '' : '.'; |
| 532 memberName = 'new $typeName$separator${member.constructorName}'; | 532 memberName = 'new $typeName$separator${member.constructorName}'; |
| 533 } | 533 } |
| 534 | 534 |
| 535 return a(memberUrl(member), memberName); | 535 return a(memberUrl(member), memberName); |
| 536 } | 536 } |
| 537 } | 537 } |
| OLD | NEW |