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

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

Issue 10950025: Dartdoc supports package directory. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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
« pkg/dartdoc/bin/dartdoc.dart ('K') | « pkg/dartdoc/lib/dartdoc.dart ('k') | 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 outputDir = new Path.fromNative(arg.substring('--out='.length)); 55 outputDir = new Path.fromNative(arg.substring('--out='.length));
56 } else { 56 } else {
57 print('Unknown option: $arg'); 57 print('Unknown option: $arg');
58 return; 58 return;
59 } 59 }
60 break; 60 break;
61 } 61 }
62 } 62 }
63 63
64 final libPath = doc.scriptDir.append('../../'); 64 final libPath = doc.scriptDir.append('../../');
65 final pkgPath = doc.scriptDir.append('../../pkg/');
65 66
66 doc.cleanOutputDirectory(outputDir); 67 doc.cleanOutputDirectory(outputDir);
67 68
68 // The basic dartdoc-provided static content. 69 // The basic dartdoc-provided static content.
69 final copiedStatic = doc.copyDirectory( 70 final copiedStatic = doc.copyDirectory(
70 doc.scriptDir.append('../../pkg/dartdoc/static'), 71 doc.scriptDir.append('../../pkg/dartdoc/static'),
71 outputDir); 72 outputDir);
72 73
73 // The apidoc-specific static content. 74 // The apidoc-specific static content.
74 final copiedApiDocStatic = doc.copyDirectory( 75 final copiedApiDocStatic = doc.copyDirectory(
75 doc.scriptDir.append('static'), 76 doc.scriptDir.append('static'),
76 outputDir); 77 outputDir);
77 78
78 print('Parsing MDN data...'); 79 print('Parsing MDN data...');
79 final mdnFile = new File.fromPath(doc.scriptDir.append('mdn/database.json')); 80 final mdnFile = new File.fromPath(doc.scriptDir.append('mdn/database.json'));
80 final mdn = JSON.parse(mdnFile.readAsTextSync()); 81 final mdn = JSON.parse(mdnFile.readAsTextSync());
81 82
82 print('Cross-referencing dart:html...'); 83 print('Cross-referencing dart:html...');
83 HtmlDiff.initialize(libPath); 84 HtmlDiff.initialize(libPath);
84 _diff = new HtmlDiff(printWarnings:false); 85 _diff = new HtmlDiff(printWarnings:false);
85 _diff.run(); 86 _diff.run();
86 87
87 // Process handwritten HTML documentation. 88 // Process handwritten HTML documentation.
88 print('Processing handwritten HTML documentation...'); 89 print('Processing handwritten HTML documentation...');
89 final htmldoc = new Htmldoc(); 90 final htmldoc = new Htmldoc();
90 htmldoc.includeApi = true; 91 htmldoc.includeApi = true;
91 htmldoc.documentLibraries( 92 htmldoc.documentLibraries(
92 <Path>[doc.scriptDir.append('../../lib/html/doc/html.dartdoc')], 93 <Path>[doc.scriptDir.append('../../lib/html/doc/html.dartdoc')],
93 libPath); 94 libPath, pkgPath);
Lasse Reichstein Nielsen 2012/09/19 12:06:49 Now you are passing two paths around together almo
Johnni Winther 2012/09/20 08:55:59 The first is fixed by the system and the second ca
94 95
95 // Process libraries. 96 // Process libraries.
96 97
97 // TODO(johnniwinther): Libraries for the compilation seem to be more like 98 // TODO(johnniwinther): Libraries for the compilation seem to be more like
98 // URIs. Perhaps Path should have a toURI() method. 99 // URIs. Perhaps Path should have a toURI() method.
99 // Add all of the core libraries. 100 // Add all of the core libraries.
100 final apidocLibraries = <Path>[]; 101 final apidocLibraries = <Path>[];
101 LIBRARIES.forEach((String name, LibraryInfo info) { 102 LIBRARIES.forEach((String name, LibraryInfo info) {
102 if (info.documented) { 103 if (info.documented) {
103 apidocLibraries.add(new Path('dart:$name')); 104 apidocLibraries.add(new Path('dart:$name'));
(...skipping 25 matching lines...) Expand all
129 130
130 lister.onDone = (success) { 131 lister.onDone = (success) {
131 print('Generating docs...'); 132 print('Generating docs...');
132 final apidoc = new Apidoc(mdn, htmldoc, outputDir, mode, generateAppCache); 133 final apidoc = new Apidoc(mdn, htmldoc, outputDir, mode, generateAppCache);
133 apidoc.dartdocPath = doc.scriptDir.append('../../pkg/dartdoc/'); 134 apidoc.dartdocPath = doc.scriptDir.append('../../pkg/dartdoc/');
134 // Select the libraries to include in the produced documentation: 135 // Select the libraries to include in the produced documentation:
135 apidoc.includeApi = true; 136 apidoc.includeApi = true;
136 apidoc.includedLibraries = includedLibraries; 137 apidoc.includedLibraries = includedLibraries;
137 138
138 Futures.wait([copiedStatic, copiedApiDocStatic]).then((_) { 139 Futures.wait([copiedStatic, copiedApiDocStatic]).then((_) {
139 apidoc.documentLibraries(apidocLibraries, libPath); 140 apidoc.documentLibraries(apidocLibraries, libPath, pkgPath);
140 141
141 final compiled = doc.compileScript(mode, outputDir, libPath); 142 final compiled = doc.compileScript(mode, outputDir, libPath);
142 143
143 Futures.wait([compiled, copiedStatic, copiedApiDocStatic]).then((_) { 144 Futures.wait([compiled, copiedStatic, copiedApiDocStatic]).then((_) {
144 apidoc.cleanup(); 145 apidoc.cleanup();
145 }); 146 });
146 }); 147 });
147 }; 148 };
148 } 149 }
149 150
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 final typeName = member.surroundingDeclaration.simpleName; 559 final typeName = member.surroundingDeclaration.simpleName;
559 var memberName = '$typeName.${member.simpleName}'; 560 var memberName = '$typeName.${member.simpleName}';
560 if (member is MethodMirror && (member.isConstructor || member.isFactory)) { 561 if (member is MethodMirror && (member.isConstructor || member.isFactory)) {
561 final separator = member.constructorName == '' ? '' : '.'; 562 final separator = member.constructorName == '' ? '' : '.';
562 memberName = 'new $typeName$separator${member.constructorName}'; 563 memberName = 'new $typeName$separator${member.constructorName}';
563 } 564 }
564 565
565 return a(memberUrl(member), memberName); 566 return a(memberUrl(member), memberName);
566 } 567 }
567 } 568 }
OLDNEW
« pkg/dartdoc/bin/dartdoc.dart ('K') | « pkg/dartdoc/lib/dartdoc.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698