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

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

Issue 12316036: Merge IO v2 branch to bleeding edge (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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
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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 // URIs. Perhaps Path should have a toURI() method. 103 // URIs. Perhaps Path should have a toURI() method.
104 // Add all of the core libraries. 104 // Add all of the core libraries.
105 final apidocLibraries = <Path>[]; 105 final apidocLibraries = <Path>[];
106 LIBRARIES.forEach((String name, LibraryInfo info) { 106 LIBRARIES.forEach((String name, LibraryInfo info) {
107 if (info.documented) { 107 if (info.documented) {
108 apidocLibraries.add(new Path('dart:$name')); 108 apidocLibraries.add(new Path('dart:$name'));
109 } 109 }
110 }); 110 });
111 111
112 var lister = new Directory.fromPath(doc.scriptDir.append('../../pkg')).list(); 112 var lister = new Directory.fromPath(doc.scriptDir.append('../../pkg')).list();
113 lister.onDir = (dirPath) { 113 lister.listen(
114 var path = new Path(dirPath); 114 (entity) {
115 var libName = path.filename; 115 if (entity is Directory) {
116 var path = new Path(entity.path);
117 var libName = path.filename;
116 118
117 // TODO(rnystrom): Get rid of oldStylePath support when all packages are 119 // TODO(rnystrom): Get rid of oldStylePath support when all
118 // using new layout. See #5106. 120 // packages are using new layout. See #5106.
119 var oldStylePath = path.append('${libName}.dart'); 121 var oldStylePath = path.append('${libName}.dart');
120 var newStylePath = path.append('lib/${libName}.dart'); 122 var newStylePath = path.append('lib/${libName}.dart');
121 123
122 if (new File.fromPath(oldStylePath).existsSync()) { 124 if (new File.fromPath(oldStylePath).existsSync()) {
123 apidocLibraries.add(oldStylePath); 125 apidocLibraries.add(oldStylePath);
124 includedLibraries.add(libName); 126 includedLibraries.add(libName);
125 } else if (new File.fromPath(newStylePath).existsSync()) { 127 } else if (new File.fromPath(newStylePath).existsSync()) {
126 apidocLibraries.add(newStylePath); 128 apidocLibraries.add(newStylePath);
127 includedLibraries.add(libName); 129 includedLibraries.add(libName);
128 } else { 130 } else {
129 print('Warning: could not find package at $path'); 131 print('Warning: could not find package at $path');
130 } 132 }
131 }; 133 }
134 },
135 onDone: () {
136 print('Generating docs...');
137 final apidoc = new Apidoc(mdn, outputDir, mode, generateAppCache,
138 excludedLibraries, version);
139 apidoc.dartdocPath =
140 doc.scriptDir.append('../../sdk/lib/_internal/dartdoc/');
141 // Select the libraries to include in the produced documentation:
142 apidoc.includeApi = true;
143 apidoc.includedLibraries = includedLibraries;
132 144
133 lister.onDone = (success) { 145 Future.wait([copiedStatic, copiedApiDocStatic]).then((_) {
134 print('Generating docs...'); 146 apidoc.documentLibraries(apidocLibraries, libPath, pkgPath);
135 final apidoc = new Apidoc(mdn, outputDir, mode, generateAppCache,
136 excludedLibraries, version);
137 apidoc.dartdocPath =
138 doc.scriptDir.append('../../sdk/lib/_internal/dartdoc/');
139 // Select the libraries to include in the produced documentation:
140 apidoc.includeApi = true;
141 apidoc.includedLibraries = includedLibraries;
142 147
143 Future.wait([copiedStatic, copiedApiDocStatic]).then((_) { 148 final compiled = doc.compileScript(mode, outputDir, libPath);
144 apidoc.documentLibraries(apidocLibraries, libPath, pkgPath);
145 149
146 final compiled = doc.compileScript(mode, outputDir, libPath); 150 Future.wait([compiled, copiedStatic, copiedApiDocStatic]).then((_) {
147 151 apidoc.cleanup();
148 Future.wait([compiled, copiedStatic, copiedApiDocStatic]).then((_) { 152 });
149 apidoc.cleanup(); 153 });
150 }); 154 });
151 });
152 };
153 } 155 }
154 156
155 class Apidoc extends doc.Dartdoc { 157 class Apidoc extends doc.Dartdoc {
156 /** Big ball of JSON containing the scraped MDN documentation. */ 158 /** Big ball of JSON containing the scraped MDN documentation. */
157 final Map mdn; 159 final Map mdn;
158 160
159 161
160 // A set of type names (TypeMirror.simpleName values) to ignore while 162 // A set of type names (TypeMirror.simpleName values) to ignore while
161 // looking up information from MDN data. TODO(eub, jacobr): fix up the MDN 163 // looking up information from MDN data. TODO(eub, jacobr): fix up the MDN
162 // import scripts so they run correctly and generate data that doesn't have 164 // import scripts so they run correctly and generate data that doesn't have
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 final typeName = member.owner.simpleName; 435 final typeName = member.owner.simpleName;
434 var memberName = '$typeName.${member.simpleName}'; 436 var memberName = '$typeName.${member.simpleName}';
435 if (member is MethodMirror && (member.isConstructor || member.isFactory)) { 437 if (member is MethodMirror && (member.isConstructor || member.isFactory)) {
436 final separator = member.constructorName == '' ? '' : '.'; 438 final separator = member.constructorName == '' ? '' : '.';
437 memberName = 'new $typeName$separator${member.constructorName}'; 439 memberName = 'new $typeName$separator${member.constructorName}';
438 } 440 }
439 441
440 return a(memberUrl(member), memberName); 442 return a(memberUrl(member), memberName);
441 } 443 }
442 } 444 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698