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

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

Issue 9722012: Get rid of bash for dartdoc and do the whole thing in dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Respond to review. Created 8 years, 9 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
« lib/dartdoc/dartdoc.dart ('K') | « utils/apidoc/apidoc ('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 * Generates the complete set of corelib reference documentation. 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
8 * for generating docs from any Dart code. This library extends that to include
9 * additional information and styling specific to our standard library.
10 *
11 * Usage:
12 *
13 * $ dart apidoc.dart [--out=<output directory>]
14 *
15 * Pretty simple. :)
ahe 2012/03/17 20:19:31 Remove cute comment. It's just annoying when it do
Bob Nystrom 2012/03/19 21:09:34 Done.
7 */ 16 */
8 #library('apidoc'); 17 #library('apidoc');
9 18
10 #import('dart:json'); 19 #import('dart:json');
11 #import('html_diff.dart'); 20 #import('html_diff.dart');
12 #import('../../frog/lang.dart'); 21 #import('../../frog/lang.dart');
13 #import('../../frog/file_system_vm.dart'); 22 #import('../../frog/file_system_vm.dart');
14 #import('../../frog/file_system.dart'); 23 #import('../../frog/file_system.dart');
15 #import('../../lib/dartdoc/dartdoc.dart', prefix: 'doc'); 24 #import('../../lib/dartdoc/dartdoc.dart', prefix: 'doc');
16 25
(...skipping 13 matching lines...) Expand all
30 } else if (args.length == 1) { 39 } else if (args.length == 1) {
31 final arg = args[0]; 40 final arg = args[0];
32 if (arg.startsWith('--out=')) { 41 if (arg.startsWith('--out=')) {
33 outputDir = arg.substring('--out='.length); 42 outputDir = arg.substring('--out='.length);
34 } else { 43 } else {
35 print('Unknown option: $arg'); 44 print('Unknown option: $arg');
36 return; 45 return;
37 } 46 }
38 } 47 }
39 48
49 final frogPath = joinPaths(doc.scriptDir, '../../frog/');
50
40 doc.cleanOutputDirectory(outputDir); 51 doc.cleanOutputDirectory(outputDir);
41 52
53 // Compile the client-side code to JS.
54 // TODO(bob): Right path.
55 doc.compileScript(frogPath,
56 '${doc.scriptDir}/../../lib/dartdoc/client-live-nav.dart',
57 '${outputDir}/client-live-nav.js');
58
42 // TODO(rnystrom): Use platform-specific path separator. 59 // TODO(rnystrom): Use platform-specific path separator.
43 // The basic dartdoc-provided static content. 60 // The basic dartdoc-provided static content.
44 doc.copyFiles('${doc.scriptDir}/../../lib/dartdoc/static', outputDir); 61 doc.copyFiles('${doc.scriptDir}/../../lib/dartdoc/static', outputDir);
45 62
46 // The apidoc-specific static content. 63 // The apidoc-specific static content.
47 doc.copyFiles('${doc.scriptDir}/static', outputDir); 64 doc.copyFiles('${doc.scriptDir}/static', outputDir);
48 65
49 var files = new VMFileSystem(); 66 var files = new VMFileSystem();
50 parseOptions('../../frog', ['', '', '--libdir=../../frog/lib'], files); 67 parseOptions(frogPath, ['', '', '--libdir=$frogPath/lib'], files);
51 initializeWorld(files); 68 initializeWorld(files);
52 69
53 print('Parsing MDN data...'); 70 print('Parsing MDN data...');
54 final mdn = JSON.parse(files.readAll('mdn/database.json')); 71 final mdn = JSON.parse(files.readAll('mdn/database.json'));
55 72
56 print('Cross-referencing dart:dom and dart:html...'); 73 print('Cross-referencing dart:dom and dart:html...');
57 HtmlDiff.initialize(); 74 HtmlDiff.initialize();
58 _diff = new HtmlDiff(); 75 _diff = new HtmlDiff();
59 _diff.run(); 76 _diff.run();
60 world.reset(); 77 world.reset();
61 78
62 // TODO(rnystrom): Cram in the the IO libraries. This is hackish right now. 79 // Add all of the core libraries.
63 // We should probably move corelib stuff completely out of dartdoc and have it 80 world.getOrAddLibrary('dart:core');
64 // all here. 81 world.getOrAddLibrary('dart:coreimpl');
82 world.getOrAddLibrary('dart:json');
83 world.getOrAddLibrary('dart:dom');
84 world.getOrAddLibrary('dart:html');
65 world.getOrAddLibrary('dart:io'); 85 world.getOrAddLibrary('dart:io');
86 world.getOrAddLibrary('dart:isolate');
87 world.getOrAddLibrary('dart:uri');
88 world.getOrAddLibrary('dart:utf');
89 world.process();
66 90
67 print('Generating docs...'); 91 print('Generating docs...');
68 final apidoc = new Apidoc(mdn, outputDir); 92 final apidoc = new Apidoc(mdn, outputDir);
69 apidoc.document('html'); 93 apidoc.document();
70 } 94 }
71 95
72 class Apidoc extends doc.Dartdoc { 96 class Apidoc extends doc.Dartdoc {
73 /** Big ball of JSON containing the scraped MDN documentation. */ 97 /** Big ball of JSON containing the scraped MDN documentation. */
74 final Map mdn; 98 final Map mdn;
75 99
76 /** 100 /**
77 * The URL to the page on MDN that content was pulled from for the current 101 * The URL to the page on MDN that content was pulled from for the current
78 * type being documented. Will be `null` if the type doesn't use any MDN 102 * type being documented. Will be `null` if the type doesn't use any MDN
79 * content. 103 * content.
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 return 436 return
413 ''' 437 '''
414 <p class="correspond">This corresponds to $domTypesText in the 438 <p class="correspond">This corresponds to $domTypesText in the
415 ${a("dom.html", "dart:dom")} library.</p> 439 ${a("dom.html", "dart:dom")} library.</p>
416 '''; 440 ''';
417 } 441 }
418 442
419 return ''; 443 return '';
420 } 444 }
421 } 445 }
OLDNEW
« lib/dartdoc/dartdoc.dart ('K') | « utils/apidoc/apidoc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698