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

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

Issue 11358024: Changes outside pkg/ and lib/ for directory refactoring (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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 *
11 * Usage: 11 * Usage:
12 * 12 *
13 * $ dart apidoc.dart [--out=<output directory>] 13 * $ dart apidoc.dart [--out=<output directory>]
14 */ 14 */
15 library apidoc;
15 16
16 #library('apidoc'); 17 import 'dart:io';
17 18 import 'dart:json';
18 #import('dart:io'); 19 import 'html_diff.dart';
19 #import('dart:json');
20 #import('html_diff.dart');
21 // TODO(rnystrom): Use "package:" URL (#4968). 20 // TODO(rnystrom): Use "package:" URL (#4968).
22 #import('../../pkg/dartdoc/lib/mirrors.dart'); 21 import '../../sdk/lib/_internal/dartdoc/lib/mirrors.dart';
23 #import('../../pkg/dartdoc/lib/mirrors_util.dart'); 22 import '../../sdk/lib/_internal/dartdoc/lib/mirrors_util.dart';
24 #import('../../pkg/dartdoc/lib/dartdoc.dart', prefix: 'doc'); 23 import '../../sdk/lib/_internal/dartdoc/lib/dartdoc.dart' as doc;
25 #import('../../lib/_internal/libraries.dart'); 24 import '../../sdk/lib/_internal/libraries.dart';
26 25
27 HtmlDiff _diff; 26 HtmlDiff _diff;
28 27
29 void main() { 28 void main() {
30 final args = new Options().arguments; 29 final args = new Options().arguments;
31 30
32 int mode = doc.MODE_STATIC; 31 int mode = doc.MODE_STATIC;
33 Path outputDir = new Path('docs'); 32 Path outputDir = new Path('docs');
34 bool generateAppCache = false; 33 bool generateAppCache = false;
35 34
(...skipping 22 matching lines...) Expand all
58 } else if (arg.startsWith('--out=')) { 57 } else if (arg.startsWith('--out=')) {
59 outputDir = new Path.fromNative(arg.substring('--out='.length)); 58 outputDir = new Path.fromNative(arg.substring('--out='.length));
60 } else { 59 } else {
61 print('Unknown option: $arg'); 60 print('Unknown option: $arg');
62 return; 61 return;
63 } 62 }
64 break; 63 break;
65 } 64 }
66 } 65 }
67 66
68 final libPath = doc.scriptDir.append('../../'); 67 final libPath = doc.scriptDir.append('../../sdk/lib');
69 final pkgPath = doc.scriptDir.append('../../pkg/'); 68 final pkgPath = doc.scriptDir.append('../../pkg/');
70 69
71 doc.cleanOutputDirectory(outputDir); 70 doc.cleanOutputDirectory(outputDir);
72 71
73 // The basic dartdoc-provided static content. 72 // The basic dartdoc-provided static content.
74 final copiedStatic = doc.copyDirectory( 73 final copiedStatic = doc.copyDirectory(
75 doc.scriptDir.append('../../pkg/dartdoc/static'), 74 doc.scriptDir.append('../../sdk/lib/_internal/dartdoc/static'),
76 outputDir); 75 outputDir);
77 76
78 // The apidoc-specific static content. 77 // The apidoc-specific static content.
79 final copiedApiDocStatic = doc.copyDirectory( 78 final copiedApiDocStatic = doc.copyDirectory(
80 doc.scriptDir.append('static'), 79 doc.scriptDir.append('static'),
81 outputDir); 80 outputDir);
82 81
83 print('Parsing MDN data...'); 82 print('Parsing MDN data...');
84 final mdnFile = new File.fromPath(doc.scriptDir.append('mdn/database.json')); 83 final mdnFile = new File.fromPath(doc.scriptDir.append('mdn/database.json'));
85 final mdn = JSON.parse(mdnFile.readAsTextSync()); 84 final mdn = JSON.parse(mdnFile.readAsTextSync());
86 85
87 print('Cross-referencing dart:html...'); 86 print('Cross-referencing dart:html...');
88 HtmlDiff.initialize(libPath); 87 HtmlDiff.initialize(libPath);
89 _diff = new HtmlDiff(printWarnings:false); 88 _diff = new HtmlDiff(printWarnings:false);
90 _diff.run(); 89 _diff.run();
91 90
92 // Process handwritten HTML documentation. 91 // Process handwritten HTML documentation.
93 print('Processing handwritten HTML documentation...'); 92 print('Processing handwritten HTML documentation...');
94 final htmldoc = new Htmldoc(); 93 final htmldoc = new Htmldoc();
95 htmldoc.includeApi = true; 94 htmldoc.includeApi = true;
96 htmldoc.documentLibraries( 95 htmldoc.documentLibraries(
97 <Path>[doc.scriptDir.append('../../lib/html/doc/html.dartdoc')], 96 <Path>[doc.scriptDir.append('../../sdk/lib/html/doc/html.dartdoc')],
98 libPath, pkgPath); 97 libPath, pkgPath);
99 98
100 // Process libraries. 99 // Process libraries.
101 100
102 // TODO(johnniwinther): Libraries for the compilation seem to be more like 101 // TODO(johnniwinther): Libraries for the compilation seem to be more like
103 // URIs. Perhaps Path should have a toURI() method. 102 // URIs. Perhaps Path should have a toURI() method.
104 // Add all of the core libraries. 103 // Add all of the core libraries.
105 final apidocLibraries = <Path>[]; 104 final apidocLibraries = <Path>[];
106 LIBRARIES.forEach((String name, LibraryInfo info) { 105 LIBRARIES.forEach((String name, LibraryInfo info) {
107 if (info.documented) { 106 if (info.documented) {
(...skipping 21 matching lines...) Expand all
129 includedLibraries.add(libName); 128 includedLibraries.add(libName);
130 } else { 129 } else {
131 print('Warning: could not find package at $path'); 130 print('Warning: could not find package at $path');
132 } 131 }
133 }; 132 };
134 133
135 lister.onDone = (success) { 134 lister.onDone = (success) {
136 print('Generating docs...'); 135 print('Generating docs...');
137 final apidoc = new Apidoc(mdn, htmldoc, outputDir, mode, generateAppCache, 136 final apidoc = new Apidoc(mdn, htmldoc, outputDir, mode, generateAppCache,
138 excludedLibraries); 137 excludedLibraries);
139 apidoc.dartdocPath = doc.scriptDir.append('../../pkg/dartdoc/'); 138 apidoc.dartdocPath =
139 doc.scriptDir.append('../../sdk/lib/_internal/dartdoc/');
140 // Select the libraries to include in the produced documentation: 140 // Select the libraries to include in the produced documentation:
141 apidoc.includeApi = true; 141 apidoc.includeApi = true;
142 apidoc.includedLibraries = includedLibraries; 142 apidoc.includedLibraries = includedLibraries;
143 143
144 Futures.wait([copiedStatic, copiedApiDocStatic]).then((_) { 144 Futures.wait([copiedStatic, copiedApiDocStatic]).then((_) {
145 apidoc.documentLibraries(apidocLibraries, libPath, pkgPath); 145 apidoc.documentLibraries(apidocLibraries, libPath, pkgPath);
146 146
147 final compiled = doc.compileScript(mode, outputDir, libPath); 147 final compiled = doc.compileScript(mode, outputDir, libPath);
148 148
149 Futures.wait([compiled, copiedStatic, copiedApiDocStatic]).then((_) { 149 Futures.wait([compiled, copiedStatic, copiedApiDocStatic]).then((_) {
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 return ''' 578 return '''
579 <div class="mdn"> 579 <div class="mdn">
580 $mdnComment 580 $mdnComment
581 <div class="mdn-note"><a href="$mdnUrl">from MDN</a></div> 581 <div class="mdn-note"><a href="$mdnUrl">from MDN</a></div>
582 </div> 582 </div>
583 '''; 583 ''';
584 } 584 }
585 585
586 String toString() => mdnComment; 586 String toString() => mdnComment;
587 } 587 }
OLDNEW
« tools/create_sdk.py ('K') | « tools/create_sdk.py ('k') | utils/apidoc/apidoc.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698