Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(193)

Side by Side Diff: utils/apidoc/apidoc.dart

Issue 10824367: Add all api docs from pkg (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: improved error handling Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 DART2JS_LIBRARY_MAP.forEach((String name, LibraryInfo info) {
108 if (!info.isInternal) { 108 if (!info.isInternal) {
109 apidocLibraries.add(new Path('dart:$name')); 109 apidocLibraries.add(new Path('dart:$name'));
110 } 110 }
111 }); 111 });
112 apidocLibraries.add(doc.scriptDir.append('../../pkg/unittest/unittest.dart'));
113 apidocLibraries.add(doc.scriptDir.append('../../pkg/i18n/intl.dart'));
114 112
115 print('Generating docs...'); 113 final includedLibraries = <String>[];
116 final apidoc = new Apidoc(mdn, htmldoc, outputDir, mode, generateAppCache); 114 var lister = new Directory.fromPath(
117 // Select the libraries to include in the produced documentation: 115 doc.scriptDir.append('../../pkg/')).list();
118 apidoc.includeApi = true; 116 lister.onDir = (dirPath) {
119 apidoc.includedLibraries = <String>[ 117 var path = new Path(dirPath);
120 'unittest', 118 var libname = path.filename;
121 'intl', 119 // TODO(jmesserly): rename i18n to intl
122 ]; 120 if (libname == 'i18n') libname = 'intl';
dgrove 2012/08/21 18:42:31 This change is coming in now, so perhaps get rid o
Jennifer Messerly 2012/08/21 18:50:13 Done.
121 path = path.append('${libname}.dart');
122 if (new File.fromPath(path).existsSync()) {
123 apidocLibraries.add(path);
124 includedLibraries.add(libname);
125 } else {
126 print('Warning: could not find package at $path');
127 }
128 };
129 lister.onDone = (success) {
130 print('Generating docs...');
131 final apidoc = new Apidoc(mdn, htmldoc, outputDir, mode, generateAppCache);
132 // Select the libraries to include in the produced documentation:
133 apidoc.includeApi = true;
134 apidoc.includedLibraries = includedLibraries;
123 135
124 Futures.wait([compiled, copiedStatic, copiedApiDocStatic]).then((_) { 136 Futures.wait([compiled, copiedStatic, copiedApiDocStatic]).then((_) {
125 apidoc.documentLibraries(apidocLibraries, doc.libPath); 137 apidoc.documentLibraries(apidocLibraries, doc.libPath);
126 }); 138 });
139 };
127 } 140 }
128 141
129 /** 142 /**
130 * This class is purely here to scrape handwritten HTML documentation. 143 * This class is purely here to scrape handwritten HTML documentation.
131 * This scraped documentation will later be merged with the generated 144 * This scraped documentation will later be merged with the generated
132 * HTML library. 145 * HTML library.
133 */ 146 */
134 class Htmldoc extends doc.Dartdoc { 147 class Htmldoc extends doc.Dartdoc {
135 String libraryComment; 148 String libraryComment;
136 149
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 final typeName = member.surroundingDeclaration.simpleName; 528 final typeName = member.surroundingDeclaration.simpleName;
516 var memberName = '$typeName.${member.simpleName}'; 529 var memberName = '$typeName.${member.simpleName}';
517 if (member is MethodMirror && (member.isConstructor || member.isFactory)) { 530 if (member is MethodMirror && (member.isConstructor || member.isFactory)) {
518 final separator = member.constructorName == '' ? '' : '.'; 531 final separator = member.constructorName == '' ? '' : '.';
519 memberName = 'new $typeName$separator${member.constructorName}'; 532 memberName = 'new $typeName$separator${member.constructorName}';
520 } 533 }
521 534
522 return a(memberUrl(member), memberName); 535 return a(memberUrl(member), memberName);
523 } 536 }
524 } 537 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698