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

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

Issue 9705088: Generate API docs during build. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix arg parsing. Created 8 years, 8 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 *
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 #library('apidoc');
16 16
17 #import('dart:io');
17 #import('dart:json'); 18 #import('dart:json');
18 #import('html_diff.dart'); 19 #import('html_diff.dart');
19 #import('../../frog/lang.dart'); 20 #import('../../frog/lang.dart');
20 #import('../../frog/file_system_vm.dart'); 21 #import('../../frog/file_system_vm.dart');
21 #import('../../frog/file_system.dart'); 22 #import('../../frog/file_system.dart');
22 #import('../../lib/dartdoc/dartdoc.dart', prefix: 'doc'); 23 #import('../../lib/dartdoc/dartdoc.dart', prefix: 'doc');
23 24
24 HtmlDiff _diff; 25 HtmlDiff _diff;
25 26
26 final GET_PREFIX = 'get:'; 27 final GET_PREFIX = 'get:';
27 28
28 void main() { 29 void main() {
29 final args = new Options().arguments; 30 final args = new Options().arguments;
30 31
31 int mode = doc.MODE_STATIC; 32 int mode = doc.MODE_STATIC;
32 var outputDir = 'docs'; 33 String outputDir = 'docs';
33 34
34 // Use the output directory if provided. 35 // Parse the command-line arguments.
35 36 for (int i = 0; i < args.length; i++) {
36 for (int i = 0; i < args.length - 1; i++) {
37 final arg = args[i]; 37 final arg = args[i];
38 38
39 switch (arg) { 39 switch (arg) {
40 case '--mode=static': 40 case '--mode=static':
41 mode = doc.MODE_STATIC; 41 mode = doc.MODE_STATIC;
42 break; 42 break;
43 43
44 case '--mode=live-nav': 44 case '--mode=live-nav':
45 mode = doc.MODE_LIVE_NAV; 45 mode = doc.MODE_LIVE_NAV;
46 break; 46 break;
(...skipping 29 matching lines...) Expand all
76 doc.copyFiles('${doc.scriptDir}/../../lib/dartdoc/static', outputDir); 76 doc.copyFiles('${doc.scriptDir}/../../lib/dartdoc/static', outputDir);
77 77
78 // The apidoc-specific static content. 78 // The apidoc-specific static content.
79 doc.copyFiles('${doc.scriptDir}/static', outputDir); 79 doc.copyFiles('${doc.scriptDir}/static', outputDir);
80 80
81 var files = new VMFileSystem(); 81 var files = new VMFileSystem();
82 parseOptions(frogPath, ['', '', '--libdir=$frogPath/lib'], files); 82 parseOptions(frogPath, ['', '', '--libdir=$frogPath/lib'], files);
83 initializeWorld(files); 83 initializeWorld(files);
84 84
85 print('Parsing MDN data...'); 85 print('Parsing MDN data...');
86 final mdn = JSON.parse(files.readAll('mdn/database.json')); 86 final mdnFile = new File('${doc.scriptDir}/mdn/database.json');
87 final mdn = JSON.parse(mdnFile.readAsTextSync());
87 88
88 print('Cross-referencing dart:dom and dart:html...'); 89 print('Cross-referencing dart:dom and dart:html...');
89 HtmlDiff.initialize(); 90 HtmlDiff.initialize();
90 _diff = new HtmlDiff(); 91 _diff = new HtmlDiff();
91 _diff.run(); 92 _diff.run();
92 world.reset(); 93 world.reset();
93 94
94 // Add all of the core libraries. 95 // Add all of the core libraries.
95 world.getOrAddLibrary('dart:core'); 96 world.getOrAddLibrary('dart:core');
96 world.getOrAddLibrary('dart:coreimpl'); 97 world.getOrAddLibrary('dart:coreimpl');
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 return 481 return
481 ''' 482 '''
482 <p class="correspond">This corresponds to $domTypesText in the 483 <p class="correspond">This corresponds to $domTypesText in the
483 ${a("dom.html", "dart:dom")} library.</p> 484 ${a("dom.html", "dart:dom")} library.</p>
484 '''; 485 ''';
485 } 486 }
486 487
487 return ''; 488 return '';
488 } 489 }
489 } 490 }
OLDNEW
« no previous file with comments | « lib/dartdoc/dartdoc.dart ('k') | utils/apidoc/apidoc.gyp » ('j') | utils/apidoc/apidoc.gyp » ('J')

Powered by Google App Engine
This is Rietveld 408576698